Posts: 59
Joined: Mon Jul 29, 2013 4:37 pm

Building Python3.6.2 with optimizations

Thu Aug 03, 2017 5:31 pm

If I try configuring python3.6.2 with --enable-optimisations and this causes it to segfault gcc during make.
It seems to build OK with a plain ./configure and make.
The error recommends a full bug report - has anyone also had this?

Posts: 384
Joined: Thu Aug 14, 2014 12:49 am

Re: Building Python3.6.2 with optimizations

Fri Aug 04, 2017 12:16 am

It's very hard to provide help without seeing the actual error you are getting.

Entering crystall ball mode...

--enable-optimizations for python build enables lto and profiling, it also runs a set of lenghty and expensive tests, lto linking requires vast amounts of ram.
It's possible that gcc segfaults due to OOM (out of memory).

Run dmesg after crash - if you see OOM errors then my crystal ball still works.

Try increasing your swap{file,partition} to 4-8 GB.

Posts: 7
Joined: Tue May 29, 2012 12:47 am

Re: Building Python3.6.2 with optimizations

Sat Jan 13, 2018 3:03 pm

It's a little while after the earlier posts, but in case it's useful to anyone trying something similar, I managed to successfully compile Python 3.6 (specifically 3.6.4)

My set up is a RPi 3 running Rasbian Jessie Lite

I did the following steps, based on the URL given but for 3.6.4 with the optimisations and LTO enabled (wasn't 100% sure that LTO did anything as I didn't spot any output referring to it, but it didn't seem to do any harm!). ... pberry-pi/


Code: Select all

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Get source

Code: Select all

cd /usr/src
sudo wget
sudo tar xzf Python-3.6.4.tgz

Code: Select all

cd Python-3.6.4
sudo -s
./configure --enable-optimizations --with-lto
make altinstall
Test version

Code: Select all

python3.6 --version
pip3.6 --version

Posts: 59
Joined: Mon Jul 29, 2013 4:37 pm

Re: Building Python3.6.2 with optimizations

Tue Mar 13, 2018 9:20 am

Ooh Thanks

Return to “Python”