bcc: bcc doesn't find llvm cmake files on Ubuntu Xenial
There is an upstream bug related to cmake+llvm that is affecting our ability to build on Ubuntu Xenial. That bug is tracked at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819072.
The cmake … phase of our build break with:
$ cmake ..
-- Latest recognized Git tag is v0.1.8
-- Git HEAD is 3036b96e4ba4f03868ff2271765adb031edf21d6
-- Revision is 0.1.8-3036b96e
CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:178 (include):
include could not find load file:
/usr/share/llvm/cmake/LLVMExports.cmake
Call Stack (most recent call first):
CMakeLists.txt:17 (find_package)
CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:181 (include):
include could not find load file:
/usr/share/llvm/cmake/LLVM-Config.cmake
Call Stack (most recent call first):
CMakeLists.txt:17 (find_package)
-- Found LLVM: /usr/include
CMake Error at CMakeLists.txt:36 (message):
Unable to find clang libraries
-- Configuring incomplete, errors occurred!
As a workaround, I was able to do the following manually:
sudo apt-get install -y llvm-3.8-dev libclang-3.8-dev
sudo mkdir -p /usr/lib/llvm-3.8/share/llvm
sudo ln -s /usr/share/llvm-3.8/cmake /usr/lib/llvm-3.8/share/llvm/cmake
sudo sed -i -e '/get_filename_component(LLVM_INSTALL_PREFIX/ {s|^|#|}' -e '/^# Compute the installation prefix/i set(LLVM_INSTALL_PREFIX "/usr/lib/llvm-3.8")' /usr/lib/llvm-3.8/share/llvm/cmake/LLVMConfig.cmake
sudo sed -i '/_IMPORT_CHECK_TARGETS Polly/ {s|^|#|}' /usr/lib/llvm-3.8/share/llvm/cmake/LLVMExports-relwithdebinfo.cmake
sudo sed -i '/_IMPORT_CHECK_TARGETS sancov/ {s|^|#|}' /usr/lib/llvm-3.8/share/llvm/cmake/LLVMExports-relwithdebinfo.cmake
sudo ln -s /usr/lib/x86_64-linux-gnu/libLLVM-3.8.so.1 /usr/lib/llvm-3.8/lib/
This /issue should serve as a placeholder until the upstream is fixed.
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 9
- Comments: 15 (1 by maintainers)
Actually, I use command
sudo apt-get install libclang-dev
to solve this problem.@drzaeus77 @butterl
I somehow managed to get all the CMake errors resolved (broadly following what @drzaeus77 has suggested), but then I got a number of warnings of the type -
This looked like chasing rabbit holes. So I finally decided to give llvm and clang 3.8 a pass and built using clang-3.7 and llvm-3.7. ( I had to clean up all llvm-3.8 packages that were installed using
apt-get remove llvm-3.8 clang-3.8
)Other than a couple of warnings like this - the compilation was successful.
So you might want to try 3.7 instead of 3.8 (Note also: There is a hard-coded reference to 3.7 in CMakeLists.txt - line 41 or something - so may be that is expected version?).
In case people have the same problem, I can confirm that @drandynisbet hack works. In my case, I am using llvm-7. Just do the following:
Then edit
CMakeLists.txt
by adding the path to the directory containing the clang static files *.aSimilar/related problem persists on ubuntu cosmic 18.10 (development - but soon to be an ubuntu release)
cmake … -DCMAKE_INSTALL_PREFIX=/usr – Latest recognized Git tag is v0.7.0 – Git HEAD is 4263e1ae1c60a1b2655a31d4832fba0eaf5bc41e – Revision is 0.7.0-4263e1ae – Found LLVM: /usr/lib/llvm-6.0/include 6.0.1 CMake Error at CMakeLists.txt:50 (message): Unable to find clang libraries
– Configuring incomplete, errors occurred!
Fix for the cmake for me … was to update the CMakeLists.txt in the bcc directory to reflect the clang/llvm version for my distribution … 35 set(CLANG_SEARCH “/opt/local/llvm/lib;/usr/lib/llvm-3.9/lib;${LLVM_LIBRARY_DIRS}”)
clang include files are incorrectly set … so build fails but working on it
Hmm… strange mismatch between clang and LLVM_MAJOR_VERSION … on cosmic