2

我正在尝试使用 xeus-cling 和 mybinder 创建一个 C++ Jupyter Notebook。我想包括图书馆犰狳,我可以在 Jupyter Notebook 中本地执行此操作,如下所示:

#pragma cling add_library_path("armadillo-10.7.5")
#pragma cling add_include_path("armadillo-10.7.5/include/")
#pragma cling load("armadillo")

#include <armadillo>

using namespace std;
using namespace arma;

mat A(4, 5, fill::randu);
mat B(4, 5, fill::randu);
  
cout << A*B.t() << endl;

文件结构在此 Github 存储库中的位置(您还可以在 README 中找到活页夹链接):https ://github.com/AntonioDaSilva/xeus-cling

但是,犰狳需要 OpenBLAS 和 LAPACK 库,因为我没有管理员权限,所以我无法在 mybinder 上安装它们。我相信这就是我在活页夹中运行上面的代码时收到以下错误的原因:

cling::DynamicLibraryManager::loadLibrary(): libblas.so.3: cannot open shared object file: No such file or directory
IncrementalExecutor::executeFunction: symbol 'dgemv_' unresolved while linking function '_GLOBAL__sub_I_cling_module_6'!
IncrementalExecutor::executeFunction: symbol 'dsyrk_' unresolved while linking function '_GLOBAL__sub_I_cling_module_6'!
IncrementalExecutor::executeFunction: symbol 'ddot_' unresolved while linking function '_GLOBAL__sub_I_cling_module_6'!
IncrementalExecutor::executeFunction: symbol 'dgemm_' unresolved while linking function '_GLOBAL__sub_I_cling_module_6'!

你能帮我弄清楚如何在活页夹中手动包含这些库吗?

4

1 回答 1

1

我怀疑您可以apt.txt根据此处向您的存储库添加一个配置文件,其中包含以下内容:

libblas-dev
liblapack-dev

这可能不是当前要列出的那些,因此您可能需要四处寻找,以找到在当前 linux 系统中使用 apt-get 安装的当前最佳的;但是,就是这样。

在此处的 Jupyter Discourse 论坛apt.txt上的此回复底部查看有关配置文件使用的更多信息。

(当前使用apt.txtinstall.R组合时存在问题,请参见此处。我认为这是特定于 R 安装的;但是,我想我会提到它,以防您在添加时看到问题apt.txt。我怀疑它会在几个天。)


顺便说一句,对于每个看到这个的人。有一个更合适的渠道来获得这类事情的帮助,因为它非常具体,而不是安装到 linux 上。在Jupyter Discourse 社区论坛上,有一个 Binder 的“repo 帮助”类别,您可以发布类似这样的内容,Jupyter/MyBinder 的人会看到并可以交流想法以帮助您进行分类。

于 2022-01-21T17:58:15.977 回答