New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ctypes.util.find_library does not work under Solaris #49539
Comments
Under Solaris, find_library can not give the correct path. 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 Undefined first referenced |
I tested the command 'gcc -Wl,-t' on Ubuntu, it works fine. Finally I find that gcc does not use GNU ld on Solaris, instead, it uses |
On Solaris, we can use crle to find system library path. Attached a patch to get find_library work with Solaris. |
Above patch failed in a TabError. |
Under Ubuntu 11.04 is the _findLib_gcc used and not a ldconfig method. Why should I install a gcc only to find a dynamic library ? It seems not a well design. The usage of ldconfig, what is more natural at a server in the net than a c compiler. Perhaps it can be changed in the next version, because I can see that on other os th ldconfig method would be preferred. I'm not an python programmer and have not the possibilities to make a regeression test, thats why I can not help. |
Is there still time to get this bug fixed in 2.7.3? I patched my 2.7 ctypes/util.py with the latest version (offset a few lines, but no other problems) and verified that it seems to fix the issue. When running util.py as a main program I see this before running patch: % python /opt/TWWfsw/python27/lib/python2.7/ctypes/util.py After applying the patch: |
New changeset d76fb24d79c3 by Benjamin Peterson in branch '2.7': New changeset 73574de2068b by Benjamin Peterson in branch '3.3': New changeset 640a80adb9df by Benjamin Peterson in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: