classification
Title: ctypes on Solaris
Type: Stage:
Components: Installation Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: akineko, loewis, nnorwitz, theller
Priority: normal Keywords:

Created on 2007-08-20 09:23 by akineko, last changed 2007-09-14 20:07 by theller. This issue is now closed.

Files
File name Uploaded Description Edit
solaris.patch theller, 2007-09-03 15:25
solaris-2.patch theller, 2007-09-05 19:32
Messages (9)
msg32668 - (view) Author: Aki (akineko) Date: 2007-08-20 09:23
This is not really a bug.
ctypes uses 'objdump', which is not available by default.
(There are reasons not to install binutil on Solaris)

There is no 'objdump' but Solaris has 'elfdump', instead.

ctypes.util.py can use 'elfdump' instead of 'objdump'.

#        cmd = "objdump -p -j .dynamic 2>/dev/null " + f
        cmd = "elfdump -d 2>/dev/null " + f

#        res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
        res = re.search(r'\sSONAME\s+([^\s]+)\s+([^\s]+)', os.popen(cmd).read())        if not res:
            return None
        return res.group(2) # <<<--- 

//

./Modules/_ctypes/libffi/config.guess
also uses objdump so that file probably needs to be updated as well.

Thank you for your attention.
msg32669 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-08-21 05:59
Thomas, could you take a look?
msg55621 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2007-09-03 15:25
This is an experimental patch (solaris.patch).  Can you please proofread
it and try it out on the solaris machine?
msg55623 - (view) Author: Aki (akineko) Date: 2007-09-03 16:55
Hello Thomas,

Thank you for creating the patch.
Unfortunately, it didn't work.
(I rerun the whole installation process)

You used the following to check if the os is Solaris:

if sys.platform.startswith("solaris"):

Under Solaris 2.x sys.platform returns "sunos5".
You could use ...startswith("sunos") but things may be different under
"sunos6" so I usually prefer to use sys.platform == "sunos5".

After fixing this, my application with ctypes works okay.

I'm happy to try out if you create another patch.

Thank you,
Aki-
msg55664 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-09-05 17:47
The patch looks fine to me (with the addition of checking for sunos5
instead). A few things to consider:
- you could check the system at import time, rather than call time, of
_get_soname()
- notice that the file is located in /usr/ccs/bin, which may not be
  in everybody's path. So using an explicit path would be better.
- Sun itself recommend dump(1) instead of elfdump(1) for use 
  in "shell scripts". "/usr/ccs/bin/elfdump -Lpv /lib/libc.so.1"
  gives output including the line "[6]\tSONAME          libc.so.1\n"
msg55670 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2007-09-05 19:32
Martin, here is a patch (solaris-2.patch), hopefully according to your
comments.
msg55861 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2007-09-12 19:20
Can someone please test the patch and report back?  -- Thanks
msg55877 - (view) Author: Aki (akineko) Date: 2007-09-13 06:23
Sorry for not having done this earlier.
I thought this was already closed ...

I used your updated patch and installed the Python 2.5.1 from scratch.
It worked without any problem except python-config issue, which I have
reported in another case [issue1095].
msg55919 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2007-09-14 20:07
Fixed in SVN: trunk rev 58155, release25-maint rev 58158.
Thanks.
History
Date User Action Args
2007-09-14 20:07:16thellersetstatus: open -> closed
resolution: fixed
messages: + msg55919
2007-09-13 06:23:08akinekosetmessages: + msg55877
2007-09-12 19:20:00thellersetmessages: + msg55861
2007-09-05 19:32:47thellersetfiles: + solaris-2.patch
messages: + msg55670
2007-09-05 17:47:28loewissetnosy: + loewis
messages: + msg55664
2007-09-03 16:55:46akinekosetmessages: + msg55623
2007-09-03 15:25:44thellersetfiles: + solaris.patch
messages: + msg55621
2007-08-20 09:23:41akinekocreate