I am trying to port a python script to an old Solaris 10 machine. I downloaded and installed all the required packages from sunfreeware. It crashed in the import line (import CGIHTTPServer) with this error message:
ImportError: ld.so.1: python: fatal: relocation error: file /usr/local/lib/python2.6/lib-dynload/_socket.so: symbol inet_aton: referenced symbol not found
I tried to recompile with libresolve, but I didn’t want to do that, so I copied the file _socket.so to my linux machine and edited with ghex2. I replaced the inet_aton with inet_pton because i read that solaris uses inet_pton instead. I’ve also read in python documentation that both system calls are similar.
I copied back the file _socket.so to the original dir, backed up the old one and replaced with the patched one. It’s running and looks OK so far.
Do you think the python socket module will break in the future?
Do inet_aton and inet_pton return structs compatible?
No;
inet_atonandinet_ptonare not compatible. Just look at the prototypes:Totally different. Trying to swap one for the other will only result in pain and suffering (and a crash, most likely). If you’ve done this and it seems to be working, it’s probably because the code which uses
inet_atonisn’t being called.