Hi!
One of my projects on Turris Omnia is to manage the deployment of LXC containers through Ansible.
Thus, I plan to use the lxc_container
module of Ansible, which requires the installation of python3-lxc
on the Turris Omnia host.
Unfortunately, python3-lxc
is available neither through a system package (opkg
) nor through pip
(it does have lxc-python2
, but no lxc-python3
.
So I decided to compile python3-lxc
from source by myself, then to install it on my Turris Omnia host. For that build purpose, I created a temporary LXC container with a Turris OS image, then:
- Downloaded the source of
python3-lxc
v3.0.4 - Installed
pkg-config
,python3-setuptools
,python3-dev
,gcc
,make
in the container - Copied the header files (
src/lxc/*.h
) fromLXC source
in version 3.0.3, as there is no “dev” package available throughopkg
and that this tag matches the actual version oflxc
package. I copied these files in/usr/include/lxc/
, as they are required for the build. - Launched
python3 setup.py build
frompython3-lxc
source directory
And here is the result:
running build
running build_py
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
Package lxc was not found in the pkg-config search path.
Perhaps you should add the directory containing `lxc.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lxc' found
building '_lxc' extension
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -iremap/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/Python-3.7.10:Python-3.7.10 -Wformat -Werror=format-security -fpic -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -iremap/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/Python-3.7.10:Python-3.7.10 -Wformat -Werror=format-security -fpic -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -iremap/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/Python-3.7.10:Python-3.7.10 -Wformat -Werror=format-security -fpic -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -I/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/usr/include -I/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/include -I/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/usr/include -I/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/include/fortify -I/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/include -fPIC -I/usr/include/python3.7 -c lxc.c -o build/temp.linux-armv7l-3.7/lxc.o
[...]
gcc -shared -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/usr/lib -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/lib -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/usr/lib -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/lib -fpic -specs=/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/include/hardened-ld-pie.specs -znow -zrelro -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/Python-3.7.10 -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/usr/lib -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/lib -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/usr/lib -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/lib -fpic -specs=/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/include/hardened-ld-pie.specs -znow -zrelro -L/home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/Python-3.7.10 build/temp.linux-armv7l-3.7/lxc.o -L/usr/lib -llxc -lpython3.7 -o build/lib.linux-armv7l-3.7/_lxc.cpython-37.so
gcc: error: /home/beast/beast/workspace/turris-os-packages-kittens-omnia/build/include/hardened-ld-pie.specs: No such file or directory
error: command 'gcc' failed with exit status 1
I am not used to the setuptools toolchain, so I wonder why there are so many references to /home/beast/beast/workspace/turris-os-packages-kittens-omnia/
in the gcc
calls, but obviously I have no such directory in my system.
How can I sort this out? What am I missing?
Do you think I am on the right path to get a compiled python3-lxc
installed on my Turris Omnia router? Or is there a simpler and/or more efficient approach?
Thanks in advance!