3

我已将该项目与 ATLAS 库链接-llapack -lf77blas -lcblas -latlas -lgfortran,它可以成功编译。但是当我使用ldd命令查看依赖库时,输出如下:

    ubuntu@ubuntu-desktop:~/Desktop/qt_output$ldd test_atlas
linux-vdso.so.1 =>  (0x00007fffa99ff000)
libopencv_core.so.2.4 => /home/ubuntu/Documents/3rdparty/lib/libopencv_core.so.2.4 (0x00007fe0577d7000)
libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007fe057477000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe057173000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe056e76000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe056c60000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe0568a1000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe056689000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe05646c000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe056264000)
libcudart.so.5.0 => /usr/local/cuda-5.0/lib64/libcudart.so.5.0 (0x00007fe056009000)
libnpp.so.5.0 => /usr/local/cuda-5.0/lib64/libnpp.so.5.0 (0x00007fe05051c000)
libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007fe0502e0000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe057e31000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe0500db000)
    ubuntu@ubuntu-desktop:~/Desktop/qt_output$ 

为什么它没有 libatlas.so 或 libatlas.a?谢谢。

更新:

   CFLAGS        = -pipe -O2 -Wall -W $(DEFINES)
   CXXFLAGS      = -pipe -std=c++0x -O2 -Wall -W $(DEFINES)
   INCPATH       = -I../../QtSDK/Desktop/Qt/4.8.1/gcc/mkspecs/linux-g++ -I../../Documents/3rdparty/include -I../../Documents/3rdparty/include/opencv2 -I../../Documents/3rdparty/include/opencv -I/usr/local/MATLAB/R2013a/extern/include  -I.
    LINK          = g++
    LFLAGS        = -Wl,-O1 -Wl,-rpath,/home/ubuntu/QtSDK/Desktop/Qt/4.8.1/gcc/lib
    LIBS          = $(SUBLIBS)   -L/home/ubuntu/Documents/3rdparty/lib/ -lopencv_core -lopencv_imgproc -lopencv_highgui -llapack -lf77blas -lcblas -latlas -lgfortran 
4

1 回答 1

3

链接器正在.so系统库路径和用户定义路径(如/home/ubuntu/Documents/3rdparty/lib/)中查找文件。这些.so文件由 -l参数定义。例如-latlas对应于libatlas.so

如果libatlas.so未找到文件,则链接器将查找libatlas.a. 该文件基本上是所有库文件的ar(存档)文件。.o这些.a文件被视为对象,并包含在可执行文件中。所以他们不会出现在ldd命令中。

如果您使用-static参数,g++那么您将强制链接器仅查找.a文件,然后ldd不返回任何内容。

为了建立动态链接,libatlas.so您需要将此文件添加到/home/ubuntu/Documents/3rdparty/lib/.

于 2013-10-04T09:39:51.567 回答