gaoxiang12 / slambook

MIT License
6.84k stars 3.26k forks source link

ch6/g2o_curve_fitting/CMakeLists.txt issue #52

Open TirelessTinkerer opened 6 years ago

TirelessTinkerer commented 6 years ago

After checking cmake_modules/FindG2O.cmake, I think the following part of the CMakeLists.txt of g2o_curve_fitting should be adjusted:

  1. ${G2O_INCLUDE_DIRS} should be ${G2O_INCLUDE_DIR}, which is a variable generated by FindG2O.
  2. target_link_libraries( curve_fitting 
    ${OpenCV_LIBS}
    g2o_core g2o_stuff
    )

    should be

    target_link_libraries( curve_fitting 
    ${OpenCV_LIBS}
    ${G2O_CORE_LIBRARY} ${G2O_STUFF_LIBRARY}
    )

    Without modifying 1, I can still build the code without problem. It's because /usr/local/include is in my default header search path. Without modifying 2, I got the following error when run curve_fitting (since my library load path does not contain /usr/local/lib )

    error while loading shared libraries: libg2o_core.so: cannot open shared object file: No such file or directory

Will-panda commented 6 years ago

Yes,u are right . It's helping .thank u !

Krasaa commented 6 years ago

thx!

hanzheteng commented 4 years ago

From https://github.com/gaoxiang12/slambook/issues/125#issuecomment-603575294, to temporarily add the search path, the following way also works:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib