mad_ady
Regular Contributor
Hello all,
I'm trying to cross-compile my own version of conntrack-tools (in order to invalidate established sessions based on custom needs - e.g. when removing time-based firewall rules). I got my dev environment up by following this guide: https://github.com/RMerl/asuswrt-merlin/wiki/Compile-Firmware-from-source-using-Ubuntu, except I didn't use VirtualBox, but set up a lxc container instead.
I got everything set up and working although I had to do an extra step:
Next I got contrack-tools and all its dependencies (about 5 related libraries) and cross compiled all of them in the order required with something like this:
It's messy, I agree, but in the end it compiles the conntrack binary that I need.
Now comes the problem part. I wanted to build a static binary, but it isn't static. I have two options - try to make it static, or move the dependent libraries on the router. It seems I failed both tasks and I require RMerlin's expertise...
I tried moving the libs + symlinks to the router inside /opt/lib, and the binary to /opt/bin
... but even after a reboot, ldd still doesn't see the libs.
So, question:
1. How can I convince it to link statically?
2. If I can't convince it to do it statically, why can't ldd see the libs I've put in /opt/lib? I can't run ldconfig on the router...
Thanks!
I'm trying to cross-compile my own version of conntrack-tools (in order to invalidate established sessions based on custom needs - e.g. when removing time-based firewall rules). I got my dev environment up by following this guide: https://github.com/RMerl/asuswrt-merlin/wiki/Compile-Firmware-from-source-using-Ubuntu, except I didn't use VirtualBox, but set up a lxc container instead.
I got everything set up and working although I had to do an extra step:
Code:
# cat /etc/ld.so.conf.d/arm.conf
/root/asuswrt-merlin/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/lib
Next I got contrack-tools and all its dependencies (about 5 related libraries) and cross compiled all of them in the order required with something like this:
Code:
root@ubuntu12:~/asuswrt-merlin/release/src-rt/conntrack/conntrack-tools-1.4.3# export PKG_CONFIG_PATH=/root/asuswrt-merlin/release/src-rt/conntrack/libnfnetlink-1.0.1:/root/asuswrt-merlin/release/src-rt/conntrack/libmnl-1.0.3:/root/asuswrt-merlin/release/src-rt/conntrack/libnetfilter_conntrack-1.0.5:/root/asuswrt-merlin/release/src-rt/conntrack/libnetfilter_cttimeout-1.0.0:/root/asuswrt-merlin/release/src-rt/conntrack/libnetfilter_queue-1.0.2:/root/asuswrt-merlin/release/src-rt/conntrack/libnetfilter_cthelper-1.0.0; ./configure --host=arm-brcm-linux-uclibcgnueabi --enable-static; make;
It's messy, I agree, but in the end it compiles the conntrack binary that I need.
Now comes the problem part. I wanted to build a static binary, but it isn't static. I have two options - try to make it static, or move the dependent libraries on the router. It seems I failed both tasks and I require RMerlin's expertise...
Code:
root@ubuntu12:~/asuswrt-merlin/release/src-rt/conntrack/conntrack-tools-1.4.3# file src/conntrack
src/conntrack: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
I tried moving the libs + symlinks to the router inside /opt/lib, and the binary to /opt/bin
Code:
admin@LHS 288:/tmp/home/root# ldd /opt/bin/conntrack
libnetfilter_conntrack.so.3 => not found
libmnl.so.0 => not found
libnfnetlink.so.0 => not found
libc.so.0 => /lib/libc.so.0 (0x401ad000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x400ec000)
admin@LHS 288:/tmp/home/root#
admin@LHS 288:/tmp/home/root# ls -l /opt/lib/libnetfilter_conntrack.so.3* /opt/lib/libmnl.so.0* /opt/lib/libnfnetlink.so.0*
lrwxrwxrwx 1 admin root 15 Dec 16 15:27 /opt/lib/libmnl.so.0 -> libmnl.so.0.1.0
-rwxr-xr-x 1 admin root 47678 Dec 16 15:27 /opt/lib/libmnl.so.0.1.0
lrwxrwxrwx 1 admin root 31 Dec 16 15:17 /opt/lib/libnetfilter_conntrack.so.3 -> libnetfilter_conntrack.so.3.5.0
-rwxr-xr-x 1 admin root 480741 Dec 16 15:17 /opt/lib/libnetfilter_conntrack.so.3.5.0
lrwxrwxrwx 1 admin root 21 Dec 16 15:29 /opt/lib/libnfnetlink.so.0 -> libnfnetlink.so.0.2.0
-rwxr-xr-x 1 admin root 69362 Dec 16 15:28 /opt/lib/libnfnetlink.so.0.2.0
So, question:
1. How can I convince it to link statically?
2. If I can't convince it to do it statically, why can't ldd see the libs I've put in /opt/lib? I can't run ldconfig on the router...
Thanks!