Произошла ошибка на здании Crystax в Церере - PullRequest
0 голосов
/ 28 апреля 2018

Когда я использовал Crystax ndk для сборки Ceres-Solver, я изменил

APP_STL := c++_static

до

APP_STL := gnustl_static

для gnustl_static совместим с OpenCV на android, затем у меня есть libceres.a, я скопировал его в папку jni проекта и добавил следующую строку в Applications.mk

Затем я запускаю ndk-build с помощью Crystax ndk (я добавил папку Crystax в системный PATH)

LOCAL_LDLIBS += libceres.a
LOCAL_SRC_FILES += Test.cpp

часть test.cpp с использованием Ceres выглядит следующим образом:

struct CostFunctor {
   template <typename T>
   bool operator()(const T* const x, T* residual) const {
     residual[0] = T(10.0) - x[0];
     return true;
   }
};

int main(int argc, char** argv) {

  double x = 0.5;
  const double initial_x = x;

  Problem problem;

  CostFunction* cost_function =
      new AutoDiffCostFunction<CostFunctor, 1, 1>(new CostFunctor);
  problem.AddResidualBlock(cost_function, NULL, &x);

  Solver::Options options;
  options.minimizer_progress_to_stdout = true;
  Solver::Summary summary;
  Solve(options, &problem, &summary);

  return 0;
}

Тогда все пойдет неправильно (тем более выдается сообщение об ошибке):

/home/panxiaoyu/ceres-solver/jni/../internal/ceres/miniglog/glog/logging.h:174: error: undefined reference to 'std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream(std::_Ios_Openmode)'

/opt/crystax-ndk/sources/cxx-stl/gnu-libstdc++/5/include/bits/basic_string.h:544: error: undefined reference to 'std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream()'

/opt/crystax-ndk/sources/cxx-stl/gnu-libstdc++/5/include/sstream:766: error: undefined reference to 'std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const'

Где не так?

Мой ndk-конфиг неверен или Crystax имеет ошибку?

...