1

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.
2
  • Check or update build-essential package.
    – Biswapriyo
    Commented Apr 3, 2019 at 13:55
  • 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
    Commented Apr 3, 2019 at 13:59

1 Answer 1

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .