我试图在我的Fedora 19中执行一个库。该程序给出了这个错误:
./TestSoftware: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
因此我检查了我是否有这些库以及它们是否使用ldd和whereis命令正确链接到我的可执行程序,并得到以下结果:
linux-gate.so.1 => (0xf77f8000)
libgtk-x11-2.0.so.0 => not found
libgdk-x11-2.0.so.0 => not found
libatk-1.0.so.0 => not found
libgio-2.0.so.0 => /lib/libgio-2.0.so.0 (0x47596000)
libpangoft2-1.0.so.0 => /lib/libpangoft2-1.0.so.0 (0x47561000)
libgdk_pixbuf-2.0.so.0 => not found
libpangocairo-1.0.so.0 => /lib/libpangocairo-1.0.so.0 (0xf77c3000)
libcairo.so.2 => /lib/libcairo.so.2 (0xf768b000)
libpango-1.0.so.0 => /lib/libpango-1.0.so.0 (0x436d4000)
libfreetype.so.6 => /lib/libfreetype.so.6 (0x439b0000)
libfontconfig.so.1 => /lib/libfontconfig.so.1 (0x438f0000)
libgobject-2.0.so.0 => /lib/libgobject-2.0.so.0 (0x434fa000)
libgmodule-2.0.so.0 => /lib/libgmodule-2.0.so.0 (0x4368a000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x4354c000)
libpthread.so.0 => /lib/libpthread.so.0 (0x434d7000)
libX11.so.6 => /lib/libX11.so.6 (0x43721000)
libm.so.6 => /lib/libm.so.6 (0x4396b000)
libc.so.6 => /lib/libc.so.6 (0x43316000)
libffi.so.6 => /lib/libffi.so.6 (0x43680000)
libdl.so.2 => /lib/libdl.so.2 (0x434f3000)
libz.so.1 => /lib/libz.so.1 (0x438a6000)
libselinux.so.1 => /lib/libselinux.so.1 (0xf7665000)
libresolv.so.2 => /lib/libresolv.so.2 (0x43691000)
libgthread-2.0.so.0 => /lib/libgthread-2.0.so.0 (0x436b0000)
libharfbuzz.so.0 => /lib/libharfbuzz.so.0 (0x4750a000)
libpixman-1.so.0 => /lib/libpixman-1.so.0 (0xf75b8000)
libEGL.so.1 => /lib/libEGL.so.1 (0xf7596000)
libpng15.so.15 => /lib/libpng15.so.15 (0xf7569000)
libxcb-shm.so.0 => /lib/libxcb-shm.so.0 (0xf7565000)
libxcb-render.so.0 => /lib/libxcb-render.so.0 (0xf755b000)
libxcb.so.1 => /lib/libxcb.so.1 (0x43a53000)
libXrender.so.1 => /lib/libXrender.so.1 (0x4392e000)
libXext.so.6 => /lib/libXext.so.6 (0xf7547000)
libGL.so.1 => /lib/libGL.so.1 (0xf74cf000)
librt.so.1 => /lib/librt.so.1 (0xf74c6000)
libexpat.so.1 => /lib/libexpat.so.1 (0x438c5000)
/lib/ld-linux.so.2 (0x432f3000)
libpcre.so.1 => /lib/libpcre.so.1 (0xf7460000)
libgraphite2.so.3 => /lib/libgraphite2.so.3 (0xf7443000)
libX11-xcb.so.1 => /lib/libX11-xcb.so.1 (0xf7440000)
libxcb-dri2.so.0 => /lib/libxcb-dri2.so.0 (0xf743a000)
libxcb-xfixes.so.0 => /lib/libxcb-xfixes.so.0 (0xf7432000)
libxcb-shape.so.0 => /lib/libxcb-shape.so.0 (0xf742d000)
libgbm.so.1 => /lib/libgbm.so.1 (0xf7425000)
libwayland-client.so.0 => /lib/libwayland-client.so.0 (0xf741a000)
libwayland-server.so.0 => /lib/libwayland-server.so.0 (0xf740c000)
libglapi.so.0 => /lib/libglapi.so.0 (0xf73ce000)
libudev.so.1 => /lib/libudev.so.1 (0xf73ba000)
libdrm.so.2 => /lib/libdrm.so.2 (0xf73ad000)
libXau.so.6 => /lib/libXau.so.6 (0x4385d000)
libXdamage.so.1 => /lib/libXdamage.so.1 (0xf73a9000)
libXfixes.so.3 => /lib/libXfixes.so.3 (0xf73a3000)
libxcb-glx.so.0 => /lib/libxcb-glx.so.0 (0xf738a000)
libXxf86vm.so.1 => /lib/libXxf86vm.so.1 (0xf7383000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x47579000)
libgtk-x11-2.0.so: /usr/lib64/libgtk-x11-2.0.so.0 /usr/lib64/libgtk-x11-2.0.so
现在,我想将库链接到我的软件,我尝试使用
导出PATH$PATHPATH=$PATH:/usr/lib64
export path
然而,它没有用
答案 0 :(得分:1)
此:
/lib/ld-linux.so.2 (0x432f3000)
表示您的二进制文件是32位(如果它是64位二进制文件,它将使用/lib64/ld-linux-x86-64.so.2
。)
这些:
libgtk-x11-2.0.so: /usr/lib64/libgtk-x11-2.0.so.0 /usr/lib64/libgtk-x11-2.0.so
是64位库,对你没有任何帮助。您需要安装缺少库的32位版本。在Fedora上,yum install gtk2.i686
应该这样做。另请参阅this thread。
答案 1 :(得分:0)
我的猜测是,当你的程序是32位时,你正在链接到64位版本的库。可以使用file
命令
这里存在多个陷阱,但您需要使用带有相应开关的64位编译器或安装libgtk 32位。