-
Notifications
You must be signed in to change notification settings - Fork 13.4k
provide a warning at at configure time if cc, gcc, and g++ point to a mixture of clang and gcc. Fixes issue #10959 #10964
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
Conversation
this addresses issue #10959 |
also I'd like to thank evan cofsky for helping me hack out the sh scripting needed for this. |
|
||
gccIsGCC () { | ||
gcc --version 2>/dev/null | grep -q gcc | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many empty lines? (nb. i'm about to rebase your suggestion onto my branch)
Excellent suggestion. I'll make those changes later this afternoon. |
I just updated the commit with the earlier feedback. Should I rebase the commit ontop of master? |
updated to be on top of current master |
good point on the --enable-clang actually didn't work when I was trying to get rust working building though, though I could be misremembering. |
echo this can create confusing build failures at link time. | ||
echo Please run cc --version, gcc --version and g++ --version to check. | ||
echo If they are different, change the cc gcc and g++ in your path | ||
echo point to the same compiler version, or alternatively try --enable-clang. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the if [ $(uname ...
check if --enable-clang
was passed, so that this error message isn't printed in that case?
(Also, I'm not 100% sure on style, but I would personally indent all these echo
statements.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the right way for me to answer that is to see if i can do a test build correctly with --enable-clang + gcc pointing to gcc, and cc and g++ pointing to clang.
i don't care about the indentation either way, i'll make that change if need be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrm, --enable clang seems to work under the mixed cc / g++ etc. I'll double check a wee bit more, then figure out adding that conditional about enable clang
hrm, so it looks like currently the configure script https://github.com/mozilla/rust/blob/master/configure#L554-L563 # OS X 10.9, gcc is actually clang. This can cause some confusion in the build
# system, so if we find that gcc is clang, we should just use clang directly.
if [ $CFG_OSTYPE = apple-darwin -a -z "$CFG_ENABLE_CLANG" ]
then
CFG_OSX_GCC_VERSION=$("$CFG_GCC" --version 2>&1 | grep "Apple LLVM version")
if [ $? -eq 0 ]
then
step_msg "on OS X 10.9, forcing use of clang"
CFG_ENABLE_CLANG=1
putvar CFG_ENABLE_CLANG
fi
fi perhaps I should put my warning logic there? or some suitable adaptation thereof |
Yes, that is a good place for this version detection, which would be in the |
updated it again with the current feedback |
fixed it up a bit, should be more correct. |
@alexcrichton thoughts? |
…ure of clang and gcc. Fixes issue #10959 Signed-off-by: Carter Tazio Schonwald <carter.schonwald@gmail.com>
@alexcrichton and others: heres a proof of concept patch for configure that (for now is OS X only) checks at the very end of the configure script if ``cc``, ``gcc``, and ``g++`` possibly point to the same compiler or not. The way its currently done is i call ```cc --version```, ``gcc --version`` and ``g++ --version`` and check if theres any matchings for the word ``clang``, ``gcc`` or ``g++``. So it doesn't rule out miss matched gcc versions or the like, but thats a bit more implausible I think.
New lints ['`needless_pub_self`], [`pub_with_shorthand`] and [`pub_without_shorthand`] Closes rust-lang#10963 Closes rust-lang#10964 changelog: New lints ['`needless_pub_self`], [`pub_with_shorthand`] and [`pub_without_shorthand`]
@alexcrichton and others: heres a proof of concept patch for configure that (for now is OS X only) checks at the very end of the configure script if
cc
,gcc
, andg++
possibly point to the same compiler or not.The way its currently done is i call
cc --version
,gcc --version
andg++ --version
and check if theres any matchings for the wordclang
,gcc
org++
. So it doesn't rule out miss matched gcc versions or the like, but thats a bit more implausible I think.