[Distutils] Hack for runtime_library_dir_option

Berthold Höllmann hoel at gl-group.com
Thu Sep 11 12:39:06 EDT 2003


Using scipy distutils under Solaris I stumbled over a problem in
distutils unixccompiler. In runtime_library_dir_option the C compiler
name is used to determine whether to a use "-Wl,-R" or "-R". I use the
Sun Fortran compiler together with gcc. Now when linking an extension
module that uses "runtime_library_dirs" and the fortran compiler for
linking I get an error message because of the usage of "-Wl.-R"
instead of "-R". I rewrote the routine a little bit:

    def runtime_library_dir_option(self, dir):
        # XXX Hackish, at the very least.  See Python bug #445902:
        # http://sourceforge.net/tracker/index.php
        #   ?func=detail&aid=445902&group_id=5470&atid=105470
        # Linkers on different platforms need different options to
        # specify that directories need to be added to the list of
        # directories searched for dependencies when a dynamic library
        # is sought.  GCC has to be told to pass the -R option through
        # to the linker, whereas other compilers just know this.
        # Other compilers may need something slightly different.  At
        # this time, there's no way to determine this information from
        # the configuration data stored in the Python installation, so
        # we use this hack.
        linker = self.linker_so
        if sys.platform[:6] == "darwin":
            # MacOSX's linker doesn't understand the -R flag at all
            return "-L" + dir
        elif sys.platform[:5] == "hp-ux":
            return "+s -L" + dir
        elif linker[:3] == "gcc" or linker[:3] == "g++" or linker[:3] == "g77":
          return "-Wl,-R" + dir
            return "-R" + dir

and now it works for me. Shall I issue a but report on this or is my
usage to exotic?

Kind regards

Berthold Höllmann
Germanischer Lloyd AG
CAE Development
Vorsetzen 35
20459 Hamburg
Phone: +49(0)40 36149-7374
Fax: +49(0)40 36149-7320
e-mail: hoel at gl-group.com
Internet: http://www.gl-group.com 
Please notice: We would like to inform you that the e-mail address of Germanischer Lloyd as well as our internet address had been changed to  gl-group.com with effect from 1st March 2003. 
This means that the previous address shortmark at germanlloyd.org will be replaced by shortmark at gl-group.com. From now on the GL homepage can be accessed at the address 'http://www.gl-group.com'. The old addresses remain valid for a transitional period. 
This e-mail contains confidential information for the exclusive attention of the intended addressee. Any access of third parties to this e-mail is unauthorised. Any use of this e-mail by unintended recipients such as copying, distribution, disclosure etc. is prohibited and may be unlawful. When addressed to our clients the content of this e-mail is subject to the General Terms and Conditions of GL's Group of Companies applicable at the date of this e-mail.  
GL's Group of Companies does not warrant and/or guarantee that this message at the moment of receipt is authentic, correct and its communication free of errors, interruption etc.  

More information about the Distutils-SIG mailing list