How can I include OpenBLAS and LAPACK manually in xeus-cling binder?
I'm trying to create a C++ Jupyter Notebook using xeus-cling and mybinder. I wanted to include the library armadillo and I was able to do that locally in a Jupyter Notebook as follows:
#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;
where the file structure is as it's in this Github repository (you can also find the binder link in README): https://github.com/AntonioDaSilva/xeus-cling
However, armadillo requires the libraries OpenBLAS and LAPACK which I cannot install on mybinder since I do not have admin privileges. I believe this is the reason I get the following error when I run the code above in the binder:
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'!
Can you please help me figure out how to include these libraries manually in the binder?
Solution 1:
I suspect you can add an apt.txt
configuration file to your repo with the following contents based on here:
libblas-dev
liblapack-dev
That may not quite be the current ones to list and so you may need to look around more to find the current best ones for installing with apt-get in current linux systems; however, that's the idea.
See more about the apt.txt
configuration file use in the bottom of this reply on the Jupyter Discourse forum here.
(There is currently an issue when using apt.txt
and install.R
in combination, see here. I think this is specific to R installs; however, I thought I'd mention it in case you see issues upon adding apt.txt
. I suspect it would be fixed in a few days.)
By the way, for everyone seeing this. There's a more suitable channel for getting help with this type of thing as it is very specific and not general to installing onto linux. At the Jupyter Discourse community forum there's a category of 'repo help' for Binder that you can post things like this and Jupyter/MyBinder folks will see and can exchange ideas to help get you sorted.