Wall of text incoming. Sorry if this is too long. Let me know and I will use a pastebin next time. Below the dashed lines is a series of compiling errors based on a sequence of adding and removing the ffmpeg linking flags in various ways to create a pattern. Some interesting things occur.
1) The avutil "undefined reference to symbol 'av_frame_free@@LIBAVUTIL_52'" switches to the normal looking "undefined reference to `av_frame_free'" if you include the avutil linking flag. 2) When the avutil and swscale linking flags were both not included, the swscale undefined reference error did not appear. The "undefined reference to symbol 'av_frame_free@@LIBAVUTIL_52'" was the only error shown. 3) Aren't av_malloc( ) and av_free( ) from avutil as well?...reading documentation.....I see that avcodec.h includes the avutil/mem.h and avutil/frame.h headers...That explains why it complains about symbols in libavutil when I am just using avcodec. I didn't have to link to avutil directly before...Why does it make a difference now? ----------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------- If I remove the linking flags for all the ffmpeg libraries, I get what I'd expect (lots of undefined reference errors, one for each function i tried to use): Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::h264_Decoder()': h264_decoder.cpp:(.text+0x82): undefined reference to `avcodec_register_all' h264_decoder.cpp:(.text+0x87): undefined reference to `av_register_all' h264_decoder.cpp:(.text+0x91): undefined reference to `avcodec_find_decoder' h264_decoder.cpp:(.text+0xc1): undefined reference to `avcodec_alloc_context3' h264_decoder.cpp:(.text+0xf2): undefined reference to `avcodec_open2' h264_decoder.cpp:(.text+0x19c): undefined reference to `av_frame_alloc' h264_decoder.cpp:(.text+0x1ac): undefined reference to `av_frame_alloc' h264_decoder.cpp:(.text+0x1d7): undefined reference to `avpicture_get_size' h264_decoder.cpp:(.text+0x1e7): undefined reference to `av_malloc' h264_decoder.cpp:(.text+0x231): undefined reference to `avpicture_fill' h264_decoder.cpp:(.text+0x29f): undefined reference to `sws_getCachedContext' CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::~h264_Decoder()': h264_decoder.cpp:(.text+0x31c): undefined reference to `av_free' h264_decoder.cpp:(.text+0x32e): undefined reference to `av_frame_free' h264_decoder.cpp:(.text+0x340): undefined reference to `av_frame_free' h264_decoder.cpp:(.text+0x353): undefined reference to `sws_freeContext' collect2: error: ld returned 1 exit status make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1 make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2 make: *** [all] Error 2 Invoking "make" failed Including avcodec and avformat linking flags (still not including swscale) changes this to: Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node [ 4%] Built target video_client_node [ 98%] Built target ardrone_2_ALL_GEN_OUTPUT_FILES_eus /usr/bin/ld: CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: undefined reference to symbol 'av_frame_free@@LIBAVUTIL_52' //usr/local/lib/libavutil.so.52: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1 make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2 make: *** [all] Error 2 Invoking "make" failed Then including avutil flags (still not including swscale): Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node Built target genmsg_eus [ 1%] Built target navdata_client_node [ 3%] [ 4%] Built target video_client_node Built target at_controller_node [ 98%] Built target ardrone_2_ALL_GEN_OUTPUT_FILES_eus CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::h264_Decoder()': h264_decoder.cpp:(.text+0x19c): undefined reference to `av_frame_alloc' h264_decoder.cpp:(.text+0x1ac): undefined reference to `av_frame_alloc' h264_decoder.cpp:(.text+0x29f): undefined reference to `sws_getCachedContext' CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::~h264_Decoder()': h264_decoder.cpp:(.text+0x32e): undefined reference to `av_frame_free' h264_decoder.cpp:(.text+0x340): undefined reference to `av_frame_free' h264_decoder.cpp:(.text+0x353): undefined reference to `sws_freeContext' collect2: error: ld returned 1 exit status make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1 make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2 make: *** [all] Error 2 Invoking "make" failed And finally including swscale flag: Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node [ 0%] Built target genmanifest_eus [ 1%] [ 3%] [ 4%] Built target video_client_node Built target at_controller_node Built target navdata_client_node [ 98%] Built target ardrone_2_ALL_GEN_OUTPUT_FILES_eus CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::h264_Decoder()': h264_decoder.cpp:(.text+0x19c): undefined reference to `av_frame_alloc' h264_decoder.cpp:(.text+0x1ac): undefined reference to `av_frame_alloc' CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::~h264_Decoder()': h264_decoder.cpp:(.text+0x32e): undefined reference to `av_frame_free' h264_decoder.cpp:(.text+0x340): undefined reference to `av_frame_free' collect2: error: ld returned 1 exit status make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1 make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2 make: *** [all] Error 2 Invoking "make" failed Now, keeping avcodec, avformat, and swscale flags, but removing avutil flags again: Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node [ 1%] [ 4%] [ 4%] Built target video_client_node Built target navdata_client_node Built target at_controller_node [ 98%] Built target ardrone_2_ALL_GEN_OUTPUT_FILES_eus /usr/bin/ld: CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: undefined reference to symbol 'av_frame_free@@LIBAVUTIL_52' //usr/local/lib/libavutil.so.52: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1 make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2 make: *** [all] Error 2 Invoking "make" failed Commenting out any use of avutil functions: av_alloc_frame( ), av_frame_free( ), av_malloc( ), and av_free( ) in my code: No errors. Add avutil linking flag again, then uncomment av_malloc( ) and av_free( ): No errors.
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
