我正在尝试安装Armadillo link。
但是,make命令会抱怨“clapack.h” 确实存在于/usr/include/atlas/clapack.h 位置。一些帮助将不胜感激。
注意,如果我将该文件复制到/ usr / include /然后make:
,我可以运行$ sudo cp /usr/include/atlas/clapack.h /usr/include/
$ make
但是,我不习惯在多个位置制作同一文件的副本。 可能有危险吗?
这是我到目前为止所做的:
1)我下载并编制了犰狳库。之后,我改变了CMakeLists.txt中的以下行(我有Lapack,Blas,Atlas):
set(ARMA_USE_LAPACK true)
set(ARMA_USE_BLAS true)
set(ARMA_USE_ATLAS true)
set(ARMA_USE_HDF5_ALT false)
set(ARMA_USE_ARPACK false)
set(ARMA_USE_CXX11_RNG false)
set(ARMA_USE_WRAPPER true )
然后“$cmake .
”成功运行并找到Lapack, Blas and Atlas
。
但是,当我运行“make
”时,它会出现以下错误(代码include_atlas.hpp中标记的第26行):
$ make
Scanning dependencies of target armadillo
[100%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper.cpp.o
In file included from /home/dkumar/Downloads/armadillo-4.600.3/src/wrapper.cpp:10:0:
/home/dkumar/Downloads/armadillo-4.600.3/tmp/include/armadillo_bits/include_atlas.hpp:26:47: fatal error: /usr/include/clapack.h: No such file or directory
#include ARMA_INCFILE_WRAP(ARMA_CLAPACK)
^
compilation terminated.
make[2]: *** [CMakeFiles/armadillo.dir/src/wrapper.cpp.o] Error 1
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
make: *** [all] Error 2
当我查看include_atlas.hpp
时,似乎ARMA_USE_ATLAS
仍设为false:
// Copyright (C) 2008-2011 Conrad Sanderson
// Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#if defined(ARMA_USE_ATLAS)
#if !defined(ARMA_ATLAS_INCLUDE_DIR)
extern "C"
{
#include <cblas.h>
#include <clapack.h>
}
#else
#define ARMA_STR1(x) x
#define ARMA_STR2(x) ARMA_STR1(x)
#define ARMA_CBLAS ARMA_STR2(ARMA_ATLAS_INCLUDE_DIR)ARMA_STR2(cblas.h)
#define ARMA_CLAPACK ARMA_STR2(ARMA_ATLAS_INCLUDE_DIR)ARMA_STR2(clapack.h)
extern "C"
{
#include ARMA_INCFILE_WRAP(ARMA_CBLAS)
#include ARMA_INCFILE_WRAP(ARMA_CLAPACK) // This is line no 26
}
#undef ARMA_STR1
#undef ARMA_STR2
#undef ARMA_CBLAS
#undef ARMA_CLAPACK
#endif
#endif
如果我将ARMA_CLAPACK
替换为"/usr/include/atlas/clapack.h"
,它仍会抱怨:
$ make
Scanning dependencies of target armadillo
[100%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper.cpp.o
In file included from /home/dkumar/Downloads/armadillo-4.600.3/src/wrapper.cpp:10:0:
/home/dkumar/Downloads/armadillo-4.600.3/tmp/include/armadillo_bits/include_atlas.hpp:26:89: fatal error: "/usr/include/atlas/clapack.h": No such file or directory
#include ARMA_INCFILE_WRAP("/usr/include/atlas/clapack.h") // This is line no 26
^
compilation terminated.
make[2]: *** [CMakeFiles/armadillo.dir/src/wrapper.cpp.o] Error 1
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
make: *** [all] Error 2
答案 0 :(得分:3)
我检查make
输出后指向错误的atlas目录时cmake .
cmake
运行ATLAS_INCLUDE_DIR = /usr/include/
时出现同样的问题,即它指向ATLAS_INCLUDE_DIR = /usr/include/atlas
其中应该指向-- Found ATLAS: /usr/lib/libatlas.so
-- Found BLAS: /usr/lib/libblas.so
-- Found LAPACK: /usr/lib/liblapack.so
-- MKL_FOUND = NO
-- ACMLMP_FOUND = NO
-- ACML_FOUND = NO
-- OpenBLAS_FOUND = NO
-- ATLAS_FOUND = YES
-- BLAS_FOUND = YES
-- LAPACK_FOUND = YES
-- ATLAS_INCLUDE_DIR = /usr/include/
-- ARPACK_FOUND = NO
--
-- *** Armadillo wrapper library will use the following libraries:
-- *** ARMA_LIBS = /usr/lib/libatlas.so;/usr/lib/libblas.so;/usr/lib/liblapack.so
。
CmakeCache.txt
我通过在make
文件中添加正确的路径来解决此问题。之后,make install
和g++ -O2 -o example1 example1.cpp -larmadillo
运行良好。
但是在使用
编译示例后运行时出现此错误./example1: error while loading shared libraries: libarmadillo.so.4: cannot open shared object file: No such file or directory
错误是
libarmadillo.so
注意:上述错误可以通过在libarmadillo.so.4
目录中创建/usr/lib
和{{1}}的符号链接来解决。