When integrating the python iptables wrapper I found two missing pieces. The first piece is the naming of the c library so that iptc/xtables can find it. I've just pasted my post_build fixup here but it probably would find a home in the toolchain package. pushd ${DEST_DIR}/lib ln -sf libc.so.6 libc.so popd The second item is for the xtables c wrapper to find the library, a /etc/profile.d/python-iptc.sh or similar needs added with the following. #!/bin/sh export PYTHON_IPTABLES_XTABLES_VERSION=12 export XTABLES_LIBDIR=/usr/lib/python2.7/site-packages/:/usr/lib/xtables # The interactive console doesn't require the following, however # direct scripting use does export IPTABLES_LIBDIR=/lib:/usr/lib Here's a basic build were these changes can be observed. BR2_aarch64=y BR2_TOOLCHAIN_EXTERNAL=y BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.16.7" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_PYTHON=y BR2_PACKAGE_PYTHON_IPTABLES=y BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set Here's the output before setting up the lib link. Welcome to Buildroot buildroot login: root # python Python 2.7.17 (default, Oct 21 2019, 13:54:55) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import iptc random: fast init done random: python: uninitialized urandom read (2500 bytes read) random: python: uninitialized urandom read (2500 bytes read) random: python: uninitialized urandom read (2500 bytes read) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "usr/lib/python2.7/site-packages/iptc/__init__.py", line 10, in <module> File "usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 13, in <module> File "usr/lib/python2.7/site-packages/iptc/xtables.py", line 796, in <module> AttributeError: 'NoneType' object has no attribute '_handle' Here's the output after setting up the lib link # cd /lib # ln -sf libc.so.6 libc.so # python Python 2.7.17 (default, Oct 21 2019, 13:54:55) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import iptc random: python: uninitialized urandom read (2500 bytes read) random: python: uninitialized urandom read (2500 bytes read) random: python: uninitialized urandom read (2500 bytes read) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "usr/lib/python2.7/site-packages/iptc/__init__.py", line 10, in <module> File "usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 13, in <module> File "usr/lib/python2.7/site-packages/iptc/xtables.py", line 812, in <module> File "usr/lib/python2.7/subprocess.py", line 394, in __init__ File "usr/lib/python2.7/subprocess.py", line 1047, in _execute_child OSError: [Errno 2] No such file or directory Here's the output after setting up the profile env script. # vi /etc/profile.d/python-iptc.sh # paste in the above script then # python Python 2.7.17 (default, Oct 21 2019, 13:54:55) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import iptc random: python: uninitialized urandom read (2500 bytes read) random: python: uninitialized urandom read (2500 bytes read) random: python: uninitialized urandom read (2500 bytes read) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "usr/lib/python2.7/site-packages/iptc/__init__.py", line 10, in <module> File "usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 13, in <module> File "usr/lib/python2.7/site-packages/iptc/xtables.py", line 812, in <module> File "usr/lib/python2.7/subprocess.py", line 394, in __init__ File "usr/lib/python2.7/subprocess.py", line 1047, in _execute_child OSError: [Errno 2] No such file or directory >>> ^^^^^^^^^^^^^^^ above failed since we didn't restart the shell, so exit # exit Welcome to Buildroot buildroot login: root # python Python 2.7.17 (default, Oct 21 2019, 13:54:55) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import iptc >>>
This has been fixed by: https://git.buildroot.org/buildroot/commit/?id=21b85bc56cdcf030cced57dea0f78cdce59912b8 https://git.buildroot.org/buildroot/commit/?id=90c18ab269c600ee7643f69212713ee3b74c38bd https://git.buildroot.org/buildroot/commit/?id=52276cdda34aa986410626592031560bf64d788b
It was actually only fixed by https://git.buildroot.org/buildroot/commit/?id=d341ec035067120b456f669a826e26eb594c0237