joelagnel / bpfd

BPFd (Deprecated, please see README.md) : Berkeley Packet Filter daemon (BPFd). Makes it possible to run BCC tools across systems.
Apache License 2.0
95 stars 23 forks source link

Exception: Failed to compile BPF module #49

Open Linuxuser4 opened 6 years ago

Linuxuser4 commented 6 years ago

Hi, I am trying to use bpfd with host as ubuntu (4.4.0-116) and target as android(arm64 linux version 4.4). For any utility I run, I get the error "Exception: Failed to compile BPF module " More detailed log is below. Am I missing anything very obvious? autoconf.h will not be present as part of kernel source since all build generated files will be in 'out' directory created by android build environment. If I point to the generated 'out' directory, 'filetop' will complain that './include/linux/kconfig.h' file not found which is not in 'out' directory, but in the main kernel sources. How do I give path of both 'out' folder and kernel folder sources? Do I have to manually merge these and try out?

(bcc) root@hostname:~$ filetop In file included from :1: ././include/linux/kconfig.h:4:10: fatal error: 'generated/autoconf.h' file not found

include <generated/autoconf.h>

     ^~~~~~~~~~~~~~~~~~~~~~

1 error generated. Traceback (most recent call last): File "/usr/local/bpfd-install/share/bcc/tools/filetop", line 156, in b = BPF(text=bpf_text) File "/usr/local/bpfd-install/lib/python2.7/dist-packages/bcc/init.py", line 321, in init raise Exception("Failed to compile BPF module %s" % src_file) Exception: Failed to compile BPF module (bcc) root@hostname:~$

joelagnel commented 6 years ago

I am traveling. Remind me next week if you dont hear back.

On Wed, Apr 18, 2018, 2:03 PM Linuxuser4 notifications@github.com wrote:

Hi, I am trying to use bpfd with host as ubuntu (4.4.0-116) and target as android(arm64 linux version 4.4). For any utility I run, I get the error "Exception: Failed to compile BPF module " More detailed log is below. Am I missing anything very obvious? autoconf.h will not be present as part of kernel source since all build generated files will be in 'out' directory created by android build environment. If I point to the generated 'out' directory, 'filetop' will complain that './include/linux/kconfig.h' file not found which is not in 'out' directory, but in the main kernel sources. How do I give path of both 'out' folder and kernel folder sources? Do I have to manually merge these and try out?

(bcc) root@hostname:$ filetop In file included from :1: ././include/linux/kconfig.h:4:10: fatal error: 'generated/autoconf.h' file not found

include <generated/autoconf.h>

^ 1 error generated. Traceback (most recent call last): File "/usr/local/bpfd-install/share/bcc/tools/filetop", line 156, in b = BPF(text=bpf_text) File "/usr/local/bpfd-install/lib/python2.7/dist-packages/bcc/init.py", line 321, in init raise Exception("Failed to compile BPF module %s" % src_file) Exception: Failed to compile BPF module (bcc) root@hostname:~$

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/joelagnel/bpfd/issues/49, or mute the thread https://github.com/notifications/unsubscribe-auth/AACSVJfq_XnFSJbu_5IApY2dNqAb-hi4ks5tpyuTgaJpZM4TZ8AR .

Linuxuser4 commented 6 years ago

Thanks for offering to look into this. In the meantime, I thought of building the android kernel out of the android build environment to reduce dependency on android. I was able to build, albeit with large number of minor hacks.

When I now try filetop, I see "NameError: global name '_invalidate_map_cache' is not defined". Last few statements from my log are:

./arch/arm64/include/asm/uaccess.h:341:34: note: expanded from macro 'put_user_err' put_user_asm("str", "sttr", "%", __pu_val, (ptr), \ ^ 21 warnings generated. Tracing... Output every 1 secs. Hit Ctrl-C to end

11:16:04 loadavg: 0.43 0.29 0.21 1/775 8169

PID COMM D MAJ MIN DISK I/O Kbytes AVGms Traceback (most recent call last): File "/usr/local/bpfd-install/share/bcc/tools/biotop", line 222, in counts.clear() File "/usr/local/bpfd-install/lib/python2.7/dist-packages/bcc/table.py", line 270, in clear self.libremote.bpf_clear_map(self.map_fd, klen) File "/usr/local/bpfd-install/lib/python2.7/dist-packages/bcc/remote/libremote.py", line 203, in bpf_clear_map _invalidate_map_cache(map_fd) NameError: global name '_invalidate_map_cache' is not defined (bcc) root@hostname:~$

joelagnel commented 6 years ago

So first of all Android 4.4 won't even work since you need at least 4.9 kernel for the needed bpf support.

I would suggest you try the androdeb project on the Android 4.9 kernel to get the easiest BCC setup experience. Tinyurl.com/androdeb

On Thu, Apr 19, 2018, 7:17 AM Linuxuser4 notifications@github.com wrote:

Thanks for offering to look into this. In the meantime, I thought of building the android kernel out of the android build environment to reduce dependency on android. I was able to build, albeit with large number of minor hacks.

When I now try filetop, I see "NameError: global name '_invalidate_map_cache' is not defined". Last few statements from my log are:

./arch/arm64/include/asm/uaccess.h:341:34: note: expanded from macro 'put_user_err' put_user_asm("str", "sttr", "%", __pu_val, (ptr), ^ 21 warnings generated. Tracing... Output every 1 secs. Hit Ctrl-C to end

11:16:04 loadavg: 0.43 0.29 0.21 1/775 8169

PID COMM D MAJ MIN DISK I/O Kbytes AVGms Traceback (most recent call last): File "/usr/local/bpfd-install/share/bcc/tools/biotop", line 222, in counts.clear() File "/usr/local/bpfd-install/lib/python2.7/dist-packages/bcc/table.py", line 270, in clear self.libremote.bpf_clear_map(self.map_fd, klen) File "/usr/local/bpfd-install/lib/python2.7/dist-packages/bcc/remote/libremote.py", line 203, in bpf_clear_map _invalidate_map_cache(map_fd) NameError: global name '_invalidate_map_cache' is not defined (bcc) root@hostname:~$

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/joelagnel/bpfd/issues/49#issuecomment-382623041, or mute the thread https://github.com/notifications/unsubscribe-auth/AACSVJZ330RNx1q3NKuG60aU72UGMVu7ks5tqCwCgaJpZM4TZ8AR .