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

libusb_cam.so: undefined reference #202

Closed
mistyk opened this issue Nov 14, 2022 · 11 comments · Fixed by #207 or #228
Closed

libusb_cam.so: undefined reference #202

mistyk opened this issue Nov 14, 2022 · 11 comments · Fixed by #207 or #228

Comments

@mistyk
Copy link

mistyk commented Nov 14, 2022

When i run catkin_make i've the following error, anyone have some advice for a newbie ? ;)

Thanks !

Log:

[100%] Linking CXX executable /home/jetson/catkin_ws/devel/lib/usb_cam/usb_cam_node
/usr/bin/ld: warning: libopencv_imgproc.so.3.2, needed by /home/jetson/catkin_ws/devel/lib/libusb_cam.so, may conflict with libopencv_imgproc.so.4.1
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_packet_from_data' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to sws_scale'
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_frame_alloc' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to avcodec_close'
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_frame_get_buffer' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_new_packet'
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to avcodec_alloc_context3' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_log_set_level'
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to avcodec_free_context' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_free'
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to avcodec_open2' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to avcodec_send_packet'
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to sws_getContext' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_image_get_buffer_size'
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_parser_close' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_parser_init'
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to avcodec_register_all' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to sws_freeContext'
/home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to avcodec_receive_frame' /home/jetson/catkin_ws/devel/lib/libusb_cam.so: undefined reference to av_image_copy_to_buffer'
/home/jetson/catkin_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:144: recipe for target '/home/jetson/catkin_ws/devel/lib/usb_cam/usb_cam_node' failed
make[2]: *** [/home/jetson/catkin_ws/devel/lib/usb_cam/usb_cam_node] Error 1
CMakeFiles/Makefile2:4437: 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 -j2 -l2" failed

@chenkefeng030
Copy link

I reset to the 2020 version, and there is no problem.
hash code:3ce8ee1c47c03be37229bf5857ae9a309d8eb1e8

@twdragon
Copy link
Collaborator

twdragon commented Nov 15, 2022

@chenkefeng030 @mistyk you need to thoroughly check which version of FFMPEG/libavcodec you have. I see that some functions, av_packet_from_data, for example, are introduced in libavutil API from version 2.8 at least. It seems that your system is equipped with a very old version of libavcodec stack. Could you please send here the output of the command:

ffmpeg -version

Here is an output of APT on ffmpeg package from Ubuntu 22.04, so see the actual version here.

Package: ffmpeg
Version: 7:4.4.2-0ubuntu0.22.04.1
Priority: optional
Section: universe/video
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Multimedia Maintainers <debian-multimedia@lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 2.288 kB
Depends: libavcodec58 (= 7:4.4.2-0ubuntu0.22.04.1), libavdevice58 (= 7:4.4.2-0ubuntu0.22.04.1), libavfilter7 (= 7:4.4.2-0ubuntu0.22.04.1), libavformat58 (= 7:4.4.2-0ubuntu0.22.04.1), libavutil56 (= 7:4.4.2-0ubuntu0.22.04.1), libc6 (>= 2.35), libpostproc55 (= 7:4.4.2-0ubuntu0.22.04.1), libsdl2-2.0-0 (>= 2.0.12), libswresample3 (= 7:4.4.2-0ubuntu0.22.04.1), libswscale5 (= 7:4.4.2-0ubuntu0.22.04.1)
Suggests: ffmpeg-doc
Homepage: https://ffmpeg.org/
Task: ubuntustudio-video, ubuntustudio-audio, ubuntukylin-desktop, ubuntu-mate-desktop, ubuntu-budgie-desktop, ubuntu-budgie-desktop-raspi
Download-Size: 1.696 kB
APT-Sources: http://ftp.arnes.si/pub/mirrors/ubuntu jammy-updates/universe amd64 Packages

@mistyk
Copy link
Author

mistyk commented Nov 15, 2022

@twdragon i'm on Jetson nano with bionic, this is my version with latest ffmpeg for bionic

ffmpeg version 3.4.11-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100

@mistyk
Copy link
Author

mistyk commented Nov 15, 2022

I reset to the 2020 version, and there is no problem. hash code:3ce8ee1c47c03be37229bf5857ae9a309d8eb1e8

I've don't found this release, have you got links ?
Thanks!

@chenkefeng030
Copy link

I reset to the 2020 version, and there is no problem. hash code:3ce8ee1c47c03be37229bf5857ae9a309d8eb1e8

I've don't found this release, have you got links ? Thanks!

Maybe this is not the best solution,you can enter the following command under your local repository:
git reset --hard 3ce8ee1.
I use jetson xavier nx and no problem.

@twdragon
Copy link
Collaborator

@mistyk @chenkefeng030 I investigated the issue, it is a misspelled name of libavcodec library in the linker list of CMakeLists.txt. I will fix it very soon!

@twdragon
Copy link
Collaborator

The issue reproduced for Melodic, investigation restarted.

@twdragon twdragon reopened this Nov 16, 2022
@mistyk
Copy link
Author

mistyk commented Nov 16, 2022

@twdragon keep me informed ! Thanks you

@twdragon
Copy link
Collaborator

@mistyk I examined libavcodec header files shipped with Ubuntu 18.04, 20.04 nd 22.04, so I will try to track and integrate the changes I discovered from there

@mistyk
Copy link
Author

mistyk commented Nov 17, 2022

@twdragon Thanks you ! i'm waiting for you to update my ROS ;) keep me in touch !

@joker-wutong
Copy link

joker-wutong commented May 15, 2024

我也遇到了同样的问题:

[ 75%] Linking CXX executable /home/agilex/idrive_ws/devel/lib/usb_cam/usb_cam_node
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_packet_from_data'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `sws_scale'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_frame_alloc'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_close'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_frame_get_buffer'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_new_packet'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_alloc_context3'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_log_set_level'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_free_context'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_free'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_open2'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_send_packet'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `sws_getContext'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_image_get_buffer_size'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_parser_close'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_parser_init'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_register_all'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `sws_freeContext'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_receive_frame'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `av_image_copy_to_buffer'
/home/agilex/idrive_ws/devel/lib/libusb_cam.so: undefined reference to `avcodec_find_decoder'

i'm on Jetson nano with melodic, this is my version with latest ffmpeg for bionic

ffmpeg version 3.4.11-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil      55. 78.100 / 55. 78.100
libavcodec     57.107.100 / 57.107.100
libavformat    57. 83.100 / 57. 83.100
libavdevice    57. 10.100 / 57. 10.100
libavfilter     6.107.100 /  6.107.100
libavresample   3.  7.  0 /  3.  7.  0
libswscale      4.  8.100 /  4.  8.100
libswresample   2.  9.100 /  2.  9.100
libpostproc    54.  7.100 / 54.  7.100

怎么解决啊,各位全栈工程师们,技术大佬啊,求教!
help!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants