I am currently working with an embedded system based on the Freescale i.MX6 ARM CPU. The manufacturer provides a Linearo Toolchain, but besides that nothing, so I am limited to a custom linux distribution with no package manager etc.
For our application, we need to run Python 3.5/3.6 with PIP, OpenSSL support and AWS support libraries.
So far, I have failed trying to build a static version of Python 3.5/3.6 with the requirements mentioned above.
My current configure and make flags are (were):
./configure LDFLAGS="-static" --disable-shared --prefix=/build
make LDFLAGS="-static" LINKFORSHARED=" " -j$(nproc)
Any help greatly appreciated.
EDIT:
After compiling with:
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ AR=arm-linux-gnueabihf-ar RANLIB=arm-linux-gnueabihf-ranlib \
./configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf \
--build=x86_64-linux-gnu --prefix=$HOME/python \
--disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no \
ac_cv_have_long_long_format=yes LDFLAGS="-static" --disable-shared
make CFLAGS="-I/$HOME/python/include/" CXXFLAGS="-I/$HOME/python/include/" LDFLAGS="-static -L/root/python/lib/" LINKFORSHARED=" " BLDSHARED="arm-linux-gnueabihf-gcc -shared" CROSS-COMPILE=arm-linux-gnueabihf- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=arm-linux-gnueabihf -j10
make install CFLAGS="-I/$HOME/python/include/" CXXFLAGS="-I/$HOME/python/include/" LDFLAGS="-static -L/root/python/lib/" LINKFORSHARED=" " BLDSHARED="arm-linux-gnueabihf-gcc -shared" CROSS-COMPILE=arm-linux-gnueabihf- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=arm-linux-gnueabihf -j10
`
I am getting:
Python 3.6.5 (default, May 8 2018, 14:35:54)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/dev/shm/run/media/0b4c0683-7d1d-474a-b639-
604c1d0c6156/py3/lib/python3.6/socket.py", line 49, in <module>
import _socket
ImportError: /dev/shm/run/media/0b4c0683-7d1d-474a-b639-
604c1d0c6156/py3/lib/python3.6/lib-dynload/_socket.cpython-36m-arm-
linux-gnueabihf.so: invalid ELF header
Which still leaves me in the dark.
I'm looking for the instructions and found this: https://raspberrypi.stackexchange.com/questions/66528/how-to-cross-compile-python-3-6-for-the-raspberry-pi
Have not tried. Hope it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With