Skip to content

Commit

Permalink
Fix --system-libclang on Gentoo amd64, if llvm is compiled with ABI_X…
Browse files Browse the repository at this point in the history
…86="32 64"

$ ls -ld /usr/lib64/llvm/4/l*
drwxr-xr-x 3 root root  20K Dec 16 02:37 lib32
drwxr-xr-x 3 root root  20K Dec 16 02:37 lib64
drwxr-xr-x 2 root root 4.0K Dec 16 02:37 libexec

This results in GLOB finding the wrong library.

$ ./install.py --clang-completer --system-libclang
...
Using external libclang: /usr/lib64/llvm/4/lib32/libclang.so.4.0
...
/usr/lib64/llvm/4/lib32/libclang.so.4.0: error adding symbols: File in wrong format
  • Loading branch information
DarthGandalf committed Dec 22, 2017
1 parent f062b3e commit a4e8b0e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cpp/ycm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ if ( EXTERNAL_LIBCLANG_PATH OR USE_SYSTEM_LIBCLANG )
else ()
set( ENV_LIB_PATHS "" )
endif()
find_program( LLVM_CONFIG_EXECUTABLE NAMES llvm-config )
if ( LLVM_CONFIG_EXECUTABLE )
execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --libdir
OUTPUT_VARIABLE LLVM_CONFIG_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE )
endif()
# On Debian-based systems, llvm installs into /usr/lib/llvm-x.y.
file( GLOB SYS_LLVM_PATHS "/usr/lib/llvm*/lib" )
# On FreeBSD , llvm install into /usr/local/llvm-xy
Expand All @@ -297,6 +303,7 @@ if ( EXTERNAL_LIBCLANG_PATH OR USE_SYSTEM_LIBCLANG )
libclang.so.1
PATHS
${ENV_LIB_PATHS}
${LLVM_CONFIG_PATH}
/usr/lib
/usr/lib/llvm
${SYS_LLVM_PATHS}
Expand Down

0 comments on commit a4e8b0e

Please sign in to comment.