-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Compilation failure with clang 6 or 7 #350
Comments
Not related to #159 because here compiler is complaining that we are using I'll send a PR to fix this shortly. |
If we use clang to build bpftrace instead of GCC, it will complain about trying to use the `-std-c++14` flag to comile headers.c. If we force cmake to skip this flag on `.c` files, clang is not able to link libresources.a correctly. This patch changes the resources workflow to generate a .cpp file instead, and to have a `src/headers.h` with all headers we currently use. With this approach we get a safer linkage because the same definition for the header strings is being used in clang_parser.cpp and in headers.cpp. Fixes: bpftrace#350
If we use clang to build bpftrace instead of GCC, it will complain about trying to use the `-std-c++14` flag to comile headers.c. If we force cmake to skip this flag on `.c` files, clang is not able to link libresources.a correctly. This patch changes the resources workflow to generate a .cpp file instead, and to have a `src/headers.h` with all headers we currently use. With this approach we get a safer linkage because the same definition for the header strings is being used in clang_parser.cpp and in headers.cpp. Fixes: bpftrace#350
Thanks a lot @mmarchini , I verified that this fixes the build. |
If we use clang to build bpftrace instead of GCC, it will complain about trying to use the `-std-c++14` flag to comile headers.c. If we force cmake to skip this flag on `.c` files, clang is not able to link libresources.a correctly. This patch changes the resources workflow to generate a .cpp file instead, and to have a `src/headers.h` with all headers we currently use. With this approach we get a safer linkage because the same definition for the header strings is being used in clang_parser.cpp and in headers.cpp. Fixes: #350
I think this may have been regressed by 69cbd85 which introduced a
(I am building using clang-7 at the implied direction of https://github.com/iovisor/bpftrace/blob/master/INSTALL.md#building-bpftrace-1). I was able to workaround the problem by altering the root diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9e5f5c..f416bda 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -96,9 +96,6 @@ include_directories(SYSTEM ${CLANG_INCLUDE_DIRS})
add_subdirectory(src/arch)
add_subdirectory(src/ast)
add_subdirectory(src)
-if (BUILD_TESTING)
- add_subdirectory(tests)
-endif()
add_subdirectory(resources)
add_subdirectory(tools)
add_subdirectory(man) |
Interesting, thanks for reporting this @asutherland, I'll take a look. You can also work around this issue by passing |
Hi, I am attempting to build inside a debian chroot on Android.
I get the following build errors when compiling bpftrace with clang:
My cmake command looks like
BCC itself builds and works fine with the same clang. Its bpftrace failing to build.
This seems similar to: #159 . Any thoughts @brendangregg ?
The text was updated successfully, but these errors were encountered: