llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.58k stars 11.81k forks source link

Clang 17 and 18 apt packages are missing libclang during cmake configure #73402

Closed danakj closed 10 months ago

danakj commented 10 months ago

Example CI run: https://github.com/chromium/subspace/actions/runs/6991409739/job/19021950901?pr=407

clang 18 is installed:

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18 all
[...]
Setting up libclang-cpp18-dev (1:18~++20231125042245+024718313b52-1~exp1~20231125042401.1328) ...
Setting up clang-18 (1:18~++20231125042245+024718313b52-1~exp1~20231125042401.1328) ...
Setting up clang-tools-18 (1:18~++20231125042245+024718313b52-1~exp1~20231125042401.1328) ...
Setting up clang-tidy-18 (1:18~++20231125042245+024718313b52-1~exp1~20231125042401.1328) ...
Setting up libclang-18-dev (1:18~++20231125042245+024718313b52-1~exp1~20231125042401.1328) ...
Setting up llvm-18 (1:18~++20231125042245+024718313b52-1~exp1~20231125042401.1328) ...
[...]

But libclang is missing during cmake configure:

CMake Error at /usr/lib/llvm-18/lib/cmake/clang/ClangTargets.cmake:827 (message):
  The imported target "libclang" references the file

     "/usr/lib/llvm-18/lib/libclang-18.so.1"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib/llvm-18/lib/cmake/clang/ClangTargets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/lib/llvm-18/lib/cmake/clang/ClangConfig.cmake:20 (include)
  subdoc/CMakeLists.txt:75 (find_package)
danakj commented 10 months ago

This should get the packaging label, not finding any way/docs to do that myself

danakj commented 10 months ago

This is still a problem, so not something transient with just one package.

danakj commented 10 months ago

This problem has spread to the clang 17 packages as well. 16 is still working.

CMake Error at /usr/lib/llvm-17/lib/cmake/clang/ClangTargets.cmake:827 (message):
  The imported target "libclang" references the file

     "/usr/lib/llvm-17/lib/libclang-17.so.1"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib/llvm-17/lib/cmake/clang/ClangTargets.cmake"
emmenlau commented 10 months ago

Confirming this issue, it breaks for example building https://github.com/qt/qtbase with clang 17 (17.0.6~++20231128094036+6009708b4367-1~exp1~20231128094051.72, newest as of today) on Ubuntu.

danakj commented 10 months ago

cc: @AaronBallman Is there anyone responsible for this stuff who would want to know about it? I didn’t see anything in the latest 17 release that looks related but maybe just not in the notes.

AaronBallman commented 10 months ago

@tstellar @tru @petrhosek @MaskRay -- does this ring any bells for any of you? I'm not aware of any changes to CMake for libclang specifically.

tru commented 10 months ago

Deb packaging is handled by @sylvestre

sylvestre commented 10 months ago

yeah, it has been fixed during the week end. The builds should be ok now or soon :)

probably a side effect of the work around https://github.com/llvm/llvm-project/issues/73245

danakj commented 10 months ago

Great thank you. Looks like it’s not working yet, will update again later/tomorrow.

sylvestre commented 10 months ago

which ubuntu or debian are you running ?

danakj commented 10 months ago

ubuntu-latest in github CI which is Ubuntu 22.04

https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md

danakj commented 10 months ago

FWIW it is still broken in the 17 and 18 packages, will try again tomorrow. https://github.com/chromium/subspace/actions/runs/7080925118/job/19311684413

sylvestre commented 10 months ago

I just retriggered all builds to make sure they are fixed quickly

Disservin commented 10 months ago

Thanks, our actions seem to work again! (os: ubuntu-22.04).

sylvestre commented 10 months ago

nice, thanks for sharing :)

danakj commented 10 months ago

17 is working again for me also. 18 (nightly) is still broken in the same way.

sylvestre commented 10 months ago

yeah, it is built for amd64 & i386 but blocked on s390x machines (much slower)

danakj commented 10 months ago

I have no idea how long it's expected to take so just in case, an update that the 18 package is still affected.

sylvestre commented 10 months ago

