Broken configure script for solaris in 2.1?

Mark C Favas mark at chem.uwa.edu.au
Tue Apr 24 18:15:32 EDT 2001


jason petrone <jp at NOSPAMdemonseed.net> writes:

>I noticed some old threads about problems compiling python2.1 on solaris.

>My trial license for the Sun Workshop Compiler ran out, so I had to compile
>python with gcc and had the same problems.

>It seems to me that the error is around line 583 of configure.in:

>SunOS/5*)
>  if test "$GCC" = "yes"
>  then LDSHARED='$(CC) -shared'
>  else LDSHARED="ld -G";
>  fi ;;           


>`gcc -shared` doesn't seem to work, but using  `gcc -G` or `ld -G` works fine.

>I assumed that gcc used whatever linker was available on the system, but now
>I'm wondering if it doesn't do linking itself.  If it does, then it would make
>sense that this doesn't work, since it shouldn't be able to link archives
>built with non-gnu ar and ranlib.

>Hope someone knows the right thing to do.  It really would be nice for python
>to compile out of the box on solaris/gcc.

Early on in the alpha cycle there was an issue with Solaris/gcc (the -fPIC 
option to gcc was not being used, leading to errors when linking), but this
has been fixed for some time. 2.1 and its modules compile happily on my Solaris
boxes (Solaris 8, gcc 2.95.2). Have you got the final release of 2.1?
"configure.in" should have around line 637:

if test -z "$CCSHARED"
then
        case $ac_sys_system/$ac_sys_release in
        SunOS*) if test "$GCC" = yes;
                then CCSHARED="-fPIC";
                fi;;

and output from "make" should include lines like the following when building
the shared extensions:

building 'struct' extension
creating build
creating build/temp.solaris-2.8-sun4u-2.1
gcc -g -O2 -Wall -Wstrict-prototypes -fPIC -I. -I/export/home/mark/src/python/CV
S/python/dist/src/./Include -I/usr/local/include -IInclude/ -c /export/home/mark
/src/python/CVS/python/dist/src/Modules/structmodule.c -o build/temp.solaris-2.8
-sun4u-2.1/structmodule.o
creating build/lib.solaris-2.8-sun4u-2.1
gcc -shared build/temp.solaris-2.8-sun4u-2.1/structmodule.o -L/usr/local/lib -o 
build/lib.solaris-2.8-sun4u-2.1/struct.so

The core part of python is compiled by lines like:

gcc -c -g -O2 -Wall -Wstrict-prototypes -I. -I./Include -DHAVE_CONFIG_H  -o Modu
les/python.o Modules/python.c

The library is built like so:

ar cr libpython2.1.a Parser/acceler.o etc, etc, etc

and Python itself linked like so:

gcc   -o python \
                Modules/python.o \
                libpython2.1.a -lpthread -lsocket -lnsl -ldl  -lthread   -lm  

Hope this helps...
--
Email  - mark at chem.uwa.edu.au      ,-_|\                           Mark C Favas
Phone  - +61 9 380 3482           /     \               Department of Chemistry
Fax    - +61 9 380 1005      ---> *_,-._/   The University of Western Australia
                                       v                               Nedlands
Loc    - 31.97 S, 115.81 E                               Western Australia 6009



More information about the Python-list mailing list