0

我正在尝试将 python 脚本移植到旧的 Solaris 10 机器上。我从 sunfreeware 下载并安装了所有必需的软件包。它在导入行 (import CGIHTTPServer) 中崩溃并显示以下错误消息:

ImportError:ld.so.1:python:致命:重定位错误:文件/usr/local/lib/python2.6/lib-dynload/_socket.so:符号inet_aton:找不到引用的符号

我尝试使用 libresolve 重新编译,但我不想这样做,所以我将文件 _socket.so 复制到我的 linux 机器并使用 ghex2 进行编辑。我用inet_pton 替换了inet_aton,因为我读到solaris 使用inet_pton。我还在python 文档中读到这两个系统调用是相似的

我将文件 _socket.so 复制回原始目录,备份旧文件并替换为修补过的文件。它正在运行,到目前为止看起来还不错。

你认为python socket模块将来会坏吗?

inet_atoninet_pton返回结构兼容吗?

4

2 回答 2

0

不; inet_aton并且inet_pton不兼容。看看原型:

int inet_aton(const char *, struct in_addr *);
int inet_pton(int, const char *, void *);

完全不同。试图将一个换成另一个只会导致痛苦和痛苦(并且很可能会导致崩溃)。如果您已经这样做并且它似乎正在工作,那可能是因为inet_aton没有调用使用的代码。

于 2012-05-15T01:39:12.307 回答
0

你认为python socket模块将来会坏吗?

Yes. inet-aton and inet_pton do not use the same number and type of arguments. Your code will likely break or at least dysfunction the first time this php function is called. If you (or a library you use) never call it, you are probably safe.

于 2012-05-15T01:55:14.900 回答