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
ld: unknown option: -no_weak_imports #7204
Comments
Looks like this code was already changed and the condition is now:
MacPorts ld64 is the Apple linker, but on older systems we install older versions of the linker presumably because there were problems getting the newer versions working properly on older systems. |
you can't make any assumptions about os version and toolchain versions. It is very common for users to use updated tools. ld64-450, at least, runs on 10.6.8, for example. and ld64 itself will accept different flags depending on the os version it is running on. the only safe thing to do is to test if the ld64 that is in use for the build on the system you're build on accepts the flag before using it. |
Dylan, what is this part of the test meant to be testing?
If it is supposed to be testing for Xcode > 8.0, it doesn't appear to be doing that as it is hitting on all Xcodes, it seems, at least back to 3.2.6. Is it testing for clang > 8.0 ? I doubt that it would be doing a test like that... Apple's clang is in the 1000s now.... and open source clangs from llvm are not likely on your radar to test for (and wouldn't be relevant to the linker flag anyway). Is it testing for a linker version > 8.0? If so, then all of them pass that test, of course, as the oldest one we use is ld64-97. |
Ken, I assume The issue was that Xcode 8 introduced the macOS 10.12 SDK which contained the As we've discussed in this issue, checking the LLVM version doesn't seem like a good way to determine the capabilities of the linker. It's biting us on Snow Leopard when using a newer clang with an older linker. And you pointed out that the linker accepts different flags on different OS versions which I didn't know. So I agree with you that instead meson needs to run the linker with the flag and see if the linker generates an error. If so, then the flag is not supported and should not be added to the project's flags. |
Yes, it's returning the version that I'm going to be honest that I'm not a mac developers, all I did was split the representations of the linkers and compilers into two separate classes so you could try to mix and match them. I think @ryandesign's solution is probably the right one, we do that in some other cases for the gnu-like linkers. |
Describe the bug
has_function
fails on Mac OS X 10.6.8 (with Xcode 3.2.6) when using open source clang 9.0.1 (installed by MacPorts 2.6.2) becausehas_function
now uses-Wl,-no_weak_imports
which old linkers don't understand.For example, at-spi2-core fails to build. The error is:
dlopen
exists in Mac OS X 10.3 and later so this check should not have failed.at-spi2-core is checking for the presence of
dlopen
this way:Looking into the meson-log.txt, the reason is:
ld
is ld64 from MacPorts:Apparently
-Wl,-no_weak_imports
was added to deal with an issue with Xcode 8 and later. The code in meson is using the following criteria to decide when to add the flag:This is incorrect, since it is possible and in many cases these days essential to use newer compilers on older systems to get anything built. MacPorts defaults to open source clang 9 on Mac OS X 10.6 now. Bear in mind also that open source clang and Apple clang use different version numbering schemes so you need to check which flavor of clang you've got before you check its version. I don't know what
self.clang_type == CLANG_OSX
is but if it was meant to verify that you've got Apple clang then it failed to do that.Of course checking the version of Xcode would not be the correct criteria either since (on systems newer than 10.6) the user might only have the command line tools installed without having Xcode itself.
Perhaps it is the SDK version that you should be looking at but I'm not sure. Or perhaps you should check whether the linker supports
-no_weak_imports
before adding it.To Reproduce
Try to install at-spi2-core on Mac OS X 10.6. For example, with MacPorts, try
sudo port install at-spi2-core
.Expected behavior
Successful build
system parameters
meson --version
: 0.54.1ninja --version
if it's a Ninja build: 1.10.1The text was updated successfully, but these errors were encountered: