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
Difficulty finding the right LLVM... #380
Comments
I don't know if this helps you, but here is the command I use to use homebrew's llvm (on OSX 10.11). cmake might be ignoring some of your environment variables, or something trivial like that. cmake -DCMAKE_CXX_COMPILER=/opt/brew/opt/llvm/bin/clang++ -DCMAKE_PREFIX_PATH=/opt/brew/opt/llvm -DCMAKE_INSTALL_RPATH=/opt/brew/opt/llvm -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE -DCMAKE_INSTALL_PREFIX=/Users/kirill/.emacs.d/irony/ /Users/kirill/.emacs.d/elpa/irony-20170427.1601/server && cmake --build . --use-stderr --config Release --target install |
Cool. I did a direct equivalent and it worked. BUT, either the instructions on README should be updated to explain how to build manually, or possibly the automation needs to be fixed to do such things for the user. I wouldn't have figured that out on my own as I'm not familiar with CMake (though I admit I should be.) As an aside, @ikirill, do you put your homebrew stuff in /opt/brew/opt? I didn't know that would work without trouble. |
Yes, my homebrew is in /opt/brew. /opt/brew/opt is the path under homebrew where all the packages go that collide with native OSX stuff (like clang, which would collide with the system clang). It works fine. If I remember correctly, the only tricky part of that is "CMAKE_INSTALL_RPATH_USE_LINK_PATH", which took me some time to find. |
Yeah, I agree, it would be nice to just put the whole command in the readme, so that it can be copy-pasted (almost) directly, especially since tracking down the right cmake options can take some time when you don't remember them by heart. |
I would be glad to do automatically the right thing on macOS, if only it was 100% clear what is right. There is a wiki page regarding macOS with various instructions: |
I think the command that would work for normal setups is this: cmake -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ -DCMAKE_PREFIX_PATH=/usr/local/opt/llvm -DCMAKE_INSTALL_RPATH=/usr/local/opt/llvm -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE -DCMAKE_INSTALL_PREFIX=~/.emacs.d/irony/ ~/.emacs.d/elpa/irony-20170427.1601/server && cmake --build . --use-stderr --config Release --target install Maybe it's worth including it in the readme, just as an example, so that people can substitute their own paths without thinking too much? Also, I want to point out that the fix using install_name_tool is really quite awkward, because it's the sort of thing cmake normally handles without any trouble, so invoking anything other than cmake with the right flags is a little unreasonable. Also, I wouldn't agree the llvm package is broken, OSX just expects linking to be done in a certain way. |
Autoconfiguration shouldn't be too hard, because if llvm is in the path, then llvm-config is in the path, and you can ask it to tell you where to find all the LLVM bits. I would say that is the safest method, and the most reasonable. If you're not familiar, llvm-config spits out the path to all the various llvm bits that you might want to find or link against. See the manual for details. However, barring that, as @ikirill notes, the README could point at the wiki and the wiki could give some examples, or the the README itself could give examples. |
Hi all, this is a small script that works for now. Hope it helps. |
That script has hard-coded paths in it. It would be nice to use llvm-config instead to do that. llvm-config is a command that will be in the path for any LLVM user and which can be asked to print out the paths to any of LLVM's components. |
Yes, it's just to workaround. |
[macos with homebrew]
And LIBCLANG_LIBRARY=`llvm-config --libdir`/libclang.dylib
LIBCLANG_INCLUDE=`llvm-config --includedir` Thanks, @pmetzger. |
Howdy! Building the irony server on macOS Sierra, I'm having trouble getting the thing to find my locally installed copy of LLVM. In particular, when I run this (either manually or via irony-install-server):
cmake -DCMAKE_INSTALL_PREFIX=/Users/perry/.emacs.d/irony/ /Users/perry/.emacs.d/elpa/irony-20170427.1601/server && cmake --build . --use-stderr --config Release --target install
it finds my XCode version of LLVM (which doesn't include libclang) but not my locally installed version of LLVM 4.0 which I've verified is earlier in my path.
Suggestions?
The text was updated successfully, but these errors were encountered: