Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resource dir issue #1173

Merged
merged 5 commits into from
Nov 27, 2017
Merged

Fix resource dir issue #1173

merged 5 commits into from
Nov 27, 2017

Conversation

martong
Copy link
Contributor

@martong martong commented Nov 23, 2017

Closes #1171.

@martong martong requested review from Xazax-hun and dkrupp November 23, 2017 15:31
Copy link
Contributor

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@whisperity whisperity changed the title Fix resource dir issue #1171 Fix resource dir issue Nov 23, 2017
@martong martong force-pushed the fix_resource_dir2 branch 2 times, most recently from 2591089 to 90e60bc Compare November 23, 2017 16:06
@martong martong added bugfix 🔨 analyzer 📈 Related to the analyze commands (analysis driver) labels Nov 23, 2017

resource_inc = compiler_resource_dir
# Resource include path must end with "/include".
basename = os.path.basename(os.path.normpath(resource_inc))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to move this logic to __get_compiler_resource_dir?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not resolved.

Copy link
Contributor Author

@martong martong Nov 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a long run we plan to use a function which takes both the system includes and the resource dir as a parameter, so we could implement just in one place the madness around this header include order.

Copy link
Member

@dkrupp dkrupp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not seem to work for clang-tidy

-nobuiltininc
and clang resoure dir is missing from clang-tidy invocation

Copy link
Member

@dkrupp dkrupp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

context.ld_lib_path_extra)
# Overwrite PATH to contain only the parent of the clang binary.
if os.path.isabs(config_handler.analyzer_binary):
check_env['PATH'] = os.path.dirname(config_handler.analyzer_binary)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a good idea to overwrite the PATH? What is the motivation behind this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just extend it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or in case the point is to always resolve to the absolute clang binary, maybe we could just set the binary instead of invoking the function that looks up the binary in the path?

Copy link
Contributor Author

@martong martong Nov 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to lookup clang from $PATH when it is a relative path. This is handled with the local object on the stack with the name check_env.
However, when clang-tidy is absolute we overwrite the PATH in check_env so we lookup only in the parent dir of clang-tidy.

It might be confusing to append to the path, because we may end up with /a/b/c/clang for /x/y/z/clang-tidy. This is true nevertheless in the relative case too, but that we cannot work around.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we want tidy and clang from the same directory we should modify the lookup function.
Overwriting the path might have negative consequences when we use this environment. (E.g.: we can not even issue a cd command if we pass this environment to a Popen or similar functions.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply setting the binary will miss the binary e.g. clang-4.0, this the reason to use resolve_missing_binary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't write over the effective PATH in the global env. We use a local variable and we overwrite the path in that local variable.


resource_inc = compiler_resource_dir
# Resource include path must end with "/include".
basename = os.path.basename(os.path.normpath(resource_inc))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not resolved.

@dkrupp dkrupp merged commit ff2db7c into Ericsson:master Nov 27, 2017
@gyorb gyorb mentioned this pull request Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📈 Related to the analyze commands (analysis driver) bugfix 🔨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants