Hi, 2014-09-17 16:37 GMT+02:00 Lynn Yu <yuqilin1...@gmail.com>: > I've build ffmpeg static libraries, and all necessary objs (*.o) generated > in their source directory. > > I use 'ar' to archive all these objs into one libffmpeg.a. > > command: *ar rc libffmpeg.a *.o* > > I notice that, there are some objs have same name in different dirs, for > example *libavformat/4xm.o and libavcodec/4xm.o*. > > by 'nm libffmpeg.a', it seems both objs are there? > > 'man ar' I find that, if obj with same name and Exactly with same function > symbols, latter one will be replaced ,right? > > by this 'ar' way, will libffmpeg.a work correctly? because there so many > symbols I can't test every one.
What you describe is possible, but I don't recommend you to do so, just as is. What are you precisely trying to achieve? Something that I usually do, which is simple and clean to maintain, is: ship with a dedicated DSO (shared library) of FFmpeg, with only the symbols you are interested in, but placed into a separate namespace so that to avoid clashes with a system version that might (under particular conditions) get in indirectly, depending on the nature of your project and its dependencies. Hints: 1. Fetch FFmpeg sources at compile-time, e.g. a specific version you are interested in, make it a git submodule, if you use git. 2. Configure FFmpeg with --enable-static --enable-pic --disable-shared --disable-all --enable-decoder="decoders_you_want" --enable-demuxer="demuxers_you_want" [...], etc. You see the picture? enable only the components you are interested in, FFmpeg is very flexible for that. 3. Agglomerate all the generated *.a into a DSO and use a linker script to place all av* symbols into a particular namespace and make all other symbols private, internal. e.g. SOMETHING_FFMPEG { global: av*; local: *; }; 4. Link the rest of your project with those built-in FFmpeg headers and libraries, ship with the FFmpeg DSO. Of course, you still have the option to link against system libraries, which would be the preferred process in most cases, IMHO. Regards, -- Gwenole Beauchesne Intel Corporation SAS / 2 rue de Paris, 92196 Meudon Cedex, France Registration Number (RCS): Nanterre B 302 456 199 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel