-
Notifications
You must be signed in to change notification settings - Fork 500
Tool does not follow symlinks #408
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
Comments
What does
I'm not sure if it's a good idea to try to parse this. |
This is sort of happening on #407, and it might be good to fix both at the same time! |
I was actually thinking of doing something to follow symlinks, too, after working on #407. But I'd really be fine with just following symlinks instead of #407. I think it's a more general solution that handles more than just fixing the default for macOS. @alexcrichton If you agree with that, I'll finish my work on cleaning up the tests first and then do the symlink following. Is there an existing solution for following symlinks, or should I use |
I think that |
Just to open up the discussion a bit more to alternatives for compiler detection, we could instead use a small C program with int main() {
#if defined(__clang__)
return 1;
#elif defined(__GNUC__)
return 2;
#elif defined(_MSC_VER)
return 3;
#else
return 0;
#endif
} Another option is to use something like the existing |
But, as I just realized, my suggestion in #408 (comment) won't work for cross-compiling. So it looks like the current executable-name-based mechanism with symlink resolution is good enough. |
While you're right that the executable strategy doesn't work for cross compilation it would work for using the preprocessor to learn what the compiler is, but I think relying on symlink reading for now is good enough |
It wouldn't work if the compiler is a cross-compiler to a target that is incompatible with the host because you couldn't run the above program (without an emulator). But I believe you're suggesting a way to use the preprocessor alone – without building an executable – to determine the compiler? That would require knowing which flag to pass to the compiler to invoke the preprocessor. But, as long as you're only interested in a few compilers, you don't need to worry about trying all possible flags. GCC and Clang both use
Fine with me. It's always good to discuss the options. |
Ah, I see this is already implemented in |
Just to provide an update, I'm actively working on a solution to this. I should hopefully have something to show within the next few days. The hard part is done. I'm working my way through dealing with unit tests now. I decided to use the C preprocessor (similar to #408 (comment)), since I think it is the most reliable method and can easily scale to support other C/C++ compilers. |
@spl Is there a branch somewhere that contains your changes so far? |
with_features
inTool
uses the name of the path to determine compiler family in https://github.com/alexcrichton/cc-rs/blob/master/src/lib.rs#L2113It appears that for modern Macs running Mojave (10.14+),
c++
is symlinked toclang++
but cc doesn't follow the symlink and treats it as a gnu compiler.Current workaround is to manually set
CXX=$(which clang++)
but the right solution should look at the output of 'c++ -v` instead of the path name.The text was updated successfully, but these errors were encountered: