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

eadb v0.1.3 + debianfs-full.tar.gz 环境,编译 bpftrace 报错 #9

Closed
shen330 opened this issue Jun 23, 2022 · 3 comments
Closed
Labels
question Further information is requested

Comments

@shen330
Copy link

shen330 commented Jun 23, 2022

维术带佬你好,我跟着教程在手机上用 eadb v0.1.3 + debianfs-full.tar.gz 搭起 linux 环境,想简单体验一下 bpftrace 的效果

apt install bpftrace 后,执行 readme 中的展示命令会报错,参考直播时提到过 bcc 源码中的 tracing 路径问题,猜测应该是 bpftrace 源码里也写死了 /sys/kernel/debug/tracing 导致的,所以 fork 并修改了 bpftrace 的源码并 clone 到回来,尝试在手机上源码编译

目前是在源码编译仅修改 tracing 路径后的 bpftrace 过程中,make -j8 时报错
image

检查了报错代码中,对应函数的调用如下, 传递了 3 个参数

  init_disassemble_info(&info, stdout, fprintf_nop);

但是从手机 linux 环境的 /usr/include/dis-asm.h 文件中查看导出的 init_disassemble_info 函数有 4 个参数,所以报错了

/* Method to initialize a disassemble_info struct.  This should be
   called by all applications creating such a struct.  */
extern void init_disassemble_info (struct disassemble_info *dinfo, void *stream,
				   fprintf_ftype fprintf_func,
				   fprintf_styled_ftype fprintf_styled_func);

/* For compatibility with existing code.  */
#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC, FPRINTF_STYLED_FUNC)  \
  init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC), \
			 (fprintf_styled_ftype) (FPRINTF_STYLED_FUNC))

对这个方向的知识储备比较少,现在不知道该从哪里入手才能正常编译出 bpftrace 了,请 带佬 帮忙解答,非常感谢

@tiann
Copy link
Owner

tiann commented Jun 23, 2022

给一下你的编译步骤

@shen330
Copy link
Author

shen330 commented Jun 23, 2022

我是参考的 bpftrace 的源码编译文档 https://github.com/iovisor/bpftrace/blob/master/INSTALL.md#building-bpftrace-1

拉代码
git clone https://github.com/shen330/android_bpftrace.git

  • 只改了 tracing path
    image

sudo apt-get install -y
bison
cmake
flex
g++
git
libelf-dev
zlib1g-dev
libfl-dev
systemtap-sdt-dev
binutils-dev
libcereal-dev
llvm-12-dev
llvm-12-runtime
libclang-12-dev
clang-12
libgtest-dev
libgmock-dev
asciidoctor

mkdir bpftrace/build; cd bpftrace/build;

cmake -DCMAKE_BUILD_TYPE=Release ..

make -j8 , 执行 make 后出现上面的错误

@tiann
Copy link
Owner

tiann commented Jun 23, 2022

应该是依赖装错了,重新整个环境,仅安装这里面的依赖 再试。

@tiann tiann closed this as completed Jun 30, 2022
@tiann tiann added the question Further information is requested label Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants