Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
901 stars 98 forks source link

How can I set CMAKE_PREFIX_PATH to successfully install irony-server? #466

Open ghost opened 6 years ago

ghost commented 6 years ago

Hello, first thank you for your efforts maintaining this great repository.

I am running irony-mode with company-mode, emacs25.3.1 on fedora 27.

When I've tried M-x irony-install-server, it complains that it couldn't find stddef.h, however, installation succeeded and somehow the completion features worked at some amount.

cmake -DCMAKE_INSTALL_PREFIX\=/home/username/.emacs.d/irony/ /home/username/.emacs.d/elpa/irony-1.2.0/server && cmake --build . --use-stderr --\
config Release --target install                                                                                                                   
-- Detecting Clang resource directory                                                                                                             
-- Detecting Clang resource directory -- fail                                                                                                     
CMake Warning at cmake/CheckClangResourceDir.cmake:82 (message):                                                                                  
  CheckClangResourceDir: unsupported configuration, please report.                                                                                

    Check with args: /tmp/build-irony-server-1.2.0/CMakeFiles/CMakeTmp/check-libclang-stddef.cpp                                                  
    Check output:                                                                                                                                 
      /tmp/build-irony-server-1.2.0/CMakeFiles/CMakeTmp/check-libclang-stddef.cpp:1:10: fatal error: 'stddef.h' file not found                    

  argv[1]:                                                                                                                                        
  /tmp/build-irony-server-1.2.0/CMakeFiles/CMakeTmp/check-libclang-stddef.cpp

Yet I want to install irony-server without those warnings. From #465, I've found that I need

  • the path to the libclang headers
  • the path to the libclang library
  • the path to the libclang resource directory, a directory where builtin headers are available, such as stddef.h

and I've figured out where those files are located in

/usr/lib64/clang/5.0.1/include/ # stddef.h, etc.
/usr/lib64/clang/5.0.1/lib/
/usr/lib64/ # libclang.so

I have tried cmake -DCMAKE_PREFIX_PATH=/usr/lib64/clang/5.0.1 but it didn't work. I have no clue how to set CMAKE_PREFIX_PATH. Which option should I pass to cmake?

Best Regards, Seonghyun Park

Sarcasm commented 6 years ago

Do you use melpa stable? If so, can you try the unstable version, as 5.0.1 wasn't supported in the last release.

In your case, you don't need CMAKE_PREFIX_PATH, but if you had to specify it with your setup, that would be CMAKE_PREFIX_PATH=/.

ghost commented 6 years ago

As you said, I've added melpa unstable to package archive list, reinstalled irony, and the irony-server is installed successfully.

Thank you for your help!

ghost commented 6 years ago

I have one more question. company-irony seems to work well with most of the cases, yet, there are some standard libraries for which completion doesn't work (e.g. std::map). Why I cannot get completions for these libraries?

I am currently using .clang_complete as a completion back-end configuration.

-I/path/to/my/projects
-std=c++14

Thank you