当前位置: 技术问答>linux和unix
急:有相应的库文件,但编译的时候还是提示找不到,什么原因?
来源: 互联网 发布时间:2016-11-16
本文导语: 项目在同事的机子上编译没问题,拿到我这边编译就有错误,贴出错误信息: /usr/local/arm/4.2.2-eabi/usr/bin-ccache/../lib/gcc/arm-unknown-linux-gnueabi/4.2.2/../../../../arm-unknown-linux-gnueabi/bin/ld:warning: libz.so.1, needed by /usr/local/arm/4.2....
项目在同事的机子上编译没问题,拿到我这边编译就有错误,贴出错误信息:
/usr/local/arm/4.2.2-eabi/usr/bin-ccache/../lib/gcc/arm-unknown-linux-gnueabi/4.2.2/../../../../arm-unknown-linux-gnueabi/bin/ld:warning: libz.so.1, needed by /usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so, not found (try using -rpath or -rpath-link)/usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so: undefined reference to `inflateReset'
/usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so: undefined reference to `inflateEnd'
/usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so: undefined reference to `inflateInit2_'
/usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so: undefined reference to `inflate'
collect2: ld returned 1 exit status
make: *** [main] 错误
但是在编译器的的lib目录下有库文件
[root@localhost lib]# pwd
/usr/local/arm/4.2.2-eabi/usr/lib
[root@localhost lib]# ll libz*
-rwxr-xr-x 1 root root 80280 3月 23 16:23 libz.a
-rwxrwxrwx 1 root root 76298 3月 24 09:27 libz.so
lrwxrwxrwx 1 root root 21 3月 24 09:28 libz.so.1 -> usr/lib/libz.so.1.2.3
-rwxr-xr-x 1 root root 76298 3月 23 16:23 libz.so.1.2.3
[root@localhost lib]#
这是为什么呢?
/usr/local/arm/4.2.2-eabi/usr/bin-ccache/../lib/gcc/arm-unknown-linux-gnueabi/4.2.2/../../../../arm-unknown-linux-gnueabi/bin/ld:warning: libz.so.1, needed by /usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so, not found (try using -rpath or -rpath-link)/usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so: undefined reference to `inflateReset'
/usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so: undefined reference to `inflateEnd'
/usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so: undefined reference to `inflateInit2_'
/usr/local/arm/4.2.2-eabi//usr/lib/libfreetype.so: undefined reference to `inflate'
collect2: ld returned 1 exit status
make: *** [main] 错误
但是在编译器的的lib目录下有库文件
[root@localhost lib]# pwd
/usr/local/arm/4.2.2-eabi/usr/lib
[root@localhost lib]# ll libz*
-rwxr-xr-x 1 root root 80280 3月 23 16:23 libz.a
-rwxrwxrwx 1 root root 76298 3月 24 09:27 libz.so
lrwxrwxrwx 1 root root 21 3月 24 09:28 libz.so.1 -> usr/lib/libz.so.1.2.3
-rwxr-xr-x 1 root root 76298 3月 23 16:23 libz.so.1.2.3
[root@localhost lib]#
这是为什么呢?
|
你手动指定目录,比如说-with-libpath 之类的。
还有就是可能库链接路径不在/etc/ld.so.conf文件,
还有就是可能库链接路径不在/etc/ld.so.conf文件,
|
gcc参数:-L/usr/local/arm/4.2.2-eabi/usr/lib