bebop_autonomy icon indicating copy to clipboard operation
bebop_autonomy copied to clipboard

compile bebop_driver failed

Open tc17339 opened this issue 6 years ago • 2 comments

Hi everyone

There was a problem I cannot fixed them.

When I used 'catkin built' as the last step to build bebop_autonomy, it gives me this error:

/usr/bin/ld: /usr/local/lib/libavcodec.a(mqc.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libavcodec.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status make[2]: *** [/home/taochen/bebop_ws/devel/.private/bebop_driver/lib/libbebop.so] Error 1 make[1]: *** [CMakeFiles/bebop.dir/all] Error 2 make: *** [all] Error 2 cd /home/taochen/bebop_ws/build/bebop_driver; catkin build --get-env bebop_driver | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd - ............................................................................... Failed << bebop_driver:make [ Exited with code 2 ]
Failed <<< bebop_driver [ 30.5 seconds ]
Abandoned <<< bebop_tools [ Unrelated job failed ]
[build] Summary: 2 of 4 packages succeeded.
[build] Ignored: 1 packages were skipped or are blacklisted.
[build] Warnings: None.
[build] Abandoned: 1 packages were abandoned.
[build] Failed: 1 packages failed.
[build] Runtime: 33.0 seconds total.

It still no works when I add the 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )' in the CMakeList.txt file which was located in the bebop_dirver folder. I also have tried command 'set(Boost_USE_STATIC_LIBS OFF) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)'. but still get the same error. Anyone know how to fix the error?

Many thanks Tao

tc17339 avatar Sep 03 '18 14:09 tc17339

This issue has been fixed in #164. Maybe, such changes were not reported in the master.

gsilano avatar Sep 03 '18 22:09 gsilano

But it gives me these errors this time: /home/taochen/bebop_ws/src/bebop_autonomy/bebop_driver/src/bebop_video_decoder.cpp:93:36: error: ‘CODEC_CAP_TRUNCATED’ was not declared in this scope if (codec_ptr_->capabilities & CODEC_CAP_TRUNCATED) ^ /home/taochen/bebop_ws/src/bebop_autonomy/bebop_driver/src/bebop_video_decoder.cpp:95:32: error: ‘CODEC_FLAG_TRUNCATED’ was not declared in this scope codec_ctx_ptr_->flags |= CODEC_FLAG_TRUNCATED; ^ /home/taochen/bebop_ws/src/bebop_autonomy/bebop_driver/src/bebop_video_decoder.cpp:97:31: error: ‘CODEC_FLAG2_CHUNKS’ was not declared in this scope codec_ctx_ptr_->flags2 |= CODEC_FLAG2_CHUNKS; ^ After I added 'AV' prefix to them: AV_CODEC_CAP_TRUNCATED,AV_CODEC_FLAG_TRUNCATED,AV_CODEC_FLAG2_CHUNKS;

The compiler gives me this error: /usr/bin/ld: /usr/local/lib/libavcodec.a(mqc.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libavcodec.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status make[2]: *** [/home/taochen/bebop_ws/devel/.private/bebop_driver/lib/libbebop.so] Error 1 make[1]: *** [CMakeFiles/bebop.dir/all] Error 2 make: *** [all] Error 2

and the I added: add_compile_options(-fPIC);set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" ) to the CMakeList.txt file,Each time before I run catkin build, I have run catkin clean command, but still has this error. so I really have no idea how to do next step.

tc17339 avatar Sep 04 '18 09:09 tc17339