无法 link 到现有的 libopenblas.so.0 DLL
Cannot link to existing libopenblas.so.0 DLL
我需要使用 libpca in C++, which depends on Armadillo, which in turn requires OpenBlas and lapack。
我在 installing/configuring 这些依赖项中遇到了一些问题。
我正在使用 Red Hat 4.8.5-16,希望在 /my/dir/program/
中编写代码和调用包。我没有 sudo 权限。
所有这些包都在 /my/dir/
中下载并解压缩
这是我遵循的步骤:
1. to install OpenBlas
/my/dir/OpenBLAS-0.2.20$ make
/my/dir/OpenBLAS-0.2.20$ make PREFIX=/my/dir/program/
<Step 1 is successful>
2. to install lapack
/my/dir/lapack-3.8.0$ mv make.inc.example make.inc
/my/dir/lapack-3.8.0$ make
<Step 2 is successful>
3. to install Armadillo
/my/dir/armadillo-8.500.0$ cmake . -DCMAKE_INSTALL_PREFIX:PATH=/my/dir/pgrogram/
/my/dir/armadillo-8.500.0$ make
/my/dir/armadillo-8.500.0$ make install
<Step 3 is successful>
4. to compile the example code
/my/dir/armadillo-8.500.0$ cp examples/example1.cpp /my/dir/program
/my/dir/program$ export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64/:../OpenBLAS-0.2.20/:../armadillo-8.500.0/:./lib/:./lib64/:$LD_LIBRARY_PATH ;
/my/dir/program$ g++ example1.cpp -o example1 -O2 -I./include -L./lib -L./lib64 -L../lapack-3.8.0 -L../OpenBLAS-0.2.20 -larmadillo -lopenblas -llapack ;
<There is no warning or error in compiling>
5. to run the example code
/my/dir/program$ export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64/:../OpenBLAS-0.2.20/:../armadillo-8.500.0/:./lib/:./lib64/:$LD_LIBRARY_PATH ;
/my/dir/program$ ./example1
它returns
./example1: error while loading shared libraries: libopenblas.so.0: cannot
open shared object file: No such file or directory
实际上libopenblas.so.0
dll位于./lib/
,我已经添加了DLL路径。
因为我没有 root 权限,所以我不能 yum install openblas.x86_64 openblas-devel.x86_64
按照 this post 的建议。
我该怎么办?
对于 g++/ld 来说找到 libmkl_rt.so
是一回事。
运行 ./example1
是新情况:"location information"必须重复→
export LD_LIBRARY_PATH=/opt/intel.. .. ...:$LD_LIBRARY_PATH && ./example1
请注意 export 命令是临时的:仅对当前 shell 会话有效。当您退出 shell 时,命令被取消。
我需要使用 libpca in C++, which depends on Armadillo, which in turn requires OpenBlas and lapack。
我在 installing/configuring 这些依赖项中遇到了一些问题。
我正在使用 Red Hat 4.8.5-16,希望在 /my/dir/program/
中编写代码和调用包。我没有 sudo 权限。
所有这些包都在 /my/dir/
这是我遵循的步骤:
1. to install OpenBlas
/my/dir/OpenBLAS-0.2.20$ make
/my/dir/OpenBLAS-0.2.20$ make PREFIX=/my/dir/program/
<Step 1 is successful>
2. to install lapack
/my/dir/lapack-3.8.0$ mv make.inc.example make.inc
/my/dir/lapack-3.8.0$ make
<Step 2 is successful>
3. to install Armadillo
/my/dir/armadillo-8.500.0$ cmake . -DCMAKE_INSTALL_PREFIX:PATH=/my/dir/pgrogram/
/my/dir/armadillo-8.500.0$ make
/my/dir/armadillo-8.500.0$ make install
<Step 3 is successful>
4. to compile the example code
/my/dir/armadillo-8.500.0$ cp examples/example1.cpp /my/dir/program
/my/dir/program$ export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64/:../OpenBLAS-0.2.20/:../armadillo-8.500.0/:./lib/:./lib64/:$LD_LIBRARY_PATH ;
/my/dir/program$ g++ example1.cpp -o example1 -O2 -I./include -L./lib -L./lib64 -L../lapack-3.8.0 -L../OpenBLAS-0.2.20 -larmadillo -lopenblas -llapack ;
<There is no warning or error in compiling>
5. to run the example code
/my/dir/program$ export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64/:../OpenBLAS-0.2.20/:../armadillo-8.500.0/:./lib/:./lib64/:$LD_LIBRARY_PATH ;
/my/dir/program$ ./example1
它returns
./example1: error while loading shared libraries: libopenblas.so.0: cannot open shared object file: No such file or directory
实际上libopenblas.so.0
dll位于./lib/
,我已经添加了DLL路径。
因为我没有 root 权限,所以我不能 yum install openblas.x86_64 openblas-devel.x86_64
按照 this post 的建议。
我该怎么办?
对于 g++/ld 来说找到 libmkl_rt.so
是一回事。
运行 ./example1
是新情况:"location information"必须重复→
export LD_LIBRARY_PATH=/opt/intel.. .. ...:$LD_LIBRARY_PATH && ./example1
请注意 export 命令是临时的:仅对当前 shell 会话有效。当您退出 shell 时,命令被取消。