JuliaHubOSS / llvm-cbe

resurrected LLVM "C Backend", with improvements
Other
846 stars 146 forks source link

Build issue when using pre-compiled LLVM that is several files (not just libLLVM) #96

Closed hikari-no-yume closed 1 year ago

hikari-no-yume commented 3 years ago

The precompiled LLVM 10 for macOS on llvm.org (https://releases.llvm.org/download.html#10.0.1) has many libraries beginning with “libLLVM” rather than a single libLLVM file.

I had no problems configuring with cmake once I specified LLVM_DIR, but I got “Undefined symbols for architecture x86_64” when I tried to build it (make -j4 llvm-cbe).

The fix for me was to edit tools/llvm-cbe/CMakeLists.txt and comment out the if (NOT USE_SYSTEM_LLVM) and matching endif(), and all the lines in the if(USE_SYSTEM_LLVM) block.

No idea why this is how it is, but it seems to work.

By contrast I didn't have this problem on Ubuntu with the LLVM package from the standard distribution repository.

I hope this is useful if anyone else encounters this issue.

vtjnash commented 3 years ago

Yeah, the USE_SYSTEM_LLVM stuff seems non-sensical to me on first glance. Perhaps it can be removed?

hikari-no-yume commented 3 years ago

My experience was it worked properly on Ubuntu, so I'm wondering if it's some sort of workaround for weird distribution packaging. With that said, maybe it would work without the flag too. When I can use my Ubuntu machine again, I'll experiment a bit.

hikari-no-yume commented 3 years ago

I checked, and if I do the same commenting out on my Ubuntu machine with the system packaged LLVM, it has its own linking errors. So it clearly has some purpose…

vtjnash commented 3 years ago

There's a couple different shared library configurations in the llvm cmake. I think this option is supposed to reflect one of them? (But for some reason doesn't just use the relevant flags themselves)

dpaoliello commented 1 year ago

We now have a CI build that verifies using pre-built LLVM on MacOS #166