I am trying to build ffmpeg source code on ubuntu 10.1 linux machine with gcc version 4.4.3.
I am interested in making av_transcode() function in ffmpeg.c available”, So I have commented out the main function of ffmpeg.c.
gcc $(LD_LIBRARY_PATHS) -Wl,-Bsymbolic -Wl,-E -o ffmpeg_g ffmpeg.o cmdutils.o -lavdevice -lavformat -lavcodec -lswscale -lavutil -lz -pthread -lm -lx264 -lm -lasound -lasound -lasound -ldl
I am getting below linking errors
+++++++++++++++++++++++++++++++++++++++++++++++++
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crt1.o: In function _start':main’
(.text+0x20): undefined reference to
collect2: ld returned 1 exit status
make: * [ffmpeg_g] Error 1
++++++++++++++++++++++++++++++++++++++++++++++++++
The same behavior is observed On my MacOS (snow leopard) as well.
SO putting the question short, How can I tell gcc compiler that I am building this source code to make library?
gcc -sharedif you’re trying to build a shared library, otherwise just usearto bundle the compiled objects together.But you really should go read How To Write Shared Libraries (PDF) and lots of other documentation, so that you understand why the above will sometimes fail without
-fPICand so on.