Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined symbols for architecture x86_64 using Macos 10.12.6 #210

Open
Kay1794 opened this issue Sep 27, 2017 · 4 comments
Open

Undefined symbols for architecture x86_64 using Macos 10.12.6 #210

Kay1794 opened this issue Sep 27, 2017 · 4 comments
Labels

Comments

@Kay1794
Copy link

Kay1794 commented Sep 27, 2017

Hi,

I met this problem when I built a project using g2o.
screen shot 2017-09-26 at 21 17 23
[100%] Linking CXX executable ../../../bin/sample_app Undefined symbols for architecture x86_64: "g2o::csparse_extension::cs_cholsolsymb(cs_di_sparse const*, double*, cs_di_symbolic const*, double*, int*)", referenced from: g2o::LinearSolverCSparse<Eigen::Matrix<double, 7, 7, 0, 7, 7> >::solve(g2o::SparseBlockMatrix<Eigen::Matrix<double, 7, 7, 0, 7, 7> > const&, double*, double*) in liblsd_slam.a(key_frame_graph.cc.o) "g2o::csparse_extension::writeCs2Octave(char const*, cs_di_sparse const*, bool)", referenced from: g2o::LinearSolverCSparse<Eigen::Matrix<double, 7, 7, 0, 7, 7> >::solve(g2o::SparseBlockMatrix<Eigen::Matrix<double, 7, 7, 0, 7, 7> > const&, double*, double*) in liblsd_slam.a(key_frame_graph.cc.o) "g2o::csparse_extension::cs_chol_workspace(cs_di_sparse const*, cs_di_symbolic const*, int*, double*)", referenced from: g2o::LinearSolverCSparse<Eigen::Matrix<double, 7, 7, 0, 7, 7> >::solveBlocks(double**&, g2o::SparseBlockMatrix<Eigen::Matrix<double, 7, 7, 0, 7, 7> > const&) in liblsd_slam.a(key_frame_graph.cc.o) g2o::LinearSolverCSparse<Eigen::Matrix<double, 7, 7, 0, 7, 7> >::solvePattern(g2o::SparseBlockMatrix<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, std::__1::vector<std::__1::pair<int, int>, std::__1::allocator<std::__1::pair<int, int> > > const&, g2o::SparseBlockMatrix<Eigen::Matrix<double, 7, 7, 0, 7, 7> > const&) in liblsd_slam.a(key_frame_graph.cc.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]: *** [../bin/sample_app] Error 1 make[1]: *** [apps/slam/CMakeFiles/sample_app.dir/all] Error 2 make: *** [all] Error 2
My cmake flags are -DCMAKE_BUILD_TYPE=Release -DBUILD_CSPARSE=ON
Not sure if it is a link problem using g2o on mac

Does anyone have the same problem?

@sjulier
Copy link
Collaborator

sjulier commented Nov 1, 2017

One idea is that you seem to be linking with a static library (liblsd_slam.a). This won't, automatically, pull in all the dependent libraries. Can you run:

make VERBOSE=1

and see if it's trying to link in the csparse libraries at all? If not, you'll have to manually include csparse in the target_link_libraries.

(There is a branch on github which uses new-style cmake options which should hopefully address this problem.)

@niebayes
Copy link
Contributor

  1. pull the latest repo of g2o from Github.
  2. compile it.
  3. find_package()
  4. include_directories()
  5. target_link_libraries() --- NOTICE: G2O has two libraries ${G2O_CORE_LIBRARY} and ${G2O_STUFF_LIBRARY}, instead of the ordinary one ${G2O_LIBRARIES}. You need to specify both of them in this command.

@wbrennan899
Copy link

  • pull the latest repo of g2o from Github.
  • compile it.
  • find_package()
  • include_directories()
  • target_link_libraries() --- NOTICE: G2O has two libraries ${G2O_CORE_LIBRARY} and ${G2O_STUFF_LIBRARY}, instead of the ordinary one ${G2O_LIBRARIES}. You need to specify both of them in this command.

@niebayes Could you please provide a little more detail on how to implement this? Do you think it will solve the issue I just posted? #423

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants