【Linux】【编译】libmpc.so.3: cannot open shared object file: No such file or directory

交叉编译zlib出现找不到libmpc.so.3问题
root@Nikola:/source/build# make BOARD_TYPE=rt288x PID=PID zlib_build
make CC=mipsel-buildroot-linux-uclibc-gcc AR=mipsel-buildroot-linux-uclibc-ar LD=mipsel-buildroot-linux-uclibc-ld RANLIB=mipsel-buildroot-linux-uclibc-ranlib -C /source/build/../../../tp-software/develop/open/apps/zlib all
if [ -f zlib-1.2.7/Makefile ]; then \
                make -C zlib-1.2.7 clean; \
        fi
rm -f *.o *.lo *~ \
           example minigzip examplesh minigzipsh \
           example64 minigzip64 \
           infcover \
           libz.* foo.gz so_locations \
           _match.s maketree contrib/infback9/*.o
rm -rf objs
rm -f *.gcda *.gcno *.gcov
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
cd zlib-1.2.7 && ./configure --static
Building static library libz.a version 1.2.7 with mipsel-buildroot-linux-uclibc-gcc.
Checking for off64_t... No.
Checking for fseeko... No.
Checking for strerror... No.
Checking for unistd.h... No.
Checking for stdarg.h... No.
Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf().
Checking for snprintf() in stdio.h... No.
  WARNING: snprintf() not found, falling back to sprintf(). zlib
  can build but will be open to possible buffer-overflow security
  vulnerabilities.
Checking for return value of sprintf()... No.
  WARNING: apparently sprintf() does not return a value. zlib
  can build but will be open to possible string-format security
  vulnerabilities.
Looking for a four-byte integer type... Not found.
make -C zlib-1.2.7
mipsel-buildroot-linux-uclibc-gcc -O -DNO_FSEEKO -DNO_STRERROR -DNO_snprintf -DHAS_sprintf_void -I. -c -o example.o test/example.c
/source/toolchain/buildroot-gcc463/usr/bin/../libexec/gcc/mipsel-buildroot-linux-uclibc/4.6.3/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
看到是检查文件不通过,以为是头文件查找失败,在zlib目录中查看configure的这段代码:
# check for large file support, and if none, check for fseeko()
cat > $test.c < #include
off64_t dummy = 0;
EOF
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
  CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
  SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
  ALL="${ALL} all64"
  TEST="${TEST} test64"
  echo "Checking for off64_t... Yes." | tee -a configure.log
  echo "Checking for fseeko... Yes." | tee -a configure.log
else
  cat $test.c
  echo =======
  echo "$CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c"
  echo +++++++
  echo "Checking for off64_t... No." | tee -a configure.log
  echo >> configure.log
  cat > $test.c < 方法是生成一个临时test.c文件,然后使用交叉编译工具进行编译,然后根据编译结果进行判断。手动编译test.c文件,发现也是失败的,所以问题应该是找不到libmpc.so.3这个文件
查找mpc的库是否已经安装(如果找不到,先用命令apt-cache search libmpc查找相关的包,然后用apt-get install 进行安装)
root@Nikola :/usr/lib# dpkg -l | grep mpc
ii  libmpc-dev                             0.9-4                                               multiple precision complex floating-point library development package
ii  libmpc2                                0.9-4                                               multiple precision complex floating-point library
ii  libmpcdec-dev                          2:0.1~r459-1ubuntu1                                 MusePack decoder - development files
ii  libmpcdec6                             2:0.1~r459-1ubuntu1                                 MusePack decoder - library
root@Nikola :/usr/lib/i386-linux-gnu# 
发现已经安装了libmpc2,超找库所在的目录
root@Nikola :/usr/lib# find . -name "*mpc*" | xargs ls -al
-rw-r--r-- 1 root root  53940 Feb 23  2012 ./gimp/2.0/python/gimpcolor.so
-rw-r--r-- 1 root root 161270 Oct 19  2011 ./i386-linux-gnu/libmpc.a
lrwxrwxrwx 1 root root     15 Oct 19  2011 ./i386-linux-gnu/libmpc.so -> libmpc.so.2.0.0
lrwxrwxrwx 1 root root     15 Dec 19  2014 ./i386-linux-gnu/libmpc.so.2 -> libmpc.so.2.0.0
-rw-r--r-- 1 root root  87972 Oct 19  2011 ./i386-linux-gnu/libmpc.so.2.0.0
没有看到libmpc.so.3的文件,这个应该是个链接文件,需要创建一个,于是进入libmpc.so.2.0.0所在目录i386-linux-gnu创建链接文件
root@Nikola :/usr/lib# ln -s libmpc.so.2.0.0 libmpc.so.3
创建成功,然后重新编译zlib,OK

你可能感兴趣的:(Linux)