Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python3.5 -m ensurepip --> segmentation fault

I installed Python 3.5 from source on Ubuntu 21.10.

sudo make install


...
...
...
if test "xupgrade" != "xno"  ; then \
    case upgrade in \
        upgrade) ensurepip="--upgrade" ;; \
        install|*) ensurepip="" ;; \
    esac; \
     ./python -E -m ensurepip \
        $ensurepip --root=/ ; \
fi

Segmentation fault (core dumped)
make: *** [Makefile:1048: install] Error 139

What could be the reason?

What can I do to debug this?

like image 598
guettli Avatar asked Aug 04 '26 23:08

guettli


1 Answers

Similar problem happened when I tried to install python 3.6 from sources on ubuntu 20.10.

Problem is described here: https://bugs.python.org/issue45700

Modify build

Workaround which worked for me: after ./configure I have modified Makefile and Makefile.pre and changed optimization flags "O3" -> "O2":

OPT=            -DNDEBUG -g -fwrapv -O3 -Wall      # orig line
OPT=            -DNDEBUG -g -fwrapv -O2 -Wall      # fixed line

After this modification continue as usual: make, ...

Global version

Export PYTHON_CFLAGS with value '-O2', and you will fix installation via pyenv, asdf and probably others:

export PYTHON_CFLAGS='-O2'
like image 63
lesnik Avatar answered Aug 07 '26 12:08

lesnik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!