在ubuntu 16.04

时间:2018-03-22 18:09:58

标签: c++ compilation armadillo

我对编程很新。我已经使用随库提供的安装文件中的安装说明安装了armadillo库。

我使用以下命令安装了cmake LAPACK和BLAS

sudo apt-get install cmake
sudo apt-get install liblapack-dev
sudo apt-get install libblas-dev 

之后我使用以下命令安装

cmake .
make 
sudo make install

然后在编译示例程序后我收到此错误

g++ example1.cpp -o example1 -O2 -larmadillo -llapack -lblas

ERROR:

/usr/bin/ld: warning: libmkl_rt.so, needed by /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libhdf5.so.101, needed by /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Fopen'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_INT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5check_version'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Ovisit'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Ldelete'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dget_space'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Gcreate2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Eget_auto2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_LLONG_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tinsert'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_SHORT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dread'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_UCHAR_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tequal'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Sget_simple_extent_ndims'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Fis_hdf5'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Fcreate'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Screate_simple'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_DOUBLE_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Sget_simple_extent_dims'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Lexists'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dopen2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tcopy'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dget_type'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_ULLONG_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_UINT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_FLOAT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Eset_auto2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_LONG_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Sclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5open'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_SCHAR_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Gopen2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_USHORT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dwrite'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tcreate'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_ULONG_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Fclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Gclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dcreate2

1 个答案:

答案 0 :(得分:0)

解决

我的主目录中安装了anaconda库。因此,cmake正在检测该文件夹中的intel MKL和其他库。我已更新我的LD_LIBRARY_PATH变量以包含该文件夹,问题已解决。

如果您在文件夹

中安装了anaconda,只需将以下行添加到/.bashrc即可
text = "abcdef"
for idx,c in enumerate(text):        
    print(idx,c)