-
Notifications
You must be signed in to change notification settings - Fork 99
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
std:: does not complete on Mac OS X #138
Comments
Hi, Can you do a clean CMake build of irony-server to see what is printed in the log.
Please post the complete cmake generation output, i.e:
|
Hi, this is the complete cmake output:
I have at least three different versions of clang installed in various locations (the Apple-supplied one, which is used as the default C/C++ compiler), the clang that comes with the Homebrew "llvm" package (currently at version 3.5) and the clang that comes with the Homebrew "llvm3.5" package (this one is also at v3.5.0, but in contrast to "llvm" includes libcxx support). I guess it's just not a good idea to compile against the llvm package without libcxx support (?), but this is the package that is picked up by the default irony-server compilation commands. |
If you run Is it There is an homebrew issue with this package, see: Homebrew/legacy-homebrew#34169 That doesn't seem related though. Do you know if you have another libclang.dylib on your system apart from the Homebrew ones? By default irony should probably look for the one installed on the system, then in Homebrew. |
this is the output I get from
All dylibs in |
First a question about homebrew, It seems like the proper thing to do according to the following table If you would be so kind as to test the change and see if it works, you can change the references to /usr/local/Cellar/ by /usr/local/opt/ and see if things still work, see irony-mode/server/cmake/modules/FindLibClang.cmake Lines 34 to 35 in 4554edf
Another thing would be to swap the order of LLVM Homebrew and LLVM Homebrew/versions, so that versioned (~stable) packages will be looked up before unversionned one. - # LLVM Homebrew
- "/usr/local/Cellar/llvm/${version}/include"
# LLVM Homebrew/versions
"/usr/local/lib/llvm-${version}/include"
+ # LLVM Homebrew
+ "/usr/local/opt/llvm/${version}/include"
I'm not sure to understand all this. Aren't you already using llvm35? Are you talking about the Homebrew versioned one? Why do you want libLLVM? Almost all libclang.dylib should be good to work with, except from a few gotchas for older versions, see FAQ. |
The more I think about it the more I think that irony-mode shouldn't try to locate homebrew and it should be left to the user to do so, knowing he is using homebrew. What does Does the Homebrew installation make the |
Hi,
Unfortunately I'm far from a Homebrew expert myself, but I guess that defaulting to /usr/local/opt wouldn't change much because I know my setup is a bit confusing. Right now I have two versions of LLVM 3.5, one is called simply
I think I once had some rpath issues with
|
I think this is similar to this issue: Homebrew/legacy-homebrew#34169
I think, that irony-mode could at least check the versioned llvm before. If you can try it and see if that's enough for irony-server to work.
Sadly I think that the development files are not provided by XCode, only the runtime library is provided. I may be wrong though, I would be interested to know.
Thank you, |
Hm, changing the FindLibClang file produced the same results as before. If I add a path to the
then the following error occurs:
I can link
However, I then have to explicitly add an rpath to |
Out of curiosity, can you try to do the following:
Is For the rpath issue, see: https://github.com/Sarcasm/irony-mode/blob/4554edf926697782539ad601bf20756a5c02a1f2/README.md#faq
Are you sure that this path contains the libclang API headers and not the clang compiler built-in header path? irony-server at build time need the libclang API headers, called |
Hi,
Calling There are, however, no clang-c includes in the Xcode toolchain, so I guess this can't be used without Homebrew (or some other llvm installation) after all. |
I forgot to add, the path |
on the other hand, the Xcode command line tools also include |
Can you show the where irony found the libclang include? Either using
So you mean, building with the Irony-mode is checking |
It's using the include files supplied with
If that could be used to download the right include files, that would be great. I don't know if the version numbers supplied by clang will actually correspond to llvm version numbers (Apple clang uses a versioning scheme of its own, as far as I can tell), but I guess that the few Apple-built clang versions that are released to the public could easily be hardcoded into the compilation script. Also, |
If looks like your current setting with libclang.dylib coming and clang-c/Index.h coming from different sources is a bad idea. Can you check if you have the Can you try something else for me?
Does that works? I'm thinking about using this version more and more as I have a lot of issues with regard to Mac OS X and few people actually being fluent in either CMake or Homebrew. |
I do have |
That's good to know! Did you use What does I think I will cleanup the CMake files:
|
Yes, I used
great, I'm looking forward to that! |
While we are at it, can you tell me what is the output of |
sure, here you go:
Just in case, this is the complete directory tree:
|
Great, thank you! |
Pardon me for jumping in.
Is it exactly the clang++ from homebrew llvm, not the default installed one or versions/llvm35's? |
Oh,my. It seems to be solved already. Sorry for disturbing... |
There is a good chance that you may don't even need brew (if you already have cmake). irony-server compiles and works on OSX Yosemite with standard libclang from Xcode7. The only piece missing is clang-c header files, which may be borrowed from llvm 3.8 ;-) Quick and dirty way to build irony-server on Yosemite with Xcode7 ### create /usr/local if not there yet
sudo mkdir -p /usr/local/lib /usr/local/include
### grab standard libclang
sudo cp -p "`xcode-select --print-path`"/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib /usr/local/lib
### (dirty part) supplement with latest llvm clang-c includes
cd /tmp
svn export http://llvm.org/svn/llvm-project/cfe/trunk/include/clang-c/
sudo cp -RP clang-c /usr/local/include M-x irony-install-server should give you no trouble after that. Compiles and works. One more step required on OSX - need to find where Xcode keeps all header files to add them to your .clang_complete. Otherwise irony is useless. Peek at what Apple compiler uses echo | clang -x c++ -v -E - 2>&1 | sed -n '/^#include </,/^End/s|^[^/]*\([^ ]*/include[^ ]*\).*$|-I\1|p' Add them to your .clang_complete:
Adding to irony-additional-clang-options should work as well |
I again stumbled on this issue, my setup is clang using homebrew then built the irony server and ran emacs, but wasn't getting any coherent results which is certainly not the case on the fix for me was adding this to my
Hope it helps someone. |
After hours of trial and errors, you just made my day |
Hi,
I have recently installed irony-mode on Mac OS X, with a homebrew-supplied libclang (from the 'llvm' package, currently at version 3.5). Unfortunately, the completion process doesn't pick up any standard library includes by default. For the following minimal example,
no completion candidates are offered. Running irony-server directly from the terminal shows that clang considers std an undeclared identifier. I can resolve the issue by explicitly passing the path to the stdlib header files to irony-server, i.e., by adding
to the compile-options. Is there a better way to fix the stdlib completion issue? Since clang++ correctly picks up the header files during compilation (or flycheck syntax checking), I do not want to add the above include path to my compilation database.
best,
Sebastian
The text was updated successfully, but these errors were encountered: