Necessary Python stuff on Sun

P. Alejandro Lopez-Valencia dradul at yahoo.com
Mon Sep 3 18:30:49 EDT 2001


In article <VR_i7.2756$aC1.287578 at newsread1.prod.itd.earthlink.net>, 
writeson at earthlink.net says...
>Hi,
>
>For various reasons I put the Python source tar file in /usr/local/bin on my
>Sun Solaris 2.6 machine in order to compile it and get it running. Now I've
>got it running and I'd like to move the necessary libaries and runtime stuff
>to another machine. First off can anyone tell me if putting the source tar
>file in /usr/local/bin was a bad idea and if so why? If it was a bad idea,
>what should I have done to compile and install it? Now that it's done, how
>can I extract just the stuff I need to run Python on another Solaris 2.6
>machine?
>
>Thanks in advance,
>Doug
>

As already said, the right place is /usr/local/src, or /opt/src if you 
have lots of space in the /opt partition (usually not true).

I do have a tip that addresses previous postings at the end of July 
(can't find them in my news cache :) as I tried to compile my own version 
of Python instead of using ActiveState's, having built the latest gcc 
3.01 and all ;). I was bitten hard.

When compiling dynamic extensions that extract objects from static 
libraries compiled with gcc (or SunPro cc, be it  WorkShop or Forte), the 
linker will fail nastily. The problem is that the compiler will not make 
dynamically reallocatable objects in the libraries unless you explicitly 
say so! This is particularly important when compiling shared extensions 
and forcing a link to static libraries in order to bypass the limitations 
of the dynamic loader (Python extensions, some Perl XSs). The solution is 
to add the -fPIC flag to gcc or the -KPIC flag to SunPro cc. Thus in an 
ultrasparc, the basic compiler flags are:

gcc:  -fPIC -Wa,-xarch=v8plus -mcpu=v9

cc: -KPIC -xarch=v8plus -xtarget=ultra

This means you will have to recompile all static libraries that you want 
to link into Python extensions, before compiling Python using the same 
flags. I ran into this problem with OpenSSL, gdbm, GTK, wxWindows, 
readline, BerkeleyDB and a few others. Thus, prepare yourself for a field 
day or leave everything in cron and go out for good chinese food and come 
back in the morning.

Cheers!

-- 
Alejandro Lopez-Valencia

Kenkon Itteki       ---       Heaven and Earth at one stroke




More information about the Python-list mailing list