pythonpython-3.xlinuxpython-3.2

How to fix the errors while compiling Python 3.2.0


I am trying to create Python-3.2.0 virtual environment for upgrading my tool. The tool was earlier built with 2.7.15 version. Now I want to upgrade it to Python-3.2.0

These are the steps which I followed on Cent-OS:

(a) Download the Python source code from the official repository cd /tmp wget https://www.python.org/ftp/python/3.2/Python-3.2.tgz tar -xvf Python-3.2 cd Python-3.2

(b) Compile Python with the required flags ./configure --enable-optimizations --enable-shared -- prefix=/opt/python LDFLAGS=-Wl,-rpath=/opt/python/lib sudo make install

I got the following errors:

/usr/bin/install -c python-config /opt/python/bin/python3.2m-config
    rm python-config
    LD_LIBRARY_PATH=/tmp/Python-3.2: ./python -E ./setup.py install \
            --prefix=/opt/python \
            --install-scripts=/opt/python/bin \
            --install-platlib=/opt/python/lib/python3.2/lib-dynload \
            --root=/
    running install
    running build
    running build_ext
    building dbm using ndbm
    INFO: Can't locate Tcl/Tk libs and/or headers
    building '_dbm' extension
    gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_NDBM_H -IInclude -I/opt/python/include -I. -I./Include -I/usr/local/include -I/tmp/Python-3.2 -c /tmp/Python-3.2/Modules/_dbmmodule.c -o build/temp.linux-x86_64-3.2/tmp/Python-3.2/Modules/_dbmmodule.o
I   n file included from Include/Python.h:111:0,
                    from /tmp/Python-3.2/Modules/_dbmmodule.c:6:
    Include/modsupport.h:27:1: warning: ‘_PyArg_ParseTuple_SizeT’ is an unrecognized format function type [-Wformat=]
    PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
    ^
    gcc -pthread -shared -Wl,-rpath=/opt/python/lib build/temp.linux-x86_64-3.2/tmp/Python-3.2/Modules/_dbmmodule.o -L. -L/opt/python/lib -L/usr/local/lib -lpython3.2m -o build/lib.linux-x86_64-3.2/_dbm.cpython-32m.so
    *** WARNING: renaming "_dbm" since importing it failed: build/lib.linux-x86_64-3.2/_dbm.cpython-32m.so: undefined symbol: dbm_nextkey

    Python build finished, but the necessary bits to build these modules were not found:
    _tkinter           bz2                ossaudiodev
    To find the necessary bits, look in setup.py in detect_modules() for the module's name.


    Failed to build these modules:
    _dbm

    running build_scripts
    copying and adjusting /tmp/Python-3.2/Tools/scripts/pydoc3 -> build/scripts-3.2
    copying and adjusting /tmp/Python-3.2/Tools/scripts/idle3 -> build/scripts-3.2
    copying and adjusting /tmp/Python-3.2/Tools/scripts/2to3 -> build/scripts-3.2
    changing mode of build/scripts-3.2/pydoc3 from 644 to 755

Solution

  • I want to start by saying that what you're trying to do, is an exercise of futility. Check:

    So:

    1. You're trying to "upgrade" from a version that's going out of support at the end of the year (your particular flavor (v2.7.15) released last year) to a version that has been dead for several years

    2. More: you're attempting v3.2.0 which is the very 1st one of that series

    Quickly searching for your error revealed:

    Now, this may or may not be the cause in your case. If it is, there is a fix, but you won't benefit from it because of #2..

    A couple of ideas: