【背景】
因为毕设需要用到机器学习的C++ 库在 shogun 和mlpack 之间选择,选择了mlpack,主要原因是mlpack 号称可扩展,所以尝试安装了mlpack .
安装版本:
mlpack 2.1.1
Ubuntu14.04.5
kernel version: 4.4.0-66-generic (可以通过sudo apt-get dist-upgrade 更新内核,重启;在开机)
g++ 4.8.4
cmake version 2.8.12.2
依赖条件
Armadillo >= 4.200.0 (with LAPACK support)
Boost (math_c99, program_options, serialization, unit_test_framework, heap) >= 1.49
【参考链接】
http://www.mlpack.org/docs/mlpack-2.1.1/doxygen.php?doc=build.html#build
主要参考这里,这里记录下安装遇到的坑
1.执行cmake ../ 时
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1131 (message):
Unable to find the requested Boost libraries.
solutions:执行sudo apt-get update(这个经常会遇到什么校验码错误的问题,估计是当地网络缓存出错造成的)
再次安装依赖库即可
2.执行cmake ../ 时
CMake Warning at CMakeLists.txt:218 (message):
This is a 64-bit system, but Armadillo was compiled without 64-bit index
support. Consider recompiling Armadillo with ARMA_64BIT_WORD to enable
64-bit indices (large matrix support). mlpack will still work without
ARMA_64BIT_WORD defined, but will not scale to matrices with more than 4
billion elements.
solutions:
这个其实不用管也可以的,4 billion 个元素的矩阵想必应该够用的,但是人生充满意外,就是要把他解决了
重新编译安装Armadilo(一个C++线性代数运算的库)
在官网下载了Armadilo7.8
http://arma.sourceforge.net/download.html
【参考链接】
http://blog.csdn.net/kxuehen/article/details/50321211 (参考依赖库安装方法、在第4步使能宏ARMA_64BIT_WORD 即可,如果是g++ 11编译的话,不使能也会开启这个宏的)
直接在根目录下执行.configure,make, make install 即可,不要新建build,在build 下再执行
http://blog.csdn.net/kxuehen/article/details/49306195(测试)
【环境变量】
记录安装的环境变量,.so库目录、头文件目录、bin 目录
添加环境变量(以后遇到相关问题再把环境变量添加完全):
# added by xxx for mlpack
export PATH="/usr/local/bin:$PATH" #bin
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH #.so库目录