llvm-config output on MacOS


I configured and built LLVM as follows on Mac OS 10.13.2:

$ pwd


$ xcodebuild -project LLVM.xcodeproj

All binaries are in /Debug/bin. I am interested in using the output of llvm-config. Now, when I run

$ /Debug/bin/llvm-config --cmakedir



$ ls -d <llvm-build-dir>/Debug/bin/llvm-config --cmakedir

ls: /Debug/lib/cmake/llvm: No such file or directory

instead I have

$ ls -d /lib/cmake


As seen above, the output of llvm-config --cmakedir returns a non-existent directory. Took a quick look at the sources of llvm-config. Comment says the tool is designed to support being run from both dev tree and install path. Looks like the test to identify if the tool is being run from within dev tree is not recognizing that the tool is indeed being run from dev tree.

Would anyone know what I am missing?

I do not see this behavior on Linux - probably since build binaries are placed in /bin on Linux as opposed to //bin on MacOS.



It may be that llvm-config simply doesn’t understand a multi-configuration build tree. Ninja and make use single-configuration trees, XCode and Visual Studio use multi-configuration.


Thanks for your reply, Paul.

That seems to be a plausible explanation.

I ended up adding code in my project to massage the output of llvm-config to the right paths based of the values of CMAKE_GENERATOR and build-mode.


I’m not saying there isn’t a bug here.

But I think most llvm developers use
$ cmake -GNinja …
$ ninja
even on macos. So unless you need an xcode project I would recomment that.

  • Matthias

Thanks, Matthias. That is indeed a good suggestion.

I’ve been favoring Xcode on macros simply because of the code cross-referencing and completion I get out of the box for llvm sources, shortening the time I spend for dev and digging into llvm internals.

On Linux, I plow through with a less than seemless dev environment that is a combination of Eclipse (couldn’t get it to work well with llvm sources), emacs, grep, find, [crt]tags etc :frowning:

Happy to hear any suggestions on this slightly divergent topic.