[FFmpeg-devel] [PATCH]Fix compilation with frei0r and --disable-ffserver

Stefano Sabatini stefasab at gmail.com
Sun Jan 22 12:24:52 CET 2012


On date Saturday 2012-01-21 19:30:31 +0000, Carl Eugen Hoyos encoded:
> Stefano Sabatini <stefasab <at> gmail.com> writes:
> 
> > > A user claims that attached patch fixes the compilation error with
> > > --enable-frei0r --disable-ffserver ($ldl is only added to the ldflags if 
> > > ffserver is compiled), I did not test.
> > > 
> > > Please comment, Carl Eugen
> > 
> > Can we get the config.log file?
> > 
> > Weirdly, I'm able to link even if I explicitely disable -ldl.

In my config.log I find:

check_func dlopen
check_ld cc
check_cc
BEGIN /home/stefano/tmp/ffconf.5t2v2Fs3.c
    1   extern int dlopen();
    2   int main(void){ dlopen(); }
END /home/stefano/tmp/ffconf.5t2v2Fs3.c
gcc -I/home/stefano/include -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/stefano/include -std=c99 -fomit-frame-pointer -c -o 
/home/stefano/tmp/ffconf.V4FD4LCt.o /home/stefano/tmp/ffconf.5t2v2Fs3.c
gcc -L/home/stefano/lib -Wl,--as-needed -o /home/stefano/tmp/ffconf.3I6btLjt /home/stefano/tmp/ffconf.V4FD4LCt.o
/home/stefano/tmp/ffconf.V4FD4LCt.o: In function `main':
ffconf.5t2v2Fs3.c:(.text+0xa): undefined reference to `dlopen'
collect2: ld returned 1 exit status
check_func dlopen -ldl
check_ld cc -ldl
check_cc
BEGIN /home/stefano/tmp/ffconf.5t2v2Fs3.c
    1   extern int dlopen();
    2   int main(void){ dlopen(); }
END /home/stefano/tmp/ffconf.5t2v2Fs3.c
gcc -I/home/stefano/include -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/stefano/include -std=c99 -fomit-frame-pointer -c -o /home/stefano/tmp/ffconf.V4FD4LCt.o /home/stefano/tmp/ffconf.5t2v2Fs3.c
gcc -L/home/stefano/lib -Wl,--as-needed -o /home/stefano/tmp/ffconf.3I6btLjt /home/stefano/tmp/ffconf.V4FD4LCt.o -ldl

That is dlopen is checked (check_func dlopen), in case of failure
(like reported in the log above) dlopen is checked against -ldl, and
in this case "-ldl" is added to extralibs.

This corresponds to the configure lines:
if ! check_func dlopen && check_func dlopen -ldl; then
    add_extralibs -ldl
fi

In case I remove -ldl from the config.mak flags, I'd expect a linking
failure, which is not what's happening.
 
> Does "grep ldl config.mak" show something for you?
> 
> [...]
> 
> > Also check the attached patch.
> 
> Works fine for me, but it adds -ldl for --disable-ffserver

Which shouldn't be a problem, since -ldl seems required by dlopen
which is used in frei0r, also the check in my patch is more generic,
so it won't require to add another ldl extralibs line anytime you add
a component which depends on dlopen. The only problem is that with the
patch -ldl is added everytime dlopen requires it, even if dlopen is
never used.

The alternative solution suggested by Michael would be to use
frei0r_filter_extralibs="$ldl"

I'm fine with both solutions.
-- 
FFmpeg = Frenzy and Fancy MultiPurpose Explosive Glue


More information about the ffmpeg-devel mailing list