我在 32 位 Fedora Core 9 机器上静态构建了 X11R5 库。然后我构建了一个使用 X11 并静态链接它的应用程序。到目前为止,一切都很好。ldd 报告它是一个静态链接的应用程序。我可以在本地运行它就好了。但是当我将它复制到 64 位 FC9 机器上时,它会失败,如下所示:
assistant.static:xcb_io.c:228:_XSend:断言`!dpy->xcb->request_extra'失败。
中止
当我运行 strace 时,它似乎试图打开 libXfixes.so:
...
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libXfixes.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libXfixes.so", O_RDONLY) = -1 ENOENT (No such file or directory)
munmap(0xf7bf9000, 123447) = 0
open("libXfixes", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 8
fstat64(0x8, 0xff86a9e8) = 0
mmap2(NULL, 123447, PROT_READ, MAP_PRIVATE, 8, 0) = 0xfffffffff7bf9000
close(8) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libXfixes", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libXfixes", O_RDONLY) = -1 ENOENT (No such file or directory)
munmap(0xf7bf9000, 123447) = 0
open("libXfixes.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 8
fstat64(0x8, 0xff86a9e8) = 0
mmap2(NULL, 123447, PROT_READ, MAP_PRIVATE, 8, 0) = 0xfffffffff7bf9000
close(8) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libXfixes.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libXfixes.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
munmap(0xf7bf9000, 123447) = 0
open("libXfixes", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 8
fstat64(0x8, 0xff86a9e8) = 0
mmap2(NULL, 123447, PROT_READ, MAP_PRIVATE, 8, 0) = 0xfffffffff7bf9000
close(8) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libXfixes", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libXfixes", O_RDONLY) = -1 ENOENT (No such file or directory)
munmap(0xf7bf9000, 123447) = 0
write(2, "assistant.static: xcb_io.c:228: "..., 85assistant.static: xcb_io.c:228: _XSend: Assertion `!dpy->xcb->request_extra' failed.
我不明白为什么静态链接的应用程序会尝试打开共享的 X 库。不应该通过静态链接包含运行应用程序所需的所有内容(当然,应用程序进行的任何 Linux 系统调用除外,这些调用需要在外部处理)。
感谢您的任何解释!