setup-cpp icon indicating copy to clipboard operation
setup-cpp copied to clipboard

macos 11 with llvm 14 broken

Open lczech opened this issue 1 year ago • 6 comments

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

lczech avatar Mar 13 '24 21:03 lczech

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.

aminya avatar Mar 14 '24 19:03 aminya

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?

lczech avatar Mar 14 '24 19:03 lczech

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

aminya avatar Mar 14 '24 20:03 aminya

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 :-)

lczech avatar Mar 14 '24 21:03 lczech

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

aminya avatar Mar 15 '24 01:03 aminya

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!

lczech avatar Mar 15 '24 01:03 lczech