犰狳:找不到 clapack.h
Armadillo : Can not find clapack.h
我正在尝试安装 Armadillo link。
但是,make 命令 抱怨 "clapack.h" 确实存在于位置 /usr/include/atlas/clapack.h。一些帮助将不胜感激。
注意,如果我将该文件复制到 /usr/include/ 然后制作:
,我 可以 运行
$ sudo cp /usr/include/atlas/clapack.h /usr/include/
$ make
但是,我不太愿意在多个位置制作同一个文件的副本。 会不会很危险?
这是我目前所做的:
1) 我下载并 tar 犰狳库。之后,我在 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 .
”运行s 成功并找到 Lapack, Blas and Atlas
。
但是,当我 运行 "make
" 它给出了以下错误( 代码中标记的第 26 行 include_atlas.hpp):
$ 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
在 cmake .
之后 运行ning make
时我遇到了同样的问题,当我检查 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
运行 很好。
但是我在使用
编译示例后 运行ning 时遇到了这个错误
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
注意:上面的错误可以通过在/usr/lib
中创建libarmadillo.so
和libarmadillo.so.4
的符号link来解决目录。
我正在尝试安装 Armadillo link。
但是,make 命令 抱怨 "clapack.h" 确实存在于位置 /usr/include/atlas/clapack.h。一些帮助将不胜感激。
注意,如果我将该文件复制到 /usr/include/ 然后制作:
,我 可以 运行$ sudo cp /usr/include/atlas/clapack.h /usr/include/
$ make
但是,我不太愿意在多个位置制作同一个文件的副本。 会不会很危险?
这是我目前所做的:
1) 我下载并 tar 犰狳库。之后,我在 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 .
”运行s 成功并找到 Lapack, Blas and Atlas
。
但是,当我 运行 "make
" 它给出了以下错误( 代码中标记的第 26 行 include_atlas.hpp):
$ 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
在 cmake .
之后 运行ning make
时我遇到了同样的问题,当我检查 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
运行 很好。
但是我在使用
编译示例后 运行ning 时遇到了这个错误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
注意:上面的错误可以通过在/usr/lib
中创建libarmadillo.so
和libarmadillo.so.4
的符号link来解决目录。