Closed rongqianfeng closed 5 years ago
Hi, I try the methods of @Linuxuser4 provide as follows,the bcc compilation on target board success.
A softlink to stdc++ was required since compilation complained of missing stdc++ library. ln -s /usr/lib/gcc/aarch64-linux-gnu/7/libstdc++.so /usr/lib/libstdc++.so
Two include paths needed to be provided to avoid missing header error. These were added in CMakeLists.txt in the base folder: include_directories(/usr/include/c++/7/) include_directories(/usr/include/aarch64-linux-gnu/c++/7/)
When run the command "funclatency do_sys_open" generate Issue 1: Headers are missing on the target device, but I don't know how to solve this problem.
root@localhost:/# funclatency do_sys_open
In file included from
^~~~~~~~~~~~~
1 error generated.
Traceback (most recent call last):
File "/usr/share/bcc/tools/funclatency", line 206, in
I enabled adeb on x86 android platform. The issue is resolved in: https://github.com/iotcg/adeb/tree/develop. You can check the git log to find how to set the right environment variable to resolve these issues.
Yes, I have changed the source code in bashrc.common as follow:
LIBRARY_PATH=${LIBRARY_PATH}:/usr/lib/gcc/aarch64-linux-gnu/7/ export LIBRARY_PATH=${LIBRARY_PATH}:/usr/lib/aarch64-linux-gnu/
CPATH=${CPATH}:/usr/include/c++/7 export CPATH=${CPATH}:/usr/include/aarch64-linux-gnu/c++/7
export CPATH=${CPATH}:/kernel-headers/include cat /proc/cpuinfo | grep -q aarch64 2>/dev/null rst=$? if [ $rst -eq 0 ] then CPATH=${CPATH}:/kernel-headers/arch/arm64/include/generated export CPATH=${CPATH}:/kernel-headers/arch/arm64/include/generated/uapi fi
The bcc compilation also failed, is my kernel config issue?
-- Configuring done -- Generating done -- Build files have been written to: /bcc-master/build Scanning dependencies of target bpf-static Scanning dependencies of target bpf-shared Scanning dependencies of target bcc-loader-static [ 1%] Building C object src/cc/CMakeFiles/bpf-static.dir/libbpf.c.o [ 1%] Building C object src/cc/CMakeFiles/bpf-shared.dir/libbpf.c.o [ 2%] Building CXX object src/cc/CMakeFiles/bcc-loader-static.dir/bcc_syms.cc.o In file included from /bcc-master/src/cc/libbpf.c:22: In file included from /usr/include/fcntl.h:35: In file included from /usr/include/aarch64-linux-gnu/bits/fcntl.h:61: In file included from /usr/include/aarch64-linux-gnu/bits/fcntl-linux.h:346: /kernel-headers/include/linux/falloc.h:12:2: error: unknown type name 's16' s16 l_type; In file included from /bcc-master/src/cc/libbpf.c:22: In file included from /usr/include/fcntl.h:35: In file included from /usr/include/aarch64-linux-gnu/bits/fcntl.h:61: ^In file included from /usr/include/aarch64-linux-gnu/bits/fcntl-linux.h :346: /kernel-headers/include/linux/falloc.h:12:2: error: unknown type name 's16' s16 l_type; ^ /kernel-headers/include/linux/falloc.h/kernel-headers/include/linux/falloc.h:13:2: :error: unknown type name 's16' s16 l_whence;13:2: error: unknown type name 's16' s16 l_whence; ... fatal error: too many errors emitted, stopping now [-ferror-limit=] 13 warnings and 20 errors generated. make[2]: [src/cc/CMakeFiles/bpf-shared.dir/build.make:63: src/cc/CMakeFiles/bpf-shared.dir/libbpf.c.o] Error 1 make[1]: [CMakeFiles/Makefile2:158: src/cc/CMakeFiles/bpf-shared.dir/all] Error 2 make: *** [Makefile:141: all] Error 2
It's kernel head file issues. Two suspect points:
BTW, you can refer to below file to generate kernel-headers: https://github.com/iotcg/adeb/blob/develop/kernel-headers.sh As you know, we often build kernel out of kernel source directory, e.g. build_kernel. You can put kernel-header.sh under build_kernel and run the script, it will generate kernel-headers directory which includes all the required kernel head files.
Give us a day. We fixed the compilation issue. Pushing it
On Wed, Aug 15, 2018, 3:53 AM Changcheng notifications@github.com wrote:
It's kernel head file issues. Two suspect points:
- Some kernel head files are not copied into kernel-headers.
- Need more specific CPATH to include the directory to tell gcc/clang to find the header file.
BTW, you can refer to below file to generate kernel-headers: https://github.com/iotcg/adeb/blob/develop/kernel-headers.sh As you know, we often build kernel out of kernel source directory, e.g. build_kernel. You can put kernel-header.sh under build_kernel and run the script, it will generate kernel-headers directory which includes all the required kernel head files.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/joelagnel/adeb/issues/12#issuecomment-413162958, or mute the thread https://github.com/notifications/unsubscribe-auth/AACSVJsvWzVkNzCC2VztV7axlH_sCtULks5uQ_2bgaJpZM4V53VO .
@joelagnel Glad to see your fix, waiting for PR. I also want to know how to resolve "library link issue" & "include head file issue" besides my method.
Actually, the issue I was talking about is different. Your compilation could be failing because of incorrect 'kernel-headers' as you pointed:
/kernel-headers/include/linux/falloc.h:12:2: error: unknown type name '__s16'
Erick is working on removing dependency on kernel headers. His prototype is already working but it has to be merged. It will be merged either today or tomorrow. After that the following command should work: “adeb prepare --build --bcc`
We will update you today or tomorrow. Thanks for the patience and for your help in making Androdeb better.
CC @ErickReyesR
@iotcg thanks for sharing your header build script. Could you send me a pull-request to add out-of-tree kernel header build support to --kernelsrc
option? I think we will also need additional options maybe: --kernelsrc
and --kernelout
?
Also as I was saying, we will also provide "backup" kernel headers incase --kernelsrc
option is skipped which @ErickReyesR is working on.
@joelagnel Per your request, PR: https://github.com/joelagnel/adeb/pull/13 This PR has been verified on local host and target device. It supports extract kernel headers when building kernel out-of-tree.
At the moment, I feel out-of-tree header building will complicate the flow too much. Also we have eliminated the need for kernel version as long as you are running a recent LTS kernel (headers will be automatically downloaded). For that reason, I am closing this. Thanks
Hi, I am trying to get adeb-BCC working on a Hikey970 android platform. By default, use the command “adeb prepare --build --bcc --kernelsrc usr/src/linux-4.9.119” to compile bcc is failed.
The error information are as follows: bash: cannot set terminal process group (16629): Inappropriate ioctl for device bash: no job control in this shell -- The C compiler identification is Clang 6.0.1 -- The CXX compiler identification is Clang 6.0.1 -- Check for working C compiler: /usr/bin/clang-6.0 -- Check for working C compiler: /usr/bin/clang-6.0 -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/clang++-6.0 -- Check for working CXX compiler: /usr/bin/clang++-6.0 -- broken CMake Error at /usr/share/cmake-3.11/Modules/CMakeTestCXXCompiler.cmake:45 (message): The C++ compiler
is not able to compile a simple test program.
It fails with the following output: