xdspacelab/openvslam

Linker failed

pfeatherstone opened this issue · 1 comments

Linker fails with the following error:

[88/98] Linking CXX shared library lib/libopenvslam.so
FAILED: lib/libopenvslam.so 
: && /usr/bin/c++ -fPIC -Wall -Wextra -mtune=native -mtune=native -O3 -DNDEBUG -O3 -ffast-math   -shared -Wl,-soname,libopenvslam.so -o lib/libopenvslam.so src/openvslam/CMakeFiles/openvslam.dir/config.cc.o src/openvslam/CMakeFiles/openvslam.dir/system.cc.o src/openvslam/CMakeFiles/openvslam.dir/tracking_module.cc.o src/openvslam/CMakeFiles/openvslam.dir/mapping_module.cc.o src/openvslam/CMakeFiles/openvslam.dir/global_optimization_module.cc.o src/openvslam/CMakeFiles/openvslam.dir/camera/base.cc.o src/openvslam/CMakeFiles/openvslam.dir/camera/perspective.cc.o src/openvslam/CMakeFiles/openvslam.dir/camera/fisheye.cc.o src/openvslam/CMakeFiles/openvslam.dir/camera/equirectangular.cc.o src/openvslam/CMakeFiles/openvslam.dir/data/common.cc.o src/openvslam/CMakeFiles/openvslam.dir/data/frame.cc.o src/openvslam/CMakeFiles/openvslam.dir/data/keyframe.cc.o src/openvslam/CMakeFiles/openvslam.dir/data/landmark.cc.o src/openvslam/CMakeFiles/openvslam.dir/data/graph_node.cc.o src/openvslam/CMakeFiles/openvslam.dir/data/camera_database.cc.o src/openvslam/CMakeFiles/openvslam.dir/data/map_database.cc.o src/openvslam/CMakeFiles/openvslam.dir/data/bow_database.cc.o src/openvslam/CMakeFiles/openvslam.dir/data/frame_statistics.cc.o src/openvslam/CMakeFiles/openvslam.dir/feature/orb_params.cc.o src/openvslam/CMakeFiles/openvslam.dir/feature/orb_extractor.cc.o src/openvslam/CMakeFiles/openvslam.dir/feature/orb_extractor_node.cc.o src/openvslam/CMakeFiles/openvslam.dir/initialize/base.cc.o src/openvslam/CMakeFiles/openvslam.dir/initialize/perspective.cc.o src/openvslam/CMakeFiles/openvslam.dir/initialize/bearing_vector.cc.o src/openvslam/CMakeFiles/openvslam.dir/io/trajectory_io.cc.o src/openvslam/CMakeFiles/openvslam.dir/io/map_database_io.cc.o src/openvslam/CMakeFiles/openvslam.dir/match/area.cc.o src/openvslam/CMakeFiles/openvslam.dir/match/bow_tree.cc.o src/openvslam/CMakeFiles/openvslam.dir/match/fuse.cc.o src/openvslam/CMakeFiles/openvslam.dir/match/projection.cc.o src/openvslam/CMakeFiles/openvslam.dir/match/robust.cc.o src/openvslam/CMakeFiles/openvslam.dir/match/stereo.cc.o src/openvslam/CMakeFiles/openvslam.dir/module/initializer.cc.o src/openvslam/CMakeFiles/openvslam.dir/module/relocalizer.cc.o src/openvslam/CMakeFiles/openvslam.dir/module/frame_tracker.cc.o src/openvslam/CMakeFiles/openvslam.dir/module/keyframe_inserter.cc.o src/openvslam/CMakeFiles/openvslam.dir/module/two_view_triangulator.cc.o src/openvslam/CMakeFiles/openvslam.dir/module/local_map_cleaner.cc.o src/openvslam/CMakeFiles/openvslam.dir/module/local_map_updater.cc.o src/openvslam/CMakeFiles/openvslam.dir/module/loop_detector.cc.o src/openvslam/CMakeFiles/openvslam.dir/module/loop_bundle_adjuster.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/pose_optimizer.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/local_bundle_adjuster.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/transform_optimizer.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/graph_optimizer.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/global_bundle_adjuster.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/landmark_vertex.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/landmark_vertex_container.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/se3/shot_vertex.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/se3/shot_vertex_container.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/se3/perspective_pose_opt_edge.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/se3/perspective_reproj_edge.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/se3/equirectangular_pose_opt_edge.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/se3/equirectangular_reproj_edge.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/sim3/shot_vertex.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/sim3/graph_opt_edge.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/sim3/transform_vertex.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/sim3/backward_reproj_edge.cc.o src/openvslam/CMakeFiles/openvslam.dir/optimize/g2o/sim3/forward_reproj_edge.cc.o src/openvslam/CMakeFiles/openvslam.dir/publish/frame_publisher.cc.o src/openvslam/CMakeFiles/openvslam.dir/publish/map_publisher.cc.o src/openvslam/CMakeFiles/openvslam.dir/solve/common.cc.o src/openvslam/CMakeFiles/openvslam.dir/solve/homography_solver.cc.o src/openvslam/CMakeFiles/openvslam.dir/solve/fundamental_solver.cc.o src/openvslam/CMakeFiles/openvslam.dir/solve/essential_solver.cc.o src/openvslam/CMakeFiles/openvslam.dir/solve/pnp_solver.cc.o src/openvslam/CMakeFiles/openvslam.dir/solve/sim3_solver.cc.o src/openvslam/CMakeFiles/openvslam.dir/util/converter.cc.o src/openvslam/CMakeFiles/openvslam.dir/util/image_converter.cc.o src/openvslam/CMakeFiles/openvslam.dir/util/random_array.cc.o src/openvslam/CMakeFiles/openvslam.dir/util/stereo_rectifier.cc.o  -Wl,-rpath,/usr/local/lib:  /usr/local/lib/libyaml-cpp.a  /usr/local/lib/libopencv_calib3d.so.4.5.0  /usr/local/lib/libg2o_types_sim3.so  /usr/local/lib/libg2o_solver_dense.so  /usr/local/lib/libg2o_solver_eigen.so  /usr/local/lib/libg2o_solver_csparse.so  /usr/local/lib/libg2o_csparse_extension.so  /usr/local/lib/libcxsparse.so  /usr/local/lib/libccolamd.so  /usr/local/lib/libcamd.so  /usr/local/lib/libcolamd.so  /usr/local/lib/libamd.so  -lopenblas  -lopenblas  /usr/local/lib/libsuitesparseconfig.so  -lrt  /usr/local/lib/libmetis.so  /usr/local/lib/libdbow2.so  -lopenblas  -lpthread  /usr/local/lib/libopencv_features2d.so.4.5.0  /usr/local/lib/libopencv_flann.so.4.5.0  /usr/local/lib/libopencv_imgproc.so.4.5.0  /usr/local/lib/libopencv_core.so.4.5.0  /usr/local/lib/libg2o_types_sba.so  /usr/local/lib/libg2o_types_slam3d.so  /usr/local/lib/libg2o_opengl_helper.so  /usr/lib/x86_64-linux-gnu/libGLU.so  /usr/lib/x86_64-linux-gnu/libGL.so  /usr/local/lib/libg2o_core.so  /usr/local/lib/libg2o_stuff.so  -lrt  /usr/local/lib/libsuitesparseconfig.so  -lrt  /usr/local/lib/libmetis.so  /usr/local/lib/libdbow2.so && :
/usr/bin/ld: /usr/local/lib/libyaml-cpp.a(memory.cpp.o): relocation R_X86_64_PC32 against symbol `_ZTVSt15_Sp_counted_ptrIPN4YAML6detail9node_dataELN9__gnu_cxx12_Lock_policyE2EE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

There is no option to build yaml-cpp with -fPIC. I guess you have to build a shared library.