-
Notifications
You must be signed in to change notification settings - Fork 474
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
filter SDKROOT for macos->macos build #537
Conversation
Thanks for the PR! I would prefer to avoid modifying the environment of the calling process if possible, only updating the environment of spawned processes. Additionally this seems not super great to hardcode a path into this crate which may not be the same for all users? Would it be possible to somehow infer that? Are you sure that if the env var isn't set it won't work? |
ffa88dd
to
4f578aa
Compare
Done
Done
Yes, I used such script to find out what is really problem in #530: export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH
#export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
unset SDKROOT
cd /usr/local/var/cache//registry/src/github.com-1ecc6299db9ec823/libloading-0.5.2
"cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/tmp/global_static.o" "-c" "src/os/unix/global_static.c" Initially I inserted all environment variables into it and then binary search the problem env. variables. So |
src/lib.rs
Outdated
if host.contains("apple-darwin") && target.contains("apple-darwin") { | ||
// Replace the `SDKROOT` environment variable if it's clearly set for the wrong platform, which | ||
// may occur when we're linking a custom build script while targeting iOS for example. | ||
// Removing is not enough, because of cc from XCode can not find include files in such case |
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.
Can this comment be clarified? The point of "removing is not enough" is only applicable when we're running clang
directly out of the sysroot I suspect. Executing /usr/bin/clang
doesn't require SDKROOT
to be set, for example.
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.
Done
4f578aa
to
f56b08e
Compare
fixes #530
The code mainly based on rustc source code,
but instead of removing it replace SDKROOT env variable,
because of it is important to find libc headers, like
pthread.h