aminya / setup-cpp

Install all the tools required for building and testing C++/C projects.
Apache License 2.0
185 stars 27 forks source link

macos 11 with llvm 14 broken #235

Closed lczech closed 4 days ago

lczech commented 6 months ago

Hi there,

after my source files all compile fine, I'm getting a linking error at the end:

ld: warning: directory not found for option '-L"/Users/runner/llvm/lib"'
ld: warning: dylib (/Users/runner/llvm/lib/libc++.dylib) was built for newer macOS version (11.6) than being linked (11.0)
ld: warning: dylib (/Users/runner/llvm/lib/libunwind.dylib) was built for newer macOS version (11.6) than being linked (11.0)
ld: warning: dylib (/Users/runner/llvm/lib/libunwind.dylib) was built for newer macOS version (11.6) than being linked (11.0)
ThinLTO: CMakeFiles/grenedalf.dir/src/commands/analyze/fst.cpp.o1: error: Invalid value (Producer: 'LLVM14.0.6' Reader: 'LLVM APPLE_1_1300.0.29.30_0')
LLVM ERROR: Can't load module, abort.
clang-14: error: unable to execute command: Abort trap: 6
clang-14: error: linker command failed due to signal (use -v to see invocation)

This only happens with macos 11 and llvm 14, and seems to be coming from some mismatching versions. I am not entirely sure if this is a setup-cpp issue (it seems so though), or something else. If something else, feel free to close this issue again ;-)

Cheers Lucas

Upvote & Fund

@aminya is using Polar.sh so you can upvote and help fund this issue. The funding is received once the issue is completed & confirmed by you.

Thank you in advance for helping prioritize & fund our backlog!


Fund with Polar

aminya commented 6 months ago

It seems to me that the reason it is broken is because of LTO. Not sure what we can do to fix that old LLVM.

lczech commented 6 months ago

Not sure that I understand. It seemed to me that this is due to a setup of two conflicting versions of LLVM. How would LTO introduce this error?

aminya commented 6 months ago

Because in LTO, the linker strictly requires matching MacOS target versions. If you build without LTO, it warns, but it will succeed in building.

lczech commented 6 months ago

Ah I see, thanks for the explanation! Isn't that something that would be fixed by having matching target versions though? Is that something that could be done here in setup-cpp? I'd like to keep LTO activated if possible, and not have to introduce an exception for certain OS/compiler combinations :-)

aminya commented 6 months ago

Those specific binaries that LLVM provided are built with that target version. I'll see if there's a solution other than building from the source

lczech commented 6 months ago

Ah now it makes sense that you said

Not sure what we can do to fix that old LLVM.

before :-D Thanks for being patient with me, now I get it!

No worries, if that's too much hassle, I don't think it's the most important thing to fix. I have now simply excluded OSX11 + LLVM14 from my GitHub Actions workflow, which is okay. Any user that happens to want to use exactly those two will then have to deal with it somehow ;-)

Feel free to close the issue if this requires more than just a quick version fix!