-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix Ubuntu llvm/clang packages #76
Comments
This appears to be an upstream bug from debian packaging. |
BCC also depends on Clang parts, but it manages to avoid this problem somehow. |
Related to #266, it would be great to also run a static build from ubuntu as it would link libc instead of musl, which seems to be the cause of crashes for the bpftrace static binary. |
The Debian bug has been fixed. I am able to compile bpftrace on Debian Sid using llvm 7. |
I managed to package bpftool with the following patch on llvm-6.0: diff -rup ./ClangConfig.cmake /usr/share/llvm-6.0/cmake/ClangConfig.cmake
--- ./ClangConfig.cmake 2019-01-09 00:29:01.334985035 +0000
+++ /usr/share/llvm-6.0/cmake/ClangConfig.cmake 2019-01-09 00:29:39.700589050 +0000
@@ -15,7 +15,7 @@ set(CLANG_CMAKE_DIR "${CLANG_INSTALL_PRE
set(CLANG_INCLUDE_DIRS "${CLANG_INSTALL_PREFIX}/include")
# Provide all our library targets to users.
-include("${CLANG_CMAKE_DIR}/ClangTargets.cmake")
+include("/usr/share/llvm-6.0/cmake/ClangTargets.cmake")
# By creating clang-tablegen-targets here, subprojects that depend on Clang's
# tablegen-generated headers can always depend on this target whether building
diff -rup ./ClangTargets-relwithdebinfo.cmake /usr/share/llvm-6.0/cmake/ClangTargets-relwithdebinfo.cmake
--- ./ClangTargets-relwithdebinfo.cmake 2019-01-09 00:41:49.440472014 +0000
+++ /usr/share/llvm-6.0/cmake/ClangTargets-relwithdebinfo.cmake 2019-01-09 00:42:19.617219014 +0000
@@ -278,11 +278,11 @@ list(APPEND _IMPORT_CHECK_FILES_FOR_clan
# Import target "clang" for configuration "RelWithDebInfo"
set_property(TARGET clang APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
set_target_properties(clang PROPERTIES
- IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/bin/clang-6.0"
+ IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/bin/clang"
)
list(APPEND _IMPORT_CHECK_TARGETS clang )
-list(APPEND _IMPORT_CHECK_FILES_FOR_clang "${_IMPORT_PREFIX}/bin/clang-6.0" )
+list(APPEND _IMPORT_CHECK_FILES_FOR_clang "${_IMPORT_PREFIX}/bin/clang" )
# Import target "clang-format" for configuration "RelWithDebInfo"
set_property(TARGET clang-format APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
diff -rup ./ClangTargets.cmake /usr/share/llvm-6.0/cmake/ClangTargets.cmake
--- ./ClangTargets.cmake 2019-01-09 00:35:48.562625012 +0000
+++ /usr/share/llvm-6.0/cmake/ClangTargets.cmake 2019-01-09 00:37:07.801493046 +0000
@@ -59,6 +59,8 @@ if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
+set(_IMPORT_PREFIX "/usr/lib/llvm-6.0")
+
# Create imported target clangBasic
add_library(clangBasic STATIC IMPORTED)
Assuming ephemeral build environment, this can be applied with:
Build requirements from llvm/clang side:
Build steps then:
Resulting binary also depends on
Still seems like the proper way would be to reuse what BCC does as it seems to work out of the box and without runtime dependencies. Maybe #327 will help with the latter, I'm not sure. |
I'm still struggling to build a static binary version on Debian Stretch. I end up with the following while linking
|
Building a static binary is an issue today because only Apline provides the static libclang file ( If we could somehow only rely on partial libclang libraries ( |
I patched llvm build to ship with |
What glibc version do you have installed? Best guess at this error is clang is trying to use a versioned symbol your glibc doesn't have. |
On second thought, you probably compiled clang on your machine. A revised guess is you're using two different toolchains on different parts of the build. You need to stick with one. |
What's the path forward? Is this correct?:
|
I just tried standard Ubuntu bionic, and it doesn't have llvm 7 packages yet. So I tried the Ubuntu llvm 6.0 packages, and hit the same error:
so it's not fixed there yet. I tried @bobrik 's patch, but got:
... If this is fixed in Debian Sid, is the real path forward to get the Ubuntu package mantainers to update their llvm's? If I were to email the right people at Canonical, what should I be asking for? :-) |
llvm-7 is available in bionic-proposed. It seems it is scheduled for Bionic 18.04.2: https://bugs.launchpad.net/ubuntu/+source/libdrm/+bug/1798597. It should be available to regular users early February. |
@brendangregg - I was wondering if you found a way past this installation error? |
I'm currently using the instructions from INSTALL.md for Ubuntu: getting llvm/clang from the llvm.org repositories. |
I also run into this error (even when using llvm/clang from the llvm.org repos), include could not find load file:
/usr/lib/cmake/clang/ClangTargets.cmake
Call Stack (most recent call first):
CMakeLists.txt:58 (find_package)
-- Configuring incomplete, errors occurred!``` |
No, I don't think I've seen that before. Hmm. I hope there isn't a new package error you are the first to encounter (those llvm.org repose get updated nightly I believe). |
@bobrik would you mind sharing what you've done in #266 as it looks like you got further than I did towards building a static bpftrace on ubuntu, and I think that a static build based on ubuntu (using static libclang) is probably the best way to solve this problem, as it will link glibc instead of musl. |
@brendangregg I am getting same error on centos 7.6. Is it possible to get past them? |
Can confirm that it builds with the new packages. Still need to compile bcc from source however as
|
As per #596, this seems to be fixed, so I'll close it. If there's still something to be done here feel free to reopen it. |
I was able to build bpfrtrace with llvm-8 and libbcc 0.10 on Debian Stretch, thanks all 🎉 |
I am still unable to build it:
|
@thrashdin Can you file a new issue? And include other info like distro version, installed packages, etc. |
@commander-trashdin : Did you ever resolve this ? I've this very issue with another project (doxygen), and it was due to only some of the clang-related packages being installed. when I |
Yes, I did @eyalroz but I completely forgot how. I am however reasonably sure my solution was very unremarkable and the problem almost somehow resolved itself, i.e. it was some stupid problem. |
This ticket is to (somehow) get the ubuntu/debian llvm/clang packages updated.
INSTALL.md has instructions for adding apt.llvm.org as a repository. If you don't do that, and use the default Ubuntu ones, you get this:
Someone should fix that so the default repository works. At least we have the apt.llvm.org workaround.
The text was updated successfully, but these errors were encountered: