gpt4 book ai didi

c++ - Armadillo : Can not find clapack. h

转载 作者:行者123 更新时间:2023-11-28 00:19:39 25 4
gpt4 key购买 nike

我正在尝试安装 Armadillo link .

但是,make 命令提示“clapack.h” 确实存在于位置/usr/include/atlas/clapack.h。一些帮助将不胜感激。

请注意,如果我将该文件复制到/usr/include/然后制作:

$ sudo cp /usr/include/atlas/clapack.h /usr/include/
$ make

但是,我不太愿意在多个位置制作同一个文件的拷贝。 会不会很危险?

这是我目前所做的:

1) 我下载并压缩了 Armadillo 库。之后,我更改了 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 和 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

最佳答案

cmake 之后运行 make 时我遇到了同样的问题。 当我检查 cmake 输出时它指向错误的 atlas 目录,即它指向 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 文件中添加正确的路径来更正此问题。之后 makemake 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.solibarmadillo.so.4的符号链接(symbolic link)来解决>/usr/lib 目录。

关于c++ - Armadillo : Can not find clapack. h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28191697/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com