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

build error for android #50

Closed
idersan opened this issue Nov 16, 2021 · 20 comments
Closed

build error for android #50

idersan opened this issue Nov 16, 2021 · 20 comments

Comments

@idersan
Copy link

idersan commented Nov 16, 2021

$ xmake f -p android -a arm64-v8a
$ xmake 

[ 11%]: compiling.bpf fentry.bpf.c
[ 11%]: ccache compiling.release ../../libbpf/src/bpf_prog_linfo.c
[ 11%]: ccache compiling.release ../../libbpf/src/netlink.c
[ 11%]: ccache compiling.release ../../libbpf/src/bpf.c
[ 11%]: ccache compiling.release ../../libbpf/src/hashmap.c
[ 11%]: ccache compiling.release ../../libbpf/src/ringbuf.c
[ 11%]: ccache compiling.release ../../libbpf/src/btf_dump.c
[ 11%]: ccache compiling.release ../../libbpf/src/str_error.c
[ 11%]: ccache compiling.release ../../libbpf/src/libbpf_probes.c
[ 11%]: compiling.bpf minimal.bpf.c
[ 11%]: ccache compiling.release ../../libbpf/src/linker.c
[ 11%]: ccache compiling.release ../../libbpf/src/btf.c
[ 11%]: ccache compiling.release ../../libbpf/src/libbpf.c
[ 11%]: ccache compiling.release ../../libbpf/src/nlattr.c
[ 11%]: compiling.bpf uprobe.bpf.c
[ 11%]: ccache compiling.release ../../libbpf/src/xsk.c
[ 11%]: compiling.bpf bootstrap.bpf.c
[ 11%]: ccache compiling.release ../../libbpf/src/strset.c
[ 13%]: ccache compiling.release ../../libbpf/src/libbpf_errno.c
libbpf: elf: skipping unrecognized data section(6) .rodata.str1.1
libbpf: elf: skipping unrecognized data section(7) .rodata.str1.1
[ 18%]: ccache compiling.release ../../libbpf/src/gen_loader.c
libbpf: elf: skipping unrecognized data section(6) .rodata.str1.1
[ 58%]: archiving.release libbpf.a
[ 60%]: ccache compiling.release fentry.c
[ 60%]: ccache compiling.release fentry.bpf.c
[ 60%]: ccache compiling.release bootstrap.bpf.c
[ 60%]: ccache compiling.release bootstrap.c
[ 60%]: ccache compiling.release minimal.bpf.c
[ 60%]: ccache compiling.release minimal.c
[ 60%]: ccache compiling.release uprobe.bpf.c
[ 60%]: ccache compiling.release uprobe.c
error: bootstrap.bpf.c:53:12: error: using builtin_preserve_access_index() without -g
        e->ppid = BPF_CORE_READ(task, real_parent, tgid);
                  ^
build/bpf/bpf_core_read.h:404:2: note: expanded from macro 'BPF_CORE_READ'
        BPF_CORE_READ_INTO(&__r, (src), a, ##__VA_ARGS__);                  \
        ^
build/bpf/bpf_core_read.h:311:30: note: expanded from macro 'BPF_CORE_READ_INTO'
        ___core_read(bpf_core_read, bpf_core_read,                          \
                                    ^
bootstrap.bpf.c:53:12: error: using builtin_preserve_access_index() without -g
build/bpf/bpf_core_read.h:404:2: note: expanded from macro 'BPF_CORE_READ'
        BPF_CORE_READ_INTO(&__r, (src), a, ##__VA_ARGS__);                  \
        ^
build/bpf/bpf_core_read.h:311:15: note: expanded from macro 'BPF_CORE_READ_INTO'
        ___core_read(bpf_core_read, bpf_core_read,                          \
                     ^
11692 warnings and 2 errors generated.
@idersan
Copy link
Author

idersan commented Nov 16, 2021

$ clang -v
Ubuntu clang version 11.1.0-++20211011094159+1fdec59bffc1-1~exp1~20211011214614.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Candidate multilib: .;@m64
Selected multilib: .;@m64

@anakryiko
Copy link
Member

@waruqi can you please help with this? All the .bpf.c files have to be compiled with -g argument passed to Clang. I'm not familiar with xmake and have no idea how to fix it.

@waruqi
Copy link
Contributor

waruqi commented Nov 16, 2021

try this patch https://github.com/libbpf/libbpf-bootstrap/pull/51/files first? I will improve platform.linux.bpf rule to add -g to all .bpf.c files in xmake/dev in the future if it works

@idersan
Copy link
Author

idersan commented Nov 16, 2021

try this patch https://github.com/libbpf/libbpf-bootstrap/pull/51/files first? I will improve platform.linux.bpf rule to add -g to all .bpf.c files in xmake/dev in the future if it works

i did, but have a another error:

libbpf: elf: skipping unrecognized data section(6) .rodata.str1.1
[ 58%]: archiving.release libbpf.a
[ 60%]: ccache compiling.release bootstrap.bpf.c
[ 60%]: ccache compiling.release bootstrap.c
[ 60%]: ccache compiling.release minimal.bpf.c
[ 60%]: ccache compiling.release minimal.c
[ 60%]: ccache compiling.release uprobe.bpf.c
[ 60%]: ccache compiling.release uprobe.c
[ 62%]: ccache compiling.release fentry.c
[ 62%]: ccache compiling.release fentry.bpf.c
error: fatal error: error in backend: Cannot select: intrinsic %llvm.preserve.struct.access.index
PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --sysroot=/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Qunused-arguments -target aarch64-none-linux-android23 -gcc-toolchain /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -fPIE -pie -g -Oz -fdiagnostics-color=always -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android -I../../vmlinux -Ibuild/.gens/bootstrap/android/arm64-v8a/release/rules/bpf -I../../libbpf/include/uapi -Ibuild -isystem /home/idersan/.xmake/packages/a/argp-standalone/1.3/b1a9bb16169d4210a694c1b4ece2d270/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++abi/include -DNDEBUG -c -o build/.objs/bootstrap/android/arm64-v8a/release/bootstrap.bpf.c.o bootstrap.bpf.c 
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'bootstrap.bpf.c'.
4.	Running pass 'AArch64 Instruction Selection' on function '@handle_exec'
 #0 0x0000000003456ac5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x3456ac5)
 #1 0x0000000003456960 llvm::sys::RunSignalHandlers() (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x3456960)
 #2 0x0000000003425250 (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x3425250)
 #3 0x000000000342520b (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x342520b)
 #4 0x0000000002ec4cfe (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2ec4cfe)
 #5 0x0000000002ec4c67 (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2ec4c67)
 #6 0x0000000002ecc81f llvm::report_fatal_error(llvm::Twine const&, bool) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2ecc81f)
 #7 0x0000000002f439a8 (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2f439a8)
 #8 0x00000000020d5746 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x20d5746)

@waruqi
Copy link
Contributor

waruqi commented Nov 16, 2021

Can you run xmake -vD and let me see the verbose command output?

@waruqi
Copy link
Contributor

waruqi commented Nov 16, 2021

error: fatal error: error in backend: Cannot select: intrinsic %llvm.preserve.struct.access.index

This seems to be a problem with the clang compiler in ndk. But I don't know whether it will affect the normal operation of the bpf program.

vmlinux/vmlinux_508.h

#ifndef BPF_NO_PRESERVE_ACCESS_INDEX
#pragma clang attribute push (attribute((preserve_access_index)), apply_to = record)
#endif

You can try add add_defines("BPF_NO_PRESERVE_ACCESS_INDEX") to disable it in xmake.lua

@anakryiko
Copy link
Member

*.bpf.c files have to be compiled with -target bpf, not for native architecture. See https://github.com/libbpf/libbpf-bootstrap/blob/master/examples/c/Makefile#L64 for full invocation we use in Makefile. So you'd need to have two different rules for user-space code and BPF programs code.

@waruqi
Copy link
Contributor

waruqi commented Nov 16, 2021

*.bpf.c files have to be compiled with -target bpf, not for native architecture. See https://github.com/libbpf/libbpf-bootstrap/blob/master/examples/c/Makefile#L64 for full invocation we use in Makefile. So you'd need to have two different rules for user-space code and BPF programs code.

https://github.com/xmake-io/xmake/blob/b7cb5bb0c219bf4c8cdb7fffc40388c13de5e213/xmake/rules/platform/linux/bpf/xmake.lua#L51

I should have added -target bpf and -g, and the patch does not need to be merged.

And it works for me. I don't know why it doesn't work here, I need more detailed compilation information to further analyze the reason.

@idersan Can you revert the patch and run the following command

xmake f -p android -cvD
xmake -rvD

and let me see the verbose output.

@idersan
Copy link
Author

idersan commented Nov 17, 2021

$ xmake f -p android -cvD -a arm64-v8a
checking for Android SDK directory ... /home/idersan/Android/Sdk
checking for Build Tools Version of Android SDK ... 31.0.0
checking for NDK directory ... /home/idersan/Android/Sdk/ndk/22.0.7026061
checking for SDK version of NDK ... 21
checking for unzip ... /usr/bin/unzip
checking for git ... /usr/bin/git
checking for gzip ... /bin/gzip
checking for tar ... /bin/tar
/usr/bin/git rev-parse HEAD
checking for ndk ... no
finding libelf from xmake ..
checking for clang++ ... /home/idersan/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
checking for the shared library linker (sh) ... clang++
checking for clang++ ... /home/idersan/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
checking for the linker (ld) ... clang++
checking for xmake::libelf ... libelf 0.8.13
finding zlib from xmake ..
checking for xmake::zlib ... zlib 1.2.11
finding argp-standalone from xmake ..
checking for xmake::argp-standalone ... argp-standalone 1.3
generating ../../libbpf/src/skel_internal.h to build/bpf/skel_internal.h ..
generating ../../libbpf/src/skel_internal.h ... cache
generating ../../libbpf/src/libbpf.h to build/bpf/libbpf.h ..
generating ../../libbpf/src/libbpf.h ... cache
generating ../../libbpf/src/nlattr.h to build/bpf/nlattr.h ..
generating ../../libbpf/src/nlattr.h ... cache
generating ../../libbpf/src/libbpf_legacy.h to build/bpf/libbpf_legacy.h ..
generating ../../libbpf/src/libbpf_legacy.h ... cache
generating ../../libbpf/src/str_error.h to build/bpf/str_error.h ..
generating ../../libbpf/src/str_error.h ... cache
generating ../../libbpf/src/libbpf_common.h to build/bpf/libbpf_common.h ..
generating ../../libbpf/src/libbpf_common.h ... cache
generating ../../libbpf/src/bpf_helper_defs.h to build/bpf/bpf_helper_defs.h ..
generating ../../libbpf/src/bpf_helper_defs.h ... cache
generating ../../libbpf/src/bpf_helpers.h to build/bpf/bpf_helpers.h ..
generating ../../libbpf/src/bpf_helpers.h ... cache
generating ../../libbpf/src/xsk.h to build/bpf/xsk.h ..
generating ../../libbpf/src/xsk.h ... cache
generating ../../libbpf/src/hashmap.h to build/bpf/hashmap.h ..
generating ../../libbpf/src/hashmap.h ... cache
generating ../../libbpf/src/bpf_core_read.h to build/bpf/bpf_core_read.h ..
generating ../../libbpf/src/bpf_core_read.h ... cache
generating ../../libbpf/src/bpf.h to build/bpf/bpf.h ..
generating ../../libbpf/src/bpf.h ... cache
generating ../../libbpf/src/libbpf_internal.h to build/bpf/libbpf_internal.h ..
generating ../../libbpf/src/libbpf_internal.h ... cache
generating ../../libbpf/src/bpf_gen_internal.h to build/bpf/bpf_gen_internal.h ..
generating ../../libbpf/src/bpf_gen_internal.h ... cache
generating ../../libbpf/src/bpf_endian.h to build/bpf/bpf_endian.h ..
generating ../../libbpf/src/bpf_endian.h ... cache
generating ../../libbpf/src/bpf_tracing.h to build/bpf/bpf_tracing.h ..
generating ../../libbpf/src/bpf_tracing.h ... cache
generating ../../libbpf/src/strset.h to build/bpf/strset.h ..
generating ../../libbpf/src/strset.h ... cache
generating ../../libbpf/src/btf.h to build/bpf/btf.h ..
generating ../../libbpf/src/btf.h ... cache
checking for Android SDK directory ... /home/idersan/Android/Sdk
checking for Build Tools Version of Android SDK ... 31.0.0
checking for NDK directory ... /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90
checking for SDK version of NDK ... 23
checking for clang++ ... /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
checking for the shared library linker (sh) ... clang++
checking for clang++ ... /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
checking for the linker (ld) ... clang++
checking for /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar ... ok
checking for the static library archiver (ar) ... aarch64-linux-android-ar
configure
{
    system-libbpf = false
    host = linux
    require-bpftool = false
    ccache = true
    kind = static
    arch = arm64-v8a
    clean = true
    buildir = build
    ndk_toolchains_ver = 4.9
    ndk = /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90
    ndk_sdkver = 23
    plat = android
    android_sdk = /home/idersan/Android/Sdk
    mode = release
    ndk_stdcxx = true
    build_toolver = 31.0.0
    ndkver = 22
}

@idersan
Copy link
Author

idersan commented Nov 17, 2021

$ xmake -rvD
...
../../vmlinux/vmlinux.h:5:46: warning: unknown attribute 'preserve_access_index' ignored [-Wunknown-attributes]
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
                                             ^
../../vmlinux/vmlinux.h:128516:1: note: when applied to this declaration
struct pci_setup_rom {
^
../../vmlinux/vmlinux.h:5:46: warning: unknown attribute 'preserve_access_index' ignored [-Wunknown-attributes]
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
                                             ^
../../vmlinux/vmlinux.h:128535:1: note: when applied to this declaration
struct pci_root_res {
^
../../vmlinux/vmlinux.h:5:46: warning: unknown attribute 'preserve_access_index' ignored [-Wunknown-attributes]
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
                                             ^
../../vmlinux/vmlinux.h:128540:1: note: when applied to this declaration
struct pci_root_info___2 {
^
../../vmlinux/vmlinux.h:5:46: warning: unknown attribute 'preserve_access_index' ignored [-Wunknown-attributes]
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
                                             ^
../../vmlinux/vmlinux.h:128549:1: note: when applied to this declaration
struct amd_hostbridge {
^
../../vmlinux/vmlinux.h:5:46: warning: unknown attribute 'preserve_access_index' ignored [-Wunknown-attributes]
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
                                             ^
../../vmlinux/vmlinux.h:128555:1: note: when applied to this declaration
struct saved_msr {
^
../../vmlinux/vmlinux.h:5:46: warning: unknown attribute 'preserve_access_index' ignored [-Wunknown-attributes]
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
                                             ^
../../vmlinux/vmlinux.h:128560:1: note: when applied to this declaration
struct saved_msrs {
^
../../vmlinux/vmlinux.h:5:46: warning: unknown attribute 'preserve_access_index' ignored [-Wunknown-attributes]
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
                                             ^
../../vmlinux/vmlinux.h:128565:1: note: when applied to this declaration
struct saved_context {
^
../../vmlinux/vmlinux.h:5:46: warning: unknown attribute 'preserve_access_index' ignored [-Wunknown-attributes]
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
                                             ^
../../vmlinux/vmlinux.h:128595:1: note: when applied to this declaration
struct restore_data_record {
^
fatal error: error in backend: Cannot select: intrinsic %llvm.preserve.struct.access.index
PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --sysroot=/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Qunused-arguments -target aarch64-none-linux-android23 -gcc-toolchain /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -fPIE -pie -g -Oz -fdiagnostics-color=always -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android -I../../vmlinux -Ibuild/.gens/bootstrap/android/arm64-v8a/release/rules/bpf -I../../libbpf/include/uapi -Ibuild -isystem /home/idersan/.xmake/packages/a/argp-standalone/1.3/b1a9bb16169d4210a694c1b4ece2d270/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++abi/include -DNDEBUG -c -o build/.objs/bootstrap/android/arm64-v8a/release/bootstrap.bpf.c.o bootstrap.bpf.c 
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'bootstrap.bpf.c'.
4.	Running pass 'AArch64 Instruction Selection' on function '@handle_exec'
 #0 0x0000000003456ac5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x3456ac5)
 #1 0x0000000003456960 llvm::sys::RunSignalHandlers() (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x3456960)
 #2 0x0000000003425250 (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x3425250)
 #3 0x000000000342520b (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x342520b)
 #4 0x0000000002ec4cfe (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2ec4cfe)
 #5 0x0000000002ec4c67 (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2ec4c67)
 #6 0x0000000002ecc81f llvm::report_fatal_error(llvm::Twine const&, bool) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2ecc81f)
 #7 0x0000000002f439a8 (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2f439a8)
 #8 0x00000000020d5746 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x20d5746)
 #9 0x00000000020cc1e7 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x20cc1e7)
#10 0x00000000020c6371 (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x20c6371)
#11 0x00000000025bdd53 llvm::SelectionDAGISel::DoInstructionSelection() (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x25bdd53)
#12 0x00000000025ba935 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x25ba935)
#13 0x00000000025adb30 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x25adb30)
#14 0x00000000025abbae llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x25abbae)
#15 0x000000000241473b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x241473b)
#16 0x00000000020ace1a llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x20ace1a)
#17 0x00000000020acc4f llvm::FPPassManager::runOnModule(llvm::Module&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x20acc4f)
#18 0x00000000024a404e (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x24a404e)
#19 0x00000000024a099a llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x24a099a)
#20 0x00000000024b264a (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x24b264a)
#21 0x000000000249b400 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream> >) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x249b400)
#22 0x000000000249aa3d (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x249aa3d)
#23 0x00000000022edb39 clang::ParseAST(clang::Sema&, bool, bool) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x22edb39)
#24 0x000000000291805d clang::FrontendAction::Execute() (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x291805d)
#25 0x00000000029176f1 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x29176f1)
#26 0x000000000290e0de clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x290e0de)
#27 0x000000000290b581 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x290b581)
#28 0x0000000002c8f695 (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2c8f695)
#29 0x0000000004774642 clang::driver::CC1Command::setEnvironment(llvm::ArrayRef<char const*>) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x4774642)
#30 0x0000000002d30b3e llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2d30b3e)
#31 0x0000000002d30a78 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2d30a78)
#32 0x000000000257a576 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x257a576)
#33 0x0000000002579670 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2579670)
#34 0x0000000002579440 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2579440)
#35 0x0000000002573a1a main (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2573a1a)
#36 0x00007f0a816d7bf7 __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#37 0x00000000046f7641 _start (/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x46f7641)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Android (6875598, based on r399163b) clang version 11.0.5 (https://android.googlesource.com/toolchain/llvm-project 87f1315dfbea7c137aa2e6d362dbb457e388158d)
Target: aarch64-none-linux-android23
Thread model: posix
InstalledDir: /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin
clang: note: diagnostic msg: 
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/bootstrap-fbb6a4.c
clang: note: diagnostic msg: /tmp/bootstrap-fbb6a4.sh
clang: note: diagnostic msg: 
********************
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:829]: in function 'raise'
    [@programdir/modules/core/tools/gcc.lua:493]: in function 'catch'
    [@programdir/core/sandbox/modules/try.lua:127]: in function 'try'
    [@programdir/modules/core/tools/gcc.lua:442]:
    [C]: in function 'compile'
    [@programdir/modules/private/action/build/object.lua:78]: in function 'script'
    [@programdir/modules/private/action/build/object.lua:91]: in function 'build_object'
    [@programdir/modules/private/action/build/object.lua:116]: in function 'jobfunc'
    [@programdir/modules/private/async/runjobs.lua:208]:
    [C]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:121]: in function 'try'
    [@programdir/modules/private/async/runjobs.lua:201]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:371]:

stack traceback:
	[C]: in function 'error'
	@programdir/core/base/os.lua:829: in function 'raise'
	@programdir/modules/private/async/runjobs.lua:232: in function 'catch'
	@programdir/core/sandbox/modules/try.lua:127: in function 'try'
	@programdir/modules/private/async/runjobs.lua:201: in function 'cotask'
	@programdir/core/base/scheduler.lua:371: in function <@programdir/core/base/scheduler.lua:368>

@idersan
Copy link
Author

idersan commented Nov 17, 2021

i deleted local source code, do git clone this project again. output something else errors.

$ xmake f -p android -cvD -a arm64-v8a
checking for Android SDK directory ... /home/idersan/Android/Sdk
checking for Build Tools Version of Android SDK ... 31.0.0
checking for NDK directory ... /home/idersan/Android/Sdk/ndk/22.0.7026061
checking for SDK version of NDK ... 21
checking for unzip ... /usr/bin/unzip
checking for git ... /usr/bin/git
checking for gzip ... /bin/gzip
checking for tar ... /bin/tar
checking for ping ... /bin/ping
pinging for the host(gitee.com) ... 25 ms
pinging for the host(github.com) ... 65535 ms
pinging for the host(gitlab.com) ... 278 ms
/usr/bin/git rev-parse HEAD
checking for ndk ... no
finding libelf from xmake ..
checking for clang++ ... /home/idersan/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
checking for the shared library linker (sh) ... clang++
checking for clang++ ... /home/idersan/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
checking for the linker (ld) ... clang++
checking for xmake::libelf ... libelf 0.8.13
finding zlib from xmake ..
checking for xmake::zlib ... zlib 1.2.11
finding argp-standalone from xmake ..
checking for xmake::argp-standalone ... argp-standalone 1.3
checking for Android SDK directory ... /home/idersan/Android/Sdk
checking for Build Tools Version of Android SDK ... 31.0.0
checking for NDK directory ... /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90
checking for SDK version of NDK ... 23
checking for clang++ ... /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
checking for the shared library linker (sh) ... clang++
checking for clang++ ... /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
checking for the linker (ld) ... clang++
checking for /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar ... ok
checking for the static library archiver (ar) ... aarch64-linux-android-ar
configure
{
    kind = static
    ndk_toolchains_ver = 4.9
    buildir = build
    arch = arm64-v8a
    ndk = /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90
    plat = android
    system-libbpf = false
    require-bpftool = false
    host = linux
    build_toolver = 31.0.0
    ndk_stdcxx = true
    ndk_sdkver = 23
    ccache = true
    ndkver = 22
    clean = true
    mode = release
    android_sdk = /home/idersan/Android/Sdk
}
warning: cannot match target(libbpf).add_files("../../libbpf/src/*.c") at ./xmake.lua:39

$ xmake -rvD
checking for the shared library linker (sh) ... clang++
checking for the linker (ld) ... clang++
checking for the shared library linker (sh) ... clang++
checking for the linker (ld) ... clang++
[ 18%]: archiving.release libbpf.a
/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar -cr build/android/arm64-v8a/release/libbpf.a
checking for clang ... /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
checking for the c compiler (cc) ... clang
checking for the c compiler (cc) ... clang
checking for the c compiler (cc) ... clang
checking for the c compiler (cc) ... clang
checking for /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang ... ok
checking for flags (-Oz) ... ok
> clang "-Oz"
checking for flags (-DNDEBUG) ... ok
> clang "-DNDEBUG" "-Qunused-arguments" "-target" "aarch64-none-linux-android23" "-gcc-toolchain" "/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64"
checking for ccache ... /usr/bin/ccache
[ 22%]: compiling.bpf bootstrap.bpf.c
/usr/bin/ccache /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -c --sysroot=/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android -Qunused-arguments -target aarch64-none-linux-android23 -gcc-toolchain /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -fPIE -pie -Oz -I../../vmlinux -Ibuild/.gens/bootstrap/android/arm64-v8a/release/rules/bpf -I../../libbpf/include/uapi -Ibuild -isystem /home/idersan/.xmake/packages/a/argp-standalone/1.3/b1a9bb16169d4210a694c1b4ece2d270/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++abi/include -DNDEBUG -target bpf -g -D__TARGET_ARCH_arm64 -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++abi/include -o build/.gens/bootstrap/android/arm64-v8a/release/rules/bpf/bootstrap.bpf.o bootstrap.bpf.c
[ 22%]: compiling.bpf fentry.bpf.c
/usr/bin/ccache /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -c --sysroot=/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android -Qunused-arguments -target aarch64-none-linux-android23 -gcc-toolchain /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -fPIE -pie -Oz -I../../vmlinux -Ibuild/.gens/fentry/android/arm64-v8a/release/rules/bpf -I../../libbpf/include/uapi -Ibuild -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++abi/include -DNDEBUG -target bpf -g -D__TARGET_ARCH_arm64 -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++abi/include -o build/.gens/fentry/android/arm64-v8a/release/rules/bpf/fentry.bpf.o fentry.bpf.c
[ 22%]: compiling.bpf minimal.bpf.c
/usr/bin/ccache /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -c --sysroot=/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android -Qunused-arguments -target aarch64-none-linux-android23 -gcc-toolchain /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -fPIE -pie -Oz -I../../vmlinux -Ibuild/.gens/minimal/android/arm64-v8a/release/rules/bpf -I../../libbpf/include/uapi -Ibuild -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++abi/include -DNDEBUG -target bpf -g -D__TARGET_ARCH_arm64 -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++abi/include -o build/.gens/minimal/android/arm64-v8a/release/rules/bpf/minimal.bpf.o minimal.bpf.c
[ 22%]: compiling.bpf uprobe.bpf.c
/usr/bin/ccache /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -c --sysroot=/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android -Qunused-arguments -target aarch64-none-linux-android23 -gcc-toolchain /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -fPIE -pie -Oz -I../../vmlinux -Ibuild/.gens/uprobe/android/arm64-v8a/release/rules/bpf -I../../libbpf/include/uapi -Ibuild -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++abi/include -DNDEBUG -target bpf -g -D__TARGET_ARCH_arm64 -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++abi/include -o build/.gens/uprobe/android/arm64-v8a/release/rules/bpf/uprobe.bpf.o uprobe.bpf.c
uprobe.bpf.c:5:10: fatal error: 'bpf/bpf_helpers.h' file not found
#include <bpf/bpf_helpers.h>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.
error: @programdir/modules/private/async/runjobs.lua:232: @programdir/core/sandbox/modules/os.lua:393: execv(/usr/bin/ccache /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -c --sysroot=/home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android -Qunused-arguments -target aarch64-none-linux-android23 -gcc-toolchain /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -fPIE -pie -Oz -I../../vmlinux -Ibuild/.gens/uprobe/android/arm64-v8a/release/rules/bpf -I../../libbpf/include/uapi -Ibuild -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/.xmake/packages/n/ndk/22.0/fa2bffddf5a34ccda7bf5ad397348d90/sources/cxx-stl/llvm-libc++abi/include -DNDEBUG -target bpf -g -D__TARGET_ARCH_arm64 -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/include -isystem /home/idersan/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++abi/include -o build/.gens/uprobe/android/arm64-v8a/release/rules/bpf/uprobe.bpf.o uprobe.bpf.c) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:829]: in function 'raise'
    [@programdir/core/sandbox/modules/os.lua:393]: in function 'runv'
    [@programdir/core/sandbox/modules/os.lua:290]: in function 'vrunv'
    [@programdir/modules/private/utils/batchcmds.lua:96]: in function 'script'
    [@programdir/modules/private/utils/batchcmds.lua:179]: in function '_runcmd'
    [@programdir/modules/private/utils/batchcmds.lua:186]: in function '_runcmds'
    [@programdir/modules/private/utils/batchcmds.lua:343]: in function 'callback'
    [@programdir/modules/core/project/depend.lua:189]: in function 'on_changed'
    [@programdir/modules/private/utils/batchcmds.lua:342]: in function 'runcmds'
    [@programdir/actions/build/kinds/object.lua:86]: in function 'jobfunc'
    [@programdir/modules/private/async/runjobs.lua:208]:
    [C]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:121]: in function 'try'
    [@programdir/modules/private/async/runjobs.lua:201]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:371]:

stack traceback:
	[C]: in function 'error'
	@programdir/core/base/os.lua:829: in function 'raise'
	@programdir/modules/private/async/runjobs.lua:232: in function 'catch'
	@programdir/core/sandbox/modules/try.lua:127: in function 'try'
	@programdir/modules/private/async/runjobs.lua:201: in function 'cotask'
	@programdir/core/base/scheduler.lua:371: in function <@programdir/core/base/scheduler.lua:368>
warning: cannot match target(libbpf).add_files("../../libbpf/src/*.c") at ./xmake.lua:39
warning: target(libbpf).add_includedirs("../../libbpf/include") path not found at ./xmake.lua:40
warning: target(libbpf).add_includedirs("../../libbpf/include/uapi") path not found at ./xmake.lua:41
minimal.bpf.c:4:10: fatal error: 'bpf/bpf_helpers.h' file not found
#include <bpf/bpf_helpers.h>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.

@waruqi
Copy link
Contributor

waruqi commented Nov 17, 2021

i deleted local source code, do git clone this project again. output something else errors.

git submodule update --init

@waruqi
Copy link
Contributor

waruqi commented Nov 17, 2021

This is a problem with the new version of xmake. I fall back to v2.5.3 and it is possible to compile normally. You can use xmake v2.5.3 to compile it first.

xmake update -f 2.5.3

I will fix this problem in the next few days.

#51 @anakryiko This patch does not need to be merged, xmake has added -g to .bpf.c internally, and the new version has a bug that causes it to be recompiled without -g.

@waruqi
Copy link
Contributor

waruqi commented Nov 17, 2021

This seems to be a problem introduced by xmake 2.5.7, and versions before 2.5.6 should work

@waruqi
Copy link
Contributor

waruqi commented Nov 17, 2021

I have fixed it on xmake/dev branch. you can also update to dev version to try it again. It should work.

xmake update dev

@idersan
Copy link
Author

idersan commented Nov 17, 2021

good job! it's worked. i have some questions.
what android version(or what linux kernel version) can run bootstrap?

@waruqi
Copy link
Contributor

waruqi commented Nov 17, 2021

I have updated xmake.lua to add some checks. https://github.com/libbpf/libbpf-bootstrap/pull/52/files @anakryiko

@waruqi
Copy link
Contributor

waruqi commented Nov 17, 2021

what android version(or what linux kernel version) can run bootstrap?

I don’t know too, I haven’t tested it on android.

@idersan
Copy link
Author

idersan commented Nov 17, 2021

what android version(or what linux kernel version) can run bootstrap?

I don’t know too, I haven’t tested it on android.

thank you.

@idersan idersan closed this as completed Nov 17, 2021
@kochia3
Copy link

kochia3 commented Sep 8, 2022

Have problems with Android build again on the recent code:
#107

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

4 participants