[FFmpeg-devel] [PATCH] configure: add check for pkg-config return value

Stefano Sabatini stefano.sabatini-lala
Mon Feb 28 13:41:04 CET 2011


On date Monday 2011-02-28 12:09:30 +0000, M?ns Rullg?rd encoded:
> Martin Storsj? <martin at martin.st> writes:
> 
> > On Mon, 28 Feb 2011, M?ns Rullg?rd wrote:
> >
> >> Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:
[...]
> >> > Simplified and updated.
> >> >
> >> > Note: I'm not sure /dev/null is portable (what about MinGW/CygWin?).
> >> >
> >> > I already explained on irc the reason of the failure, it was due to a
> >> > pkg-config limitation (pkg-config flags only reflect the condition of
> >> > the system when a package was installed), but an additional check
> >> > can't hurt too much and it saves the time wasted on debugging the
> >> > consequential misconfiguration/compilation problems.
> >> 
> >> No, you never explained how the same link command can succeed in
> >> configure and fail during make.
> >
> > If I understood the situation corretly, there never was such a case. Only 
> > a case where missing dependency libs were brought in by another library 
> > transitively. When linking to this dependency was disabled, the other 
> > linking dependency broke. So he's not trying to fix any concrete breakage, 
> > only wanting to notice breakage more clearly early on.
> 
> If the patch doesn't actually fix anything it is rejected.

configure --enable-librtmp --enable-libopencv
Package libssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libssl', required by 'librtmp', not found
[...]

pkg-config complains that libssl is not installed (indeed it isn't,
altough it was during librtmp compilation / installation), so -lrtmp
is not added to the LDFLAGS.

configure succeeds, but then when linking ffmpeg:

gcc -L"/home/stefano/src/sastes-ffmpeg"/libavcodec -L"/home/stefano/src/sastes-?
?ffmpeg"/libavdevice -L"/home/stefano/src/sastes-ffmpeg"/libavfilter -L"/home/s?
?tefano/src/sastes-ffmpeg"/libavformat -L"/home/stefano/src/sastes-ffmpeg"/liba?
?vutil -L"/home/stefano/src/sastes-ffmpeg"/libpostproc -L"/home/stefano/src/sas?
?tes-ffmpeg"/libswscale -L/home/stefano/lib -Wl,--warn-common -Wl,--as-needed -?
?Wl,-rpath-link,"/home/stefano/src/sastes-ffmpeg"/libpostproc -Wl,-rpath-link,"?
?/home/stefano/src/sastes-ffmpeg"/libswscale -Wl,-rpath-link,"/home/stefano/src?
?/sastes-ffmpeg"/libavfilter -Wl,-rpath-link,"/home/stefano/src/sastes-ffmpeg"/?
?libavdevice -Wl,-rpath-link,"/home/stefano/src/sastes-ffmpeg"/libavformat -Wl,?
?-rpath-link,"/home/stefano/src/sastes-ffmpeg"/libavcodec -Wl,-rpath-link,"/hom?
?e/stefano/src/sastes-ffmpeg"/libavutil -o ffmpeg_g ffmpeg.o cmdutils.o -lavdev?
?ice -lavfilter -lavformat -lavcodec -lswscale -lavutil -ldl -lX11 -lXext -lXfi?
?xes -ljack -lasound -lxvidcore -lx264 -lvorbisenc -lvorbis -logg -ltheoraenc -?
?ltheoradec -logg  -lml -lcvaux -lhighgui -lcv -lcxcore -lmp3lame -lm -pthread ?
?-lz
/home/stefano/src/sastes-ffmpeg/libavformat/libavformat.a(librtmp.o): In function `rtmp_close':
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:52: undefined reference to `RTMP_Close'
/home/stefano/src/sastes-ffmpeg/libavformat/libavformat.a(librtmp.o): In function `rtmp_open':
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:87: undefined reference to `RTMP_LogSetLevel'
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:88: undefined reference to `RTMP_LogSetCallback'
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:90: undefined reference to `RTMP_Init'
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:91: undefined reference to `RTMP_SetupURL'
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:97: undefined reference to `RTMP_EnableWrite'
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:99: undefined reference to `RTMP_Connect'
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:99: undefined reference to `RTMP_ConnectStream'
/home/stefano/src/sastes-ffmpeg/libavformat/libavformat.a(librtmp.o): In function `rtmp_write':
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:116: undefined reference to `RTMP_Write'
/home/stefano/src/sastes-ffmpeg/libavformat/libavformat.a(librtmp.o): In function `rtmp_read':
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:123: undefined reference to `RTMP_Read'
/home/stefano/src/sastes-ffmpeg/libavformat/libavformat.a(librtmp.o): In function `rtmp_read_pause':
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:130: undefined reference to `RTMP_Pause'
/home/stefano/src/sastes-ffmpeg/libavformat/libavformat.a(librtmp.o): In function `rtmp_read_seek':
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:148: undefined reference to `RTMP_SendSeek'
/home/stefano/src/sastes-ffmpeg/libavformat/libavformat.a(librtmp.o): In function `rtmp_get_file_handle':
/home/stefano/src/sastes-ffmpeg/libavformat/librtmp.c:157: undefined reference to `RTMP_Socket'

Note: libcvaux links against librtmp:
 ldd /usr/lib/libcvaux.so | grep rtmp
	librtmp.so.0 => /home/stefano/lib/librtmp.so.0 (0xb42e1000)

I don't know why configure was able to pass the linking test and
then linking ffmpeg doesn't work.

If I do:
configure --enable-librtmp

I get this in config.log:

 configure --enable-librtmp
Package libssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libssl', required by 'librtmp', not found
ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f
check_lib librtmp/rtmp.h RTMP_Socket
check_header librtmp/rtmp.h
check_cpp
BEGIN /home/stefano/tmp/ffconf.6dnjdRUC.c
    1   #include <librtmp/rtmp.h>
    2   int x;
END /home/stefano/tmp/ffconf.6dnjdRUC.c
gcc -I/home/stefano/include -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/stefano/include -std=c99 -fomit-frame-pointer -pthread -E -o /home/stefano/tmp/ffconf.CmDDM50o.o /home/stefano/tmp/ffconf.6dnjdRUC.c
check_func RTMP_Socket
check_ld
check_cc
BEGIN /home/stefano/tmp/ffconf.6dnjdRUC.c
    1   extern int RTMP_Socket();
    2   int main(void){ RTMP_Socket(); }
END /home/stefano/tmp/ffconf.6dnjdRUC.c
gcc -I/home/stefano/include -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/stefano/include -std=c99 -fomit-frame-pointer -pthread -c -o /home/stefano/tmp/ffconf.CmDDM50o.o /home/stefano/tmp/ffconf.6dnjdRUC.c
gcc -L/home/stefano/lib -o /home/stefano/tmp/ffconf.uqLC3Jqy /home/stefano/tmp/ffconf.CmDDM50o.o -lm -pthread -lz
/home/stefano/tmp/ffconf.CmDDM50o.o: In function `main':
ffconf.6dnjdRUC.c:(.text+0x7): undefined reference to `RTMP_Socket'
collect2: ld returned 1 exit status
ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f

So having the pkg-config check prevents the spurious configure
success (can't say the exact reason of it). Also adding a pkg-config
check looks a good idea in itself.
-- 
FFmpeg = Fostering & Funny Murdering Peaceless Easy Governor



More information about the ffmpeg-devel mailing list