Search code examples
pythonpython-3.xcompiler-errorslinker-errorssolaris

Compiling python 3.7 on Solaris 11.2 fails at link stage


I am trying to compile python 3.7 on solaris 11.2. The compiling seems to be error free until the linking phase. I do not have root access.

I have tried the following:

  ./configure --prefix=/appgroup/appuser
  make

  ./configure --prefix=/appgroup/appuser --enable-shared
  make

Both error out with:

gcc    -o python Programs/python.o -Wl,-R,/appgroup/appuser/scripts/lib -L. -lpython3.7m -lsocket -lnsl -lintl -ldl -lsendfile   -lm  
Undefined                       first referenced
 symbol                             in file
libintl_bind_textdomain_codeset     ./libpython3.7m.so
libintl_gettext                     ./libpython3.7m.so
libintl_textdomain                  ./libpython3.7m.so
libintl_dcgettext                   ./libpython3.7m.so
libintl_bindtextdomain              ./libpython3.7m.so
libintl_dgettext                    ./libpython3.7m.so
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `python'

I think the error is based on the conflict between /usr/include/libintl.h and /usr/local/include/libintl.h, because the one in /usr/local/include had those variables, while /usr/include does not.

I tried to set CFLAGS="-I/usr/include -I/usr/local/include" and CFLAGS="-I/usr/local/include -I/usr/include", but the result was the same.

Any ideas?


Solution

  • It is now working. Thank you paulsm4.

    make clean
    ./configure --prefix=/apps/myapp/scripts CFLAGS="-I/usr/local/include -I/usr/include" 
    cp pyconfig.h pyconfig.h-1018-1200
    vim +/INTL pyconfig.h                                    
    
    diff pyconfig.h pyconfig.h-1018-1200
        568c568
        < /* #undef HAVE_LIBINTL_H  */
        ---
        > #define HAVE_LIBINTL_H 1
        1463c1463
        < /* #undef WITH_LIBINTL */ 
        ---
        > #define WITH_LIBINTL 1
    
    make 
    make test 
    ... stopped test with Ctrl-C 
    ... (this machine is in a production environment without internet access)
    
    make install  
    python3 -V
        Python 3.7.0
    

    There are a couple of issues still, but it does load.