Bulding Python 3.7 from source

0

I am struggling to bould Python 3.7 from source on Linux Mint 18.3

Some problem with gcc.

Am I using outdated version of gcc?

Here is what the configure script of python3.7 writes to standard output

./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/boldi/Downloads/Python-3.7.3':
configure: error: C compiler cannot create executables
See `config.log' for more details

When I check config.log

I see som problem with gcc option -V

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 
configure:3909: $? = 0
configure:3898: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.

boldi

Posted 2019-04-03T13:16:37.657

Reputation: 3

Check or update build-essential package. – Biswapriyo – 2019-04-03T13:55:01.020

Hah. That was it. I'm on a new distro and thought I have all the packages from the old one... Literally I forgot that's relatively fresh installation... – boldi – 2019-04-03T13:59:02.443

Thanks Biswapriyo. – boldi – 2019-04-03T14:01:50.710

Answers

0

From the error codes, it looks like the distribution has not the build-essential package. To build python from source code:

  • Download required packages: apt install build-essential wget ca-certificates
  • Download latest source tarball: wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
  • Extract the tarball: tar -xf Python-3.7.3.tgz
  • cd into it
  • Configure the Makefile: ./configure
  • Compile and install: make && make install

Source:

Cpython: build-instructions

Biswapriyo

Posted 2019-04-03T13:16:37.657

Reputation: 6 640