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

BPFd linker error #53

Closed maindoor closed 5 years ago

maindoor commented 5 years ago

I'm trying to build BPFd using openwrt toolchain that I'm already using to build other applications that run on my target board. but I get the following linker error:

aarch64-openwrt-linux-gnu-gcc: warning: environment variable 'STAGING_DIR' not defined
[ 93%] Building C object CMakeFiles/bpfd.dir/src/cmd_parsers.c.o
aarch64-openwrt-linux-gnu-gcc: warning: environment variable 'STAGING_DIR' not defined
[100%] Linking CXX executable bpfd
aarch64-openwrt-linux-gnu-g++: warning: environment variable 'STAGING_DIR' not defined
aarch64-openwrt-linux-gnu-g++: warning: environment variable 'STAGING_DIR' not defined
/home/madda/project/thirdparty/openwrt-1505/staging_dir/toolchain-axel-qca/lib/gcc/aarch64-openwrt-linux-gnu/5.3.0/../../../../aarch64-openwrt-linux-gnu/lib/libstdc++.a(wlocale-inst.o): In function `std::collate<wchar_t>::do_compare(wchar_t const*, wchar_t const*, wchar_t const*, wchar_t const*) const':
wlocale-inst.cc:(.text._ZNKSt7collateIwE10do_compareEPKwS2_S2_S2_[_ZNKSt7collateIwE10do_compareEPKwS2_S2_S2_]+0xf8): undefined reference to `_Unwind_Resume'
/home/madda/project/thirdparty/openwrt-1505/staging_dir/toolchain-axel-qca/lib/gcc/aarch64-openwrt-linux-gnu/5.3.0/../../../../aarch64-openwrt-linux-gnu/lib/libstdc++.a(wlocale-inst.o): In function `std::collate<wchar_t>::do_transform(wchar_t const*, wchar_t const*) const':
wlocale-inst.cc:(.text._ZNKSt7collateIwE12do_transformEPKwS2_[_ZNKSt7collateIwE12do_transformEPKwS2_]+0x158): undefined reference to `_Unwind_Resume'

My question is, do I have to use the same openwrt toolchain or can I just get another ubuntu machine and follow the steps you gave to build BPFd ? My target is a IPQ806x board running armv8 core.

maindoor commented 5 years ago

Because if BPFd uses runtime libraries...they may not be available on the target if it is built with an ubuntu based toolchain. But if I build it with an Openwrt toolchain then those libraries will be present on the target system because other applications too are built with Openwrt toolchain and they run just fine.

maindoor commented 5 years ago

Just verified that the executable is statically linked so compiling on an ubuntu machine and moving it to an arm64 embedded board worked. closing issue.