Celeb Glow
updates | March 20, 2026

How to install mlpack successfully?

Currently, I am trying to install mlpack to Ubuntu 12.04. When I executed make install, I got the following error.

[ 0%] Built target mlpack_headers
Linking CXX shared library ../../lib/libmlpack.so
/usr/bin/ld: /usr/local/lib/libboost_program_options.a(cmdline.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libboost_program_options.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [lib/libmlpack.so.1.0] Error 1
make[1]: *** [src/mlpack/CMakeFiles/ Error 2
make: *** [all] Error 2

How can I fix this error and install mlpack successfully?

1

2 Answers

I had the same problem. I re-installed every dependency using

sudo apt-get install libboost-math-dev libboost-program-options-dev libboost-random-dev libboost-test-dev libxml2-dev liblapack-dev libblas-dev libarmadillo-dev

Inside the mlpack folder: execute following command

mkdir build
cd build
cmake ../
makes
sudo make install

After that to run executables set the path using this Link..... Worked for me.

recompile your boost with -fPIC e.g ./bjam cxxflags=-fPIC --without-python --without-graph_parallel --without-graph --without-wave install

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy