[New-bugs-announce] [issue5289] ctypes.util.find_library does not work under Solaris

Ke Wang report at bugs.python.org
Tue Feb 17 09:17:15 CET 2009


New submission from Ke Wang <ke.wang at sun.com>:

Under Solaris, find_library can not give the correct path.
Solaris does not have /sbin/ldconfig, so _findLib_gcc is used.

def _findLib_gcc(name):
        expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
        fdout, ccout = tempfile.mkstemp()
        os.close(fdout)
        cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; else CC=cc; fi;' \
              '$CC -Wl,-t -o ' + ccout + ' 2>&1 -l' + name
        try:
            f = os.popen(cmd)
            trace = f.read()
            f.close()
        finally:
            try:
                os.unlink(ccout)
            except OSError, e:
                if e.errno != errno.ENOENT:
                    raise
        res = re.search(expr, trace)
        if not res:
            return None
        return res.group(0)

I executed these code manually, and after ‘trace = f.read()‘, I printed
the content of 'trace', which was just as following:

Undefined			first referenced
 symbol  			    in file
main                                /usr/lib/crt1.o
ld: fatal: symbol referencing errors. No output written to /tmp/tmpYN85Fm
collect2: ld returned 1 exit status

----------
assignee: theller
components: ctypes
messages: 82303
nosy: kewang, theller
severity: normal
status: open
title: ctypes.util.find_library does not work under Solaris
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5289>
_______________________________________


More information about the New-bugs-announce mailing list