Building Python3 OpenWRT 18.06.1 on openSUSE LEAP 15.0:
gcc -shared -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/host/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib64 -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/host/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib64 -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/host/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib64 -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -O2 -I/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/host/include -I/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/include -I/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/include -I/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/host/include -I/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/include -I/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/include build/temp.linux-x86_64-3.6/local/jan/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/_ctypes.o build/temp.linux-x86_64-3.6/local/jan/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/callbacks.o build/temp.linux-x86_64-3.6/local/jan/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/callproc.o build/temp.linux-x86_64-3.6/local/jan/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/stgdict.o build/temp.linux-x86_64-3.6/local/jan/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/cfield.o -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/host/lib -L/local/jan/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -lffi -ldl -o build/lib.linux-x86_64-3.6/_ctypes.cpython-36.so
*** WARNING: renaming "_ctypes" since importing it failed: libffi.so.6: cannot open shared object file: No such file or directoryPython build finished successfully!
The necessary bits to build these optional modules were not found:
_tkinter
To find the necessary bits, look in setup.py in detect_modules() for the module's name.The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
atexit pwd time
zlibFailed to build these modules:
_lzma _sslFollowing modules built successfully but were removed because they could not be imported:
_ctypes
Later on the lack of the _ctypes module is fatal. My guess is the import test uses the wrong path, and looks in the host system where there is no libffi.so.6, the host has libffi.so.7. The same config and OpenWRT version builds on Ubuntu (I guess it's Ubuntu 18.04):
gcc -pthread -shared -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/host/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/host/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/host/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -lssl -lresolv -lcrypto -lpthread -lcrypto -lresolv -lpthread -Wl,--no-as-needed -lrt -O2 -I/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/host/include -I/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/include -I/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/include -I/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/host/include -I/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/include -I/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/target-arm_cortex-a8+vfpv3_musl_eabi/host/include build/temp.linux-x86_64-3.6/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/_ctypes.o build/temp.linux-x86_64-3.6/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/callbacks.o build/temp.linux-x86_64-3.6/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/callproc.o build/temp.linux-x86_64-3.6/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/stgdict.o build/temp.linux-x86_64-3.6/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/build_dir/hostpkg/Python-3.6.5/Modules/_ctypes/cfield.o -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/host/lib -L/home/oen/work/gtu/mcg/openwrt-h1164-mockup-25/staging_dir/hostpkg/lib -lffi -ldl -o build/lib.linux-x86_64-3.6/_ctypes.cpython-36.so
*** WARNING: renaming "_crypt" since importing it failed: build/lib.linux-x86_64-3.6/_crypt.cpython-36.so: undefined symbol: crypt
*** WARNING: renaming "nis" since importing it failed: build/lib.linux-x86_64-3.6/nis.cpython-36.so: undefined symbol: yp_masterPython build finished successfully!
The necessary bits to build these optional modules were not found:
_curses _curses_panel _dbm
_gdbm _sqlite3 _tkinter
readline
To find the necessary bits, look in setup.py in detect_modules() for the module's name.The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
atexit pwd time
zlibFailed to build these modules:
_lzma _sslFollowing modules built successfully but were removed because they could not be imported:
_crypt nis
Maybee Ubuntu uses the same version of libffi, I don't currently have access to that machine so I cannot check.
By symlinking /usr/lib64/libffi.so.6 to /usr/lib64/libffi.so.7 the build gets passed this, indicating that my assumption that the _ctypes module is linked against staging, but the import test is against the host is correct. But making such a symlink is definitely the wrong solution.
Now I get the following error (now I have also changed packages from 18.06 to master):
Package python3-light is missing dependencies for the following libraries:
libuuid.so.1
But that's another story I suppose.
If there are any experts on the python build I appreciate some help with this. I guess this bug will come and bite people later on when Ubuntu upgrades libffi.