[mlpack] linker error in mlpack installation

Ryan Curtin gth671b at mail.gatech.edu
Wed Dec 4 11:59:45 EST 2013


On Wed, Dec 04, 2013 at 06:18:54AM +0100, Gilles Barges wrote:
> yes.
> 
> Finally I found the trick I used some month ago :
> simply comment #define ARMA_USE_LAPACK and #define ARMA_USE_BLAS in armadillo_bits/config.hpp
> without using BLAS nor LAPACK, I get no unresolved ! and MLPACK installation goes to the end.
> 
> This is not really a solution, as you may think.
> 
> Usually I can find information in the commands that are issued (what is linked _exactly_),
> but cmake hides the guts - I'm not used with cake.

You can try 'VERBOSE=1 make' and it will list the exact commands that
are being called.

> Finally, it looks like the linker (we talk about mlpack installation)
> were lacking some -lblas, -llapack, -larmadillo … option.

Ideally, libarmadillo.dylib will contain the symbols from libblas and
liblapack, so only -larmadillo is necessary.  But disabling
ARMA_USE_LAPACK and ARMA_USE_BLAS means that Armadillo doesn't have
LAPACK or BLAS support and things like solve() won't work (so some
mlpack executables will terminate with an Armadillo error message
indicating that LAPACK and BLAS aren't available).

> When enabling BLAS & LAPACK & WRAPPING in armadillo includes, making
> mlpack 1.0.7 gives :
> 
> $ make
> Linking CXX shared library ../../lib/libmlpack.dylib
> Undefined symbols for architecture x86_64:
>   "_wrapper_ddot_", referenced from:
>       void arma::syrk_vec<false, false, false>::apply<double, arma::Col<double> >(...) in gaussian_distribution.cpp.o
>       void arma::syrk_vec<false, true, true>::apply<double, arma::Col<double> >(…) in gaussian_distribution.cpp.o
>       void arma::syrk_vec<false, true, false>::apply<double, arma::Col<double> >(...) in gaussian_distribution.cpp.o
>       void arma::syrk_vec<false, false, true>::apply<double, arma::Col<double> >(...) in gaussian_distribution.cpp.o
>       void arma::syrk_vec<true, false, false>::apply<double, arma::Mat<double> >(...) in gaussian_distribution.cpp.o
>       mlpack::math::RandVector(arma::Col<double>&) in lin_alg.cpp.o
>       void arma::syrk_vec<false, false, false>::apply<double, arma::Mat<double> >(...) in lin_alg.cpp.o
>       ...
>   "_wrapper_dgels_", referenced from:
>       bool arma::auxlib::solve_od<double, arma::Gen<arma::Mat<double>, arma::gen_ones_full> >(...) in lars.cpp.o
>       bool arma::auxlib::solve_ud<double, arma::Gen<arma::Mat<double>, arma::gen_ones_full> >(...) in lars.cpp.o
>       bool arma::auxlib::solve_od<double, arma::Glue<arma::Op<arma::Mat<double>, arma::op_htrans>, arma::Col<double>, arma::glue_times> >(...) in linear_regression.cpp.o
>       bool arma::auxlib::solve_ud<double, arma::Glue<arma::Op<arma::Mat<double>, arma::op_htrans>, arma::Col<double>, arma::glue_times> >(...) in linear_regression.cpp.o
> 
> ...and a lot of others...
> 
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> make[2]: *** [lib/libmlpack.1.0.dylib] Error 1

The error "symbol(s) not found for architecture x86_64" suggests to me
that perhaps your LAPACK and BLAS libraries are compiled for a 32-bit
architecture.  You could try running 'file' on libarmadillo.dylib and
liblapack.dylib and libblas.dylib, and that should tell if they are
32-bit shared libraries or 64-bit shared libraries.

-- 
Ryan Curtin       | "And tell the engineers to wipe that stupid smile
ryan at igglybob.com | off his face this time."  - Lou


More information about the mlpack mailing list