[Distutils] problems with "runtime_library_dirs" option

Berthold Höllmann bhoel@starship.python.net
Sat Oct 14 13:32:01 2000


Hello,

I tried to use the "runtime_library_dirs" option when compiling the
experimental "py-bsddb3-2.2.0" package. I had two problems with it.
First I tried replace "library_dirs" by "runtime_library_dirs", but
that failed, because the linker needed both, -L... and -R... , so I
would suggest to change the method "runtime_library_dir_option" in
unixcompiler.py from

    def runtime_library_dir_option (self, dir):
        return "-R" + dir

to

    def runtime_library_dir_option (self, dir):
        return "-R" + dir + " -L" + dir

The second problem is, that my gcc 2.95.2 does not propagate unknown
options to the linker, so I get:

gcc -shared build/temp.linux-i686-2.0/db.o -L/usr/local/BerkeleyDB.3.1/lib -R/usr/local/BerkeleyDB.3.1/lib -ldb -o build/lib.linux-i686-2.0/dbc.so
gcc: unrecognized option `-R/usr/local/BerkeleyDB.3.1/lib'

The module will be written, but it won't find the specified library,
because the path is not in LD_LIBRARY_PATH.

I see two ways to cure this. Both are unsatisfactory to me. The first
way is to use "ld" instead of "gcc" or "cc" for linking, thus changing
the lines

                   'linker_so'    : ["cc", "-shared"],
                   'linker_exe'   : ["cc"],

to

                   'linker_so'    : ["ld", "-shared"],
                   'linker_exe'   : ["ld"],

but, as I understand it the value for 'linker_so' is eventually taken
from the LDSHARED value in the python Makefile stored in
python?.?/config/Makefile and that value had to be changed. So the
changed value will be overwritten from there.

Second gcc has ha flag for options to be given to the linker, thus 
"-Wl,-R/usr/local/BerkeleyDB.3.1/lib" gives no warning and the wanted
effect, but certainly only when you use gcc, other compiler will give
an error with this. Is there an other way to solve this than to ask
everyone to change python?.?/config/Makefile ?

Greetings

Berthold
-- 
bhoel@starship.python.net / http://starship.python.net/crew/bhoel/
        It is unlawful to use this email address for unsolicited ads
        (USC Title 47 Sec.227). I will assess a US$500 charge for
        reviewing and deleting each unsolicited ad.