usb_cam 설치 오류

junyong lee·2023년 2월 17일
0
[ 50%] Built target usb_cam
[ 75%] Linking CXX executable /home/jun/xycar_ws/devel/lib/usb_cam/usb_cam_node
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_packet_from_data'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `sws_scale'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_frame_alloc'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_close'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_frame_get_buffer'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_new_packet'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_alloc_context3'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_log_set_level'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_free_context'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_free'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_open2'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_send_packet'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `sws_getContext'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_image_get_buffer_size'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_parser_close'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_parser_init'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_register_all'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `sws_freeContext'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_receive_frame'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `av_image_copy_to_buffer'
/home/jun/xycar_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_find_decoder'
collect2: error: ld returned 1 exit status
usb_cam/CMakeFiles/usb_cam_node.dir/build.make:170: recipe for target '/home/jun/xycar_ws/devel/lib/usb_cam/usb_cam_node' failed
make[2]: *** [/home/jun/xycar_ws/devel/lib/usb_cam/usb_cam_node] Error 1
CMakeFiles/Makefile2:1326: recipe for target 'usb_cam/CMakeFiles/usb_cam_node.dir/all' failed
make[1]: *** [usb_cam/CMakeFiles/usb_cam_node.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

이 문제에 대한 대응으로 해당 라이브러리를 찾을 수 없다는 의미로 ~/catkin_ws/src/usb_cam/ 아래의 CMakeLists.txt를 확인하여 수정해야됩니다.

"locate libavcodec", "locate libavutil", "locate libswscale"을 사용하여 라이브러리의 경로를 찾은 다음 CMakeLists.txt에 다음 줄을 추가합니다.

set(avcodec_LINK_LIBRARIES /usr/lib/x86_64-linux-gnu/libavcodec.so)
set(avutil_LINK_LIBRARIES /usr/lib/x86_64-linux-gnu/libavutil.so)
set(swscale_LINK_LIBRARIES /usr/lib/x86_64-linux-gnu/libswscale.so)

profile
도전하는 개발자 지망생

0개의 댓글