天儿真好,
在64位RHEL5盒子上我们需要安装我们的32位应用程序。由于某些原因,我们需要使用gcc 4.0.3,所以我尝试首先在目标机器上安装该版本,就像我在32位目标平台上做了一千次。
然而,这一次,我遇到了问题。我已经引导并将gcc 4.0.3转换为路径,让我们说/ foo。像我一样,我将LD_LIBRARY_PATH设置为指向包含共享库的目录:
$ echo $LD_LIBRARY_PATH /foo/lib:/foo/lib/gcc/x86_64-unknown-linux-gnu/lib64:/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3:/lib64
这些目录中确实存在必要的库:
$ ls /foo/lib/gcc/x86_64-unknown-linux-gnu/lib64 libgcc_s.so libgcc_s.so.1 $ ls /foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3 32 crtendS.o libgcov.a libmudflap.so.0.0.0 libmudflapth.so.0.0.0 libstdc++.so.6.0.7 crtbegin.o include libmudflap.a libmudflapth.a libstdc++.a libsupc++.a crtbeginS.o install-tools libmudflap.la libmudflapth.la libstdc++.la libsupc++.la crtbeginT.o libgcc.a libmudflap.so libmudflapth.so libstdc++.so crtend.o libgcc_eh.a libmudflap.so.0 libmudflapth.so.0 libstdc++.so.6
但是,如果我尝试创建一个简单的程序,ld找不到libgcc_s:
$ gcc-4.0 t.cc /foo/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit status
为什么找不到libgcc_s.so库?
任何帮助表示赞赏!
的Stefan
答案 0 :(得分:1)
您的文件夹似乎是/ foo / lib / gcc / x86_64-unknown-linux-gnu / lib64,其中未包含libgcc_s.so。为了实验,请执行以下操作:
gcc-4.0 -v t.cc -L / foo / lib / gcc / x86_64-unknown-linux-gnu / lib64
答案 1 :(得分:0)
$ gcc-4.0 -v t.cc Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.0.3/configure --prefix=/foo --program-suffix=-4.0 --enable-version-specific-runtime-libs --enable-languages=c,c++ --with-gnu-as --with-gnu-ld Thread model: posix gcc version 4.0.3 /foo/i686-pc-linux-gnu/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.0.3/cc1plus -quiet -v -iprefix /foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/ -D_GNU_SOURCE t.cc -quiet -dumpbase t.cc -mtune=k8 -auxbase t -version -o /tmp/ccDiWiMk.s ignoring nonexistent directory "/foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../x86_64-unknown-linux-gnu/include" ignoring duplicate directory "/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3/include/c++" ignoring duplicate directory "/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3/include/c++/x86_64-unknown-linux-gnu" ignoring duplicate directory "/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3/include/c++/backward" ignoring duplicate directory "/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3/include" ignoring nonexistent directory "/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include search starts here: /foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/include/c++ /foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/include/c++/x86_64-unknown-linux-gnu /foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/include/c++/backward /foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/include /usr/local/include /foo/include /usr/include End of search list. GNU C++ version 4.0.3 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.1.2 20080704 (Red Hat 4.1.2-46). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../x86_64-unknown-linux-gnu/bin/as -V -Qy -o /tmp/ccAemlDJ.o /tmp/ccDiWiMk.s GNU assembler version 2.19.1 (x86_64-unknown-linux-gnu) using BFD version (GNU Binutils) 2.19.1 /foo/i686-pc-linux-gnu/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.0.3/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/crtbegin.o -L/foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3 -L/foo/i686-pc-linux-gnu/bin/../lib/gcc -L/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3 -L/foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../x86_64-unknown-linux-gnu/lib -L/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../x86_64-unknown-linux-gnu/lib -L/foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../lib64 -L/foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../.. -L/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../lib64 -L/foo/lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 /tmp/ccAemlDJ.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/crtend.o /usr/lib/../lib64/crtn.o /foo/i686-pc-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.0.3/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit status