I followed http://blog.ceard.tech/2017/12/upgrading-python-virtual-environment.html
and did this on mij HA Core and on a newley prepared SD with Rapsberry OS Lite (2020-08-20 build)
After
sudo apt update && apt upgrade
sudo apt install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libudev-dev libc-dev libffi-dev libbluetooth-dev libtirpc-dev libjemalloc-dev
cd /home/pi
wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz
tar -zxvf Python-3.8.6.tgz
cd Python-3.8.6
./configure --enable-optimizations --enable-shared --with-lto --with-system-expat --with-system-ffi --without-ensurepip
make -j$(cat /proc/cpuinfo|egrep -c "^processor") LDFLAGS="-Wl,--strip-all" CFLAGS="-fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -ljemalloc" EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"
i get:
*** WARNING: renaming "_struct" since importing it failed: /usr/lib/arm-linux-gnueabihf/libjemalloc.so.2: cannot allocate memory in static TLS block
Segmentation fault
make[3]: *** [Makefile:614: sharedmods] Error 139
make[3]: Leaving directory '/home/pi/Python-3.8.6'
make[2]: *** [Makefile:507: build_all_generate_profile] Error 2
make[2]: Leaving directory '/home/pi/Python-3.8.6'
make[1]: *** [Makefile:483: profile-gen-stamp] Error 2
make[1]: Leaving directory '/home/pi/Python-3.8.6'
make: *** [Makefile:495: profile-run-stamp] Error 2
What is going wrong here?
When I do “sudo make altinstall” despite the errors I get:
if test "no-framework" = "no-framework" ; then \
/usr/bin/install -c python /usr/local/bin/python3.8; \
else \
/usr/bin/install -c -s Mac/pythonw /usr/local/bin/python3.8; \
fi
if test "3.8" != "3.8"; then \
if test -f /usr/local/bin/python3.8 -o -h /usr/local/bin/python3.8; \
then rm -f /usr/local/bin/python3.8; \
fi; \
(cd /usr/local/bin; ln python3.8 python3.8); \
fi
if test -f libpython3.8.so && test "no-framework" = "no-framework" ; then \
if test -n "" ; then \
/usr/bin/install -c -m 755 /usr/local/bin; \
else \
/usr/bin/install -c -m 755 libpython3.8.so /usr/local/lib/libpython3.8.so.1.0; \
if test libpython3.8.so != libpython3.8.so.1.0; then \
(cd /usr/local/lib; ln -sf libpython3.8.so.1.0 libpython3.8.so) \
fi \
fi; \
if test -n "libpython3.so"; then \
/usr/bin/install -c -m 755 libpython3.so /usr/local/lib/libpython3.so; \
fi; \
else true; \
fi
if test "x" != "x" ; then \
rm -f /usr/local/binpython3.8-32; \
lipo \
-output /usr/local/bin/python3.8-32 \
/usr/local/bin/python3.8; \
fi
LD_LIBRARY_PATH=/home/pi/Python-3.8.6 CC='gcc -pthread' LDSHARED='gcc -pthread -shared -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py build
Segmentation fault
make: *** [Makefile:614: sharedmods] Error 139