使用Armadillo安装Libpca时出现链接错误

时间:2016-08-05 14:34:52

标签: makefile armadillo

我正在尝试在我的OSX El Capitan上安装Libpca库。 我已成功为libpca安装了armadillo库。

我的第一个问题是libpca没有搜索头文件的/ usr / local / include文件夹中的include。我用CPATH env变量解决了这个问题。

现在我仍然无法制作源代码,因为我收到另一个链接错误:

   Making all in src/lib
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
/bin/sh ../../libtool  --tag=CXX   --mode=link g++ -D_THREAD_SAFE  -O2 -std=c++11 -version-info 2:0:1 -no-undefined  -o libpca.la -rpath /usr/local/lib pca.lo utils.lo  
libtool: link: g++ -dynamiclib  -o .libs/libpca.1.dylib  .libs/pca.o .libs/utils.o    -O2   -install_name  /usr/local/lib/libpca.1.dylib -compatibility_version 3 -current_version 3.0 -Wl,-single_module
Undefined symbols for architecture x86_64:
  "_wrapper_ddot_", referenced from:
      void arma::syrk<false, false, false>::apply_blas_type<double, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, double, double) in pca.o
      stats::utils::compute_column_rms(arma::Mat<double> const&) in utils.o
      void arma::syrk<true, false, false>::apply_blas_type<double, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, double, double) in utils.o
  "_wrapper_dgemm_", referenced from:
      void arma::glue_times::apply<double, false, false, false, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double) in pca.o
      void arma::gemm<false, true, false, false>::apply_blas_type<double, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double, double) in pca.o
      void arma::glue_times::apply<double, true, false, false, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double) in utils.o
  "_wrapper_dgemv_", referenced from:
      void arma::glue_times::apply<double, false, false, false, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double) in pca.o
      void arma::glue_times::apply<double, true, false, false, arma::Col<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Col<double> const&, arma::Mat<double> const&, double) in pca.o
      void arma::glue_times::apply<double, false, true, false, arma::Row<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Row<double> const&, arma::Mat<double> const&, double) in pca.o
      void arma::glue_times::apply<double, false, true, false, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double) in pca.o
      void arma::glue_times::apply<double, true, false, false, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double) in utils.o
  "_wrapper_dgetrf_", referenced from:
      double arma::auxlib::det_lapack<double>(arma::Mat<double> const&, bool) in pca.o
  "_wrapper_dsyev_", referenced from:
      bool arma::auxlib::eig_sym<double, arma::Mat<double> >(arma::Col<double>&, arma::Mat<double>&, arma::Base<double, arma::Mat<double> > const&) in pca.o
  "_wrapper_dsyevd_", referenced from:
      bool arma::auxlib::eig_sym_dc<double, arma::Mat<double> >(arma::Col<double>&, arma::Mat<double>&, arma::Base<double, arma::Mat<double> > const&) in pca.o
  "_wrapper_dsyrk_", referenced from:
      void arma::syrk<false, false, false>::apply_blas_type<double, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, double, double) in pca.o
      void arma::syrk<true, false, false>::apply_blas_type<double, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, double, double) in utils.o
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]: *** [libpca.la] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

1 个答案:

答案 0 :(得分:0)

我找到了解决方案:

在配置设置过程中,您应添加以下参数:

./configure --with-armadillo-libdir='/usr/local/lib' --with-armadillo-incdir='/usr/local/include'

显然替换目录,如果它在其他地方。 :)