i realized that the change didn't land in 18. sorry, i fixed it and re-triggered the builds

Disservin commented 10 months ago

i realized that the change didn't land in 18. sorry, i fixed it and re-triggered the builds

btw, where can the build status be seen?

sylvestre commented 10 months ago

https://llvm-jenkins.debian.net/view/Ubuntu%20Jammy/

danakj commented 10 months ago

Confirming the 18 package is now working, thank you!

shyney7 commented 10 months ago

I'm running debian buster and llvm version 18.0.0 is installed but I'm still getting the following error when using cmake with libLLVM dependencies:

-- CMAKE_SYSTEM_NAME: Linux
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- CMAKE_LIBRARY_ARCHITECTURE: x86_64-linux-gnu
-- Pocl source Git commit: bc33751d401cd3988dbf124be933d2b3895b98c2
-- Pocl source Git branch: * main
-- Pocl source Git describe: main-0-gbc33751d
-- Host CPU cores: 12
-- Using hwloc (cached): 1
-- Using llvm-config: /usr/bin/llvm-config
-- LLVM binaries suffix :
-- llvm-config's LLVM_PREFIX is: /usr/lib/llvm-18
-- llvm-config's LLVM_VERSION_FULL is: 18.0.0
-- LLVM_VERSION: 18.0
-- llvm-config's LLVM_CFLAGS is: -I/usr/lib/llvm-18/include  -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-- llvm-config's LLVM_CXXFLAGS is: -I/usr/lib/llvm-18/include -std=c++17   -fno-exceptions -funwind-tables -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-- llvm-config's LLVM_CPPFLAGS is: -I/usr/lib/llvm-18/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-- llvm-config's LLVM_LDFLAGS is: -L/usr/lib/llvm-18/lib
-- llvm-config's LLVM_BINDIR is: /usr/lib/llvm-18/bin
-- llvm-config's LLVM_LIBDIR is: /usr/lib/llvm-18/lib
-- llvm-config's LLVM_INCLUDEDIR is: /usr/lib/llvm-18/include
-- llvm-config's LLVM_ALL_TARGETS is: AArch64 AMDGPU ARM AVR BPF Hexagon Lanai LoongArch Mips MSP430 NVPTX PowerPC RISCV Sparc SystemZ VE WebAssembly X86 XCore M68k Xtensa
-- llvm-config's LLVM_HOST_TARGET is: x86_64-pc-linux-gnu
-- llvm-config's LLVM_BUILD_MODE is: RelWithDebInfo
-- llvm-config's LLVM_ASSERTS_BUILD is: OFF
-- llvm-config's LLVM_HAS_RTTI is: YES
llvm-config: error: libLLVM-18.so is missing
CMake Error at cmake/LLVM.cmake:87 (message):
  Error running llvm-config with arguments: --libs;--link-shared
Call Stack (most recent call first):
  cmake/LLVM.cmake:219 (run_llvm_config)
  CMakeLists.txt:525 (include)

CMake Error at cmake/LLVM.cmake:222 (message):
  llvm-config --libs did not return anything, perhaps wrong setting of
  STATIC_LLVM ?
Call Stack (most recent call first):
  CMakeLists.txt:525 (include)
sylvestre commented 10 months ago

@shyney7 sorry but why do you think it is the same issue ?

Shoegzer commented 7 months ago

I too am seeing this error attempting to build qt6 with llvm-17 on Mint/Ubuntu, using llvm-17 from the llvm.org repo at deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main.

Build process cannot find /usr/lib/llvm-17/lib/libclangBasic.a because it doesn't exist, which eventually leads to:

base/cmake/QtFeature.cmake:673 (include) qttools/src/CMakeLists.txt:18 (qt_feature_evaluate_features)

-- Configuring incomplete, errors occurred! CMake Error at /home/testing/Desktop/qt/qt6/qtbase/cmake/QtProcessConfigureArgs.cmake:1040 (message): CMake exited with code 1.

How can I update llvm-17 to avoid this? The repo does not appear to have been updated. Thanks.

Update: Nevermind, I misread which file was missing from the OP. The above just needs libclang-17-dev which for some reason was removed.