exclipy / clang_indexer

Other
121 stars 27 forks source link

cmake: Could NOT find LibClang #1

Open lvv opened 12 years ago

lvv commented 12 years ago

On x86_64 Gentoo I've got error from cmake:

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE): Could NOT find LibClang (missing: LibClang_LIBRARY) Call Stack (most recent call first): /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE) cmake/Modules/FindLibClang.cmake:9 (find_package_handle_standard_args) CMakeLists.txt:9 (find_package)

I have clang installed. Clang list of files:

root /> eq f clang

andrewfenn commented 12 years ago

I think it's because FIND_PACKAGE_HANDLE_STANDARD_ARGS can not find /usr/lib64/llvm/libclang.so

Probably because it doesn't look in /usr/lib64. This is all just a guess though since I've only been looking at the project for 10 minutes.

Try playing around in "clang_indexer/cmake/Modules/FindLibClang.cmake" and seeing if you can get the module to find your installed copy of libClang.

lvv commented 12 years ago

Yes, that was my guess too. If I knew how to play with cmake config files ...

exclipy commented 12 years ago

I Googled around and found a little comment buried in http://techbase.kde.org/Getting_Started/Build/Troubleshooting:

you need to make cmake aware your library path is /usr/lib64, not /usr/lib. Do this with

cmake -DLIB_SUFFIX=64 .

It's suspicious that Gentoo's cmake doesn't already know it should be looking in /usr/lib64 though...

bchodorowski commented 12 years ago

I have the same problem! And -DLIB_SUFFIX=64 doesn't help at all. Any ideas?

zilongshanren commented 11 years ago

Bump,I also have the same problem. Please help!

ghost commented 11 years ago

I had the same problem (same error message), and I managed to solve it!

For me, the problem came from the fact that under Fedora x64, the libraries from clang-devel get installed in /usr/lib64/llvm. First, I thought too that the problem came from lib64 not being looked up by cmake, but in fact cmake does (it seems that this got fix in some 2.6.x cmake release). Actually the problem comes from the fact that clang's libs are installed in a llvm subdirectory of lib64; but in cmake/Modules/FindLibClang.cmake:3 no PATH_SUFFIXES is provided for LibClang_LIBRARY.

So, for me the solution was just to add the PATH_SUFFIXES, here is the fixed line: find_library(LibClang_LIBRARY NAMES clang PATH_SUFFIXES llvm)

By the way, it might be worth saying that I also had to install the following packages for BerkeleyDB: libdb-cxx and libdb-cxx-devel.

Hope this will be useful to someone!

yunkai commented 11 years ago

Thanks @Corax26 !

The method could fix it.

sidwubf commented 10 years ago

I got the same problem.Any help?

-- The C compiler identification is Clang 5.0.0 -- The CXX compiler identification is Clang 5.0.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done CMake Error at /usr/local/Cellar/cmake/2.8.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message): Could NOT find LibClang (missing: LIBCLANG_LIBRARY LIBCLANG_INCLUDE_DIR) Call Stack (most recent call first): /usr/local/Cellar/cmake/2.8.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE) cmake/modules/FindLibClang.cmake:82 (find_package_handle_standard_args) server/CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred!

ghost commented 10 years ago

Have you tried my fix (2 comments above)? What does find /usr/{,local/}lib{,32,64} -name 'libclang.so' output (ignoring any unknown directory error)?

MaikoID commented 7 years ago

Same error here, the PATH_SUFFIXES fix suggested didn't work. @Corax26 $ find /usr/{,local/}lib{,32,64} -name 'libclang.so' /usr/lib/llvm-3.8/lib/libclang.so

Ubuntu 16.04

ghost commented 7 years ago

@MaikoID Since libclang.so is in a llvm-3.8 subdirectory, you should try PATH_SUFFIXES llvm-3.8.