Skip to content
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

Limit use of llvm-config with USE_SYSTEM_LLVM on Darwin #40680

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carlocab
Copy link
Contributor

@carlocab carlocab commented May 1, 2021

As noted in #29981 and #30459, llvm-config is broken on Darwin, and
sadly hasn't been fixed since then.

Building Julia on Darwin with USE_SYSTEM_LLVM doesn't currently work,
as calls to llvm-config produce the wrong flags. This PR fixes that.

For reference, llvm-config --libfiles still prints out a long string of static
libraries, and llvm-config --libs returns a long string of linker flags to
individual LLVM libraries. Attempting to use those linker flags (e.g. -lLLVMXRay)
leads to a linker failure about missing symbols.

As noted in JuliaLang#29981 and JuliaLang#30459, `llvm-config` is broken on Darwin, and
sadly hasn't been fixed since then.

Building Julia on Darwin with `USE_SYSTEM_LLVM` doesn't currently work,
as calls to `llvm-config` produce the wrong flags. This PR fixes that.
@haampie
Copy link
Contributor

haampie commented Nov 14, 2021

This is not limited to Darwin, you get this when you build with LLVM_BUILD_LLVM_DYLIB=ON and LLVM_LINK_LLVM_DYLIB=OFF on Linux too.

Note that --system-libs is broken too :(. It just gives the linker flags -lz, -ltinfo even when LLVM is built with -L/non-standard/path/to/libz/lib -lz, -L/non-standard/path/to/ncurses/lib -ltinfo.

@vchuravy
Copy link
Member

What happens if you use llvm-config --shared?

@carlocab
Copy link
Contributor Author

Do you mean --link-shared? llvm-config has no --shared flag. Here's what happens:

❯ llvm-config --libfiles --link-shared
llvm-config: error: libLLVM-12.dylib is missing

That's what this snippet is for (cf. #30033). Creating the symlink works, but you don't get this symlink if you don't already know to do it for yourself when installing LLVM (or you use a package manager that does it for you).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants