videosegmentation / video_segment

Main repository for The Video Segmentation Project
Other
168 stars 80 forks source link

error at linking stage - undefined reference to * in libavcodec #6

Closed grudelsud closed 10 years ago

grudelsud commented 10 years ago

hi,

trying to make the seg_tree_sample work, unfortunately it fails at the very last step when linking all compiled code

I've followed the shared google doc for compilation, and running the following versions:

please be aware that trying to compile opencv with ffmpeg already installed throws an error at linking libavcodec.a suggesting it should be compiled with -fPIC

any help to make this work is greatly appreciated

thanks! below the stack trace:

Linking CXX executable seg_tree_sample /usr/local/lib/libavcodec.a(opusdec.o): In function opus_decode_subpacket': /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:376: undefined reference toswr_is_initialized' /usr/local/lib/libavcodec.a(opusdec.o): In function opus_decode_frame': /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:222: undefined reference toswr_is_initialized' /usr/local/lib/libavcodec.a(opusdec.o): In function opus_init_resample': /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:163: undefined reference toswr_init' /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:169: undefined reference to swr_convert' /usr/local/lib/libavcodec.a(opusdec.o): In functionopus_decode_frame': /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:236: undefined reference to swr_convert' /usr/local/lib/libavcodec.a(opusdec.o): In functionopus_flush_resample': /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:117: undefined reference to swr_convert' /usr/local/lib/libavcodec.a(opusdec.o): In functionopus_decode_subpacket': /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:408: undefined reference to swr_close' /usr/local/lib/libavcodec.a(opusdec.o): In functionopus_decode_flush': /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:557: undefined reference to swr_close' /usr/local/lib/libavcodec.a(opusdec.o): In functionopus_decode_close': /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:579: undefined reference to swr_free' /usr/local/lib/libavcodec.a(opusdec.o): In functionopus_decode_init': /home/sd/Desktop/video-segment/videosegmentation.com/ffmpeg-2.3/libavcodec/opusdec.c:629: undefined reference to `swr_alloc' collect2: error: ld returned 1 exit status make[2]: * [seg_tree_sample] Error 1 make[1]: * [CMakeFiles/seg_tree_sample.dir/all] Error 2 make: *\ [all] Error 2

dcastro9 commented 10 years ago

Hey grudelsud,

What system are you building this on?

Not sure if order is the issue here, don't think it should be, but per the Google doc we compile OpenCV before we compile ffmpeg. We are also using OpenCV 2.4.7 although I don't believe 2.4.9 should be a problem.

I'll try to replicate the bug once you let me know the system, and we'll follow up from there.

Thanks for bringing this up, Daniel.

grudelsud commented 10 years ago

uh, thanks for swift reply!

I'm building on a VM running Ubuntu 14.04 LTS, latest kernel version (sorry can't remember the exact numbers and I'm on another machine at the moment)

just let me know anything else I can do if it's of any help and I'll follow up once I'm back in the studio tomorrow am

thanks!

erdelyiadam commented 10 years ago

Hi, I had similar problems. I simply added 2 extra libraries (namely -lva and -lswresample) to the linker parameters (in seg_tree_sample/CMakeFiles/seg_tree_sample.dir/link.txt) and then it compiled successfully. ;) Oh, and I had to install an extra package: libboost-program-options-dev (I'm using Ubuntu 14.04 with OpenCV 2.4.9, ffmpeg 2.3.1 [everything compiled manually].)

grundman commented 10 years ago

added swresample to ffmpeg libs and removed boost program options lib. Thx for pointing this out!