[vlc-devel] Re: patch to configure.ac , solve avcodec-zlib link issue

ac nyvsld at gmail.com
Tue Oct 18 10:08:51 CEST 2005


On 10/18/05, Derk-Jan Hartman <hartman at videolan.org> wrote:
> On 08 okt 2005, at 15:00, cc wrote:
>
> > this patch applys to:
> > vlc: snapshot20051003
> > (with ffmpeg: latest cvs)
> >
> >
> > when vlc configured without `--with-ffmpeg-tree',
> > and ffmpeg built without enabling zlib,
> > building vlc will failed with :
> >
>
> I'm confused here. You said you built ffmpeg without libz, but
> libavcodec is clearly linked to libz, otherwise it wouldn't complain
> about a missing symbol

zlib is installed before compile ffmpeg.
ffmpeg is configured like this:
  ./configure --enbale-pp --enable-gpl --prefix=$HOME

i said `without libz' means that i didn't configure vlc to use
  `--with-ffmpeg-zlib'
vlc is configured like this:
  ./configure --prefix=$HOME

and some enviorment variables are set to help the complier and linker
find the libs that vlc need.

its the linker who complained about unresolved symbol,
when building vlc.

i guess `libavcodec.z' contains symbol exported by `libz.a',
so `libz.a' must be linked to to resolve those symbols.

the command line caused the problem is
  `-lavutil -lz -lavcodec', ( avcodec cant find symbols in z)
where `-lz' appears _before_ `-lavcodec',
the linker requires that `-lz' appears _after_ `-lavcodec' if
libavcodec will use libz.
  `-lavutil -lz -lavcodec -lz', ( works )

>
> DJ
>
>
> >
> > ``
> > Making all in .
> > make[2]: Entering directory `/home/me/src/vlc-snapshot-20051002'
> > srcdir=. ./toolbox --update-version
> > gcc -Wsign-compare -Wall -I/home/me/include -pipe -L/home/me/lib -o
> > vlc src/vlc-vlc.o lib/libvlc.a ./modules/misc/memcpy/libmemcpymmx.a
> > ./modules/video_chroma/libi420_rgb_mmx.a
> > ./modules/video_chroma/libi422_yuy2_mmx.a
> > ./modules/video_chroma/libi420_ymga_mmx.a
> > ./modules/video_chroma/libi420_yuy2_mmx.a
> > ./modules/misc/memcpy/libmemcpymmxext.a
> > ./modules/misc/memcpy/libmemcpy3dn.a ./modules/mux/mpeg/libmux_ts.a
> > ./modules/codec/ffmpeg/libffmpeg.a
> > ./modules/stream_out/libstream_out_switcher.a -L/home/me/lib -lrt
> > -lpthread -ldl -lm -L/home/me/lib -ldvbpsi -lavformat -lz -lavcodec
> > -lavutil -lm
> > /home/me/lib/libavcodec.a(lcl.o): In function `encode_frame':
> > /home/me/src/v/ffmpeg/libavcodec/lcl.c:578: undefined reference to
> > `deflateReset'
> > /home/me/src/v/ffmpeg/libavcodec/lcl.c:589: undefined reference to
> > `deflate'
> > ''
> >
> >
> > this is because libavcodec links to zlib,
> > and ld requires options ordered like this `-lavcodec -lz', not '-lz
> > -lavcodec'.
> > this patch fixed this .
> > after apply, you 'll have to run
> >   autoreconf
> > to regenerate `configure' script.
> > content listed below, also attached.
> >
> >
> >
> > --- configure.ac.old    2005-10-03 04:50:18.000000000 +0800
> > +++ configure.ac        2005-10-08 20:18:49.000000000 +0800
> > @@ -2189,7 +2189,7 @@
> >
> >        AC_CHECK_LIB(avcodec, avcodec_init, [
> >          VLC_ADD_BUILTINS([ffmpeg])
> > -        VLC_ADD_LDFLAGS([ffmpeg],[-lavcodec])
> > +        VLC_ADD_LDFLAGS([ffmpeg],[-lavcodec -lz])
> >          if test "${enable_sout}" != "no"; then
> >              VLC_ADD_BUILTINS([stream_out_switcher])
> >          fi],
> >
> > <configure.ac.diff>
> >
>
>


--
all born, to be dying

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list