Skip to content
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

Package bpftrace does not compile with alpine 3.9 #3296

Open
rn opened this issue Mar 3, 2019 · 3 comments
Open

Package bpftrace does not compile with alpine 3.9 #3296

rn opened this issue Mar 3, 2019 · 3 comments

Comments

@rn
Copy link
Member

rn commented Mar 3, 2019

I tried updating pkg/bpftrace to alpine 3.9 and got a compilation error:

    Scanning dependencies of target bpf-static
    [  9%] Building C object src/cc/CMakeFiles/bpf-static.dir/libbpf.c.o
    In file included from /usr/include/linux/byteorder/little_endian.h:13,
                     from /usr/include/asm/byteorder.h:5,
                     from /usr/include/linux/perf_event.h:20,
                     from /bpftrace/build/bcc-prefix/src/bcc/src/cc/libbpf.c:28:
    /usr/include/linux/swab.h:161:8: error: unknown type name '__always_inline'
     static __always_inline __u16 __swab16p(const __u16 *p)
            ^~~~~~~~~~~~~~~
    /usr/include/linux/swab.h:161:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__swab16p'
     static __always_inline __u16 __swab16p(const __u16 *p)
                                  ^~~~~~~~~
[...]

When I used a newer bpftrace commit, I got another error (after also adding bash):

-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Please install the bcc library package, which is required.  Depending on
  your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel
  (Fedora), or something else.  If unavailable, install bcc from source
  (github.com/iovisor/bcc).  (missing: LIBBCC_LIBRARIES LIBBCC_INCLUDE_DIRS)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindLibBcc.cmake:67 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:35 (find_package)


-- Configuring incomplete, errors occurred!
See also "/bpftrace/build/CMakeFiles/CMakeOutput.log".

@simar7 could you take a look?

@rn
Copy link
Member Author

rn commented Mar 3, 2019

weirdly, even the original build now fails with:

[ 30%] Building CXX object src/ast/CMakeFiles/ast.dir/codegen_llvm.cpp.o
[ 30%] Building CXX object src/ast/CMakeFiles/ast.dir/irbuilderbpf.cpp.o
[ 31%] Building CXX object src/ast/CMakeFiles/ast.dir/printer.cpp.o
[ 31%] Building CXX object src/ast/CMakeFiles/ast.dir/semantic_analyser.cpp.o
/bpftrace/src/ast/irbuilderbpf.cpp: In member function 'llvm::CallInst* bpftrace::ast::IRBuilderBPF::CreateProbeReadStr(llvm::AllocaInst*, size_t, llvm::Value*)':
/bpftrace/src/ast/irbuilderbpf.cpp:279:16: error: 'BPF_FUNC_probe_read_str' was not declared in this scope
       getInt64(BPF_FUNC_probe_read_str),
                ^~~~~~~~~~~~~~~~~~~~~~~
/bpftrace/src/ast/irbuilderbpf.cpp: In member function 'llvm::CallInst* bpftrace::ast::IRBuilderBPF::CreateProbeReadStr(llvm::Value*, size_t, llvm::Value*)':
/bpftrace/src/ast/irbuilderbpf.cpp:294:16: error: 'BPF_FUNC_probe_read_str' was not declared in this scope
       getInt64(BPF_FUNC_probe_read_str),
                ^~~~~~~~~~~~~~~~~~~~~~~
/bpftrace/src/ast/irbuilderbpf.cpp: In member function 'llvm::CallInst* bpftrace::ast::IRBuilderBPF::CreateGetCurrentCgroupId()':
/bpftrace/src/ast/irbuilderbpf.cpp:422:16: error: 'BPF_FUNC_get_current_cgroup_id' was not declared in this scope
       getInt64(BPF_FUNC_get_current_cgroup_id),
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/bpftrace/src/ast/irbuilderbpf.cpp: In member function 'llvm::CallInst* bpftrace::ast::IRBuilderBPF::CreateGetCurrentTask()':
/bpftrace/src/ast/irbuilderbpf.cpp:461:16: error: 'BPF_FUNC_get_current_task' was not declared in this scope
       getInt64(BPF_FUNC_get_current_task),
                ^~~~~~~~~~~~~~~~~~~~~~~~~
/bpftrace/src/ast/irbuilderbpf.cpp: In member function 'llvm::CallInst* bpftrace::ast::IRBuilderBPF::CreateGetStackId(llvm::Value*, bool)':
/bpftrace/src/ast/irbuilderbpf.cpp:497:16: error: 'BPF_FUNC_get_stackid' was not declared in this scope
       getInt64(BPF_FUNC_get_stackid),
                ^~~~~~~~~~~~~~~~~~~~
/bpftrace/src/ast/semantic_analyser.cpp: In member function 'int bpftrace::ast::SemanticAnalyser::create_maps(bool)':
/bpftrace/src/ast/semantic_analyser.cpp:871:68: error: 'BPF_MAP_TYPE_STACK_TRACE' was not declared in this scope
       bpftrace_.stackid_map_ = std::make_unique<bpftrace::FakeMap>(BPF_MAP_TYPE_STACK_TRACE);
                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~
/bpftrace/src/ast/semantic_analyser.cpp:885:64: error: 'BPF_MAP_TYPE_STACK_TRACE' was not declared in this scope
       bpftrace_.stackid_map_ = std::make_unique<bpftrace::Map>(BPF_MAP_TYPE_STACK_TRACE);
                                                                ^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [src/ast/CMakeFiles/ast.dir/build.make:89: src/ast/CMakeFiles/ast.dir/irbuilderbpf.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [src/ast/CMakeFiles/ast.dir/build.make:115: src/ast/CMakeFiles/ast.dir/semantic_analyser.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:276: src/ast/CMakeFiles/ast.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

I'm pretty sure this used the work, hmm.

I'll disable the package for now

rn added a commit to rn/linuxkit that referenced this issue Mar 3, 2019
The package does not build at the moment:
linuxkit#3296

Signed-off-by: Rolf Neugebauer <[email protected]>
rn added a commit to rn/linuxkit that referenced this issue Mar 10, 2019
The package does not build at the moment:
linuxkit#3296

Signed-off-by: Rolf Neugebauer <[email protected]>
@rn rn mentioned this issue Mar 24, 2019
@kmjohansen
Copy link
Contributor

kmjohansen commented Nov 14, 2019

Note that PR #3439 has a fix that is related to this, but that may not address the problem completely. In particular, the Dockerfile for bpftrace needs to include headers that have the swab.h fix in place, which either means manually patching the headers from the Dockerfile, or importing them from the kernel build from linuxkit.

@hexmarkrecords
Copy link

If you use alpine 3.8 it compiles. Not the best solution but hey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants