[BUG] Cannot compile <9-runqlat>'s code in Ubuntu 22.04
Error message:
INFO [ecc_rs::bpf_compiler] Compiling bpf object...
error: unknown argument: '-target bpf'
/home/runjie/Desktop/bpf-developer-tutorial/src/9-runqlat/core_fixes.bpf.h:28:6: error: use of unknown builtin '__builtin_preserve_field_info' [-Wimplicit-function-declaration]
/home/runjie/Desktop/bpf-developer-tutorial/src/9-runqlat/core_fixes.bpf.h:51:6: error: use of unknown builtin '__builtin_preserve_field_info' [-Wimplicit-function-declaration]
/home/runjie/Desktop/bpf-developer-tutorial/src/9-runqlat/core_fixes.bpf.h:79:6: error: use of unknown builtin '__builtin_preserve_type_info' [-Wimplicit-function-declaration]
/home/runjie/Desktop/bpf-developer-tutorial/src/9-runqlat/core_fixes.bpf.h:79:6: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
/home/runjie/Desktop/bpf-developer-tutorial/src/9-runqlat/core_fixes.bpf.h:79:6: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
/home/runjie/Desktop/bpf-developer-tutorial/src/9-runqlat/core_fixes.bpf.h:107:6: error: use of unknown builtin '__builtin_preserve_field_info' [-Wimplicit-function-declaration]
INFO [ecc_rs::bpf_compiler] Generating export types...
INFO [ecc_rs::bpf_compiler] Generating package json..
INFO [ecc_rs::bpf_compiler] Packing ebpf object and config into package.json..
My clang version is clang 14, which is default clang version in Ubuntu 22.04. I also try to use clang 16. However, the error message is same.
How did you invoke ecc?
I try to use ecc by (1) adding the ecc's folder into $PATH, (2) using absolute path of ecc, and (3) adding sudo into command. However, all methods failed to compile 9-runqlat's code.
I try to use
eccby (1) adding theecc's folder into$PATH, (2) using absolute path ofecc, and (3) addingsudointo command. However, all methods failed to compile9-runqlat's code.
Which version of ecc are you using? May I have a look at the output of ecc -v? And how did you switch the version of clang?
Here is the output of ecc -V: ecc-rs 0.3.4.
For the switching of clang version, I first use apt remove to uninstall clang-14. And then I copy clang-16 to /bin/ and /usr/bin/ because ecc cannot find clang-16 if I simply add clang-16 into $PATH.
请问这个问题解决了吗?我遇到了同样的问题: 环境ubuntu 20.04.06 rustup 1.27.0 (bbb9276d2 2024-03-08) rustc 1.77.0 (aedd173a2 2024-03-17) Ubuntu clang version 16.0.6 (++20231112100455+7cbf1a259152-1~exp1~20231112100542.106)