<div dir="ltr">I tried, bot does not work.<div>Could I link both libraries to one ffmpeg_sdl without troubles with licenses?, It would be nice to compile using:</div><div><br></div><div>gcc -o program program.c -lffmpeg_sdl</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-30 15:28 GMT+02:00 Peter Steinbach <span dir="ltr"><<a href="mailto:steinbach@scionics.de" target="_blank">steinbach@scionics.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">linking order matters definitely! see this nice introductory post <a href="http://eli.thegreenplace.net/2013/07/09/library-order-in-static-linking/" rel="noreferrer" target="_blank">http://eli.thegreenplace.net/2<wbr>013/07/09/library-order-in-sta<wbr>tic-linking/</a><br>
<br>
put -lx264 after -lavcodec!<span class="HOEnZb"><font color="#888888"><br>
Peter</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 08/30/2016 01:28 PM, Javier Lopez wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I simplified a few using the pkg-config to one call by using both flags:<br>
--clibs and --cflags:<br>
<br>
gcc  -o ffmpeg_player ffmpeg_player_01.c -Wall -ggdb $(pkg-config --cflags<br>
--libs libavformat libavcodec libswresample libswscale libavutil sdl) -lm<br>
<br>
And it worked!<br>
<br>
<br>
I also tried to compile without the pkg-config adding all dependencies:<br>
<br>
gcc  -o ffmpeg_player ffmpeg_player_01.c -Wall -ggdb -lavformat -lvdpau<br>
-lva -lva-drm -lva-x11 -lxcb -lxcb-shm -lxcb -lxcb-xfixes -lxcb-render<br>
-lxcb-shape -lX11 -lasound -lSDL -lx264 -lmp3lame -lfdk-aac -lm -lz<br>
-pthread -lavcodec -lvdpau -lswresample -lswscale -lavutil -lSDL<br>
<br>
Still I have following error: libavcodec/libx264.c:814: undefined reference<br>
to `x264_encoder_open_148'<br>
<br>
I listed all dependencies of libavcodec and all of them where included,<br>
perhaps order minds.<br>
<br>
<br>
<br>
<br>
<br>
2016-08-29 16:11 GMT+02:00 Javier Lopez <<a href="mailto:jlopez2022@gmail.com" target="_blank">jlopez2022@gmail.com</a>>:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I would like to simplify in order to add more libs to the ffmpeg like<br>
opencl and sdl libs and I do not know how to link using pkg-config<br>
combined with no pkg-config libraries<br>
I tried to add the sdl-config but it did not worked.<br>
I will try to add all those libraries and to list them using pkg-config<br>
--libs,<br>
<br>
javier<br>
<br>
2016-08-29 14:29 GMT+02:00 Perette Barella <<a href="mailto:perette@barella.org" target="_blank">perette@barella.org</a>>:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Then I can compile and link using the following command line:<br>
gcc  -o ffmpeg_grabber ffmpeg_grabber_03.c -Wall -ggdb $(pkg-config<br>
</blockquote>
--cflags libavformat libavcodec libswresample libswscale libavutil sdl)<br>
$(pkg-config --libs libavformat libavcodec libswresample libswscale<br>
libavutil sdl) -lm<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
But I have a lot of link errors (undefined a lot of things) removing<br>
</blockquote>
pkg-config:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
gcc  -o test test.c -Wall -lavformat -lavcodec -lswresample -lswscale<br>
</blockquote>
-lavutil -lm<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
The question is: How to avoid undefine errors without using the<br>
</blockquote>
pkg-config?<br>
<br>
When static linking, you need to link not only the ffmpeg libraries<br>
themselves, but all the libraries that they link to in turn.  In this<br>
command:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
pkg-config --libs libavformat libavcodec libswresample libswscale<br>
</blockquote>
libavutil sdl<br>
<br>
<br>
`pkg-config --libs` gets the link flags necessary (there’s also a<br>
--cflags option too), including all those indirectly needed libraries, to<br>
link.  You can run pkg-config --libs on the command line to see the list.<br>
<br>
This list will not always be the same.  My Mac, for example, includes<br>
pthreads among the automatically-linked system libraries, so there will be<br>
no ‘-lpthreads’, but it includes -L/opt/local/lib, because it’s installed<br>
in a non-default place where the linker won’t look.  Link flags also depend<br>
on what ffmpeg was configured and built with: for example, if libfoobar is<br>
installed, there could be a dependency for -lfoobar; but if missing when I<br>
ran ./configure on ffmpeg, then I might have ffmpeg but without whatever<br>
capabilities foobar provides.  `configure` scripts see what’s available and<br>
build what they can, and they often utilize information from pkg-config<br>
where it’s available.<br>
<br>
I wonder *why* are you avoiding pkg-config? Are you planning to<br>
build/compile on a system without it?  Are you thinking of a portable<br>
`configure` script, and considering what to do if pkg-config is missing?<br>
Because pkg-config came about to solve the problem you’re running into.<br>
I’ve seen some debate about whether pkg-config solves the problem right,<br>
but it is the thing in place and trying to avoid it is to make yourself<br>
problems.  Not using it means a lot of extra trouble, so unless you have a<br>
*really* good reason...<br>
<br>
Perette<br>
<br>
______________________________<wbr>_________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/list<wbr>info/libav-user</a><br>
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/list<wbr>info/libav-user</a><br>
<br>
</blockquote>
______________________________<wbr>_________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/list<wbr>info/libav-user</a><br>
</div></div></blockquote></div><br></div>