How to configure linking so that compiled binary finds libraries?

I’m compiling ffmpeg. Configuration:


--prefix=/home/john/zope/engage/zeocluster/ffmpeg/parts/ffmpeg-build
--extra-cflags='-I/home/john/zope/engage/zeocluster/ffmpeg/parts/x264-build/include
-I/home/john/zope/engage/zeocluster/ffmpeg/parts/ogg-build/include
-I/home/john/zope/engage/zeocluster/ffmpeg/parts/theora-build/include
-I/home/john/zope/engage/zeocluster/ffmpeg/parts/lame-build/include
-I/home/john/zope/engage/zeocluster/ffmpeg/parts/faac-build/include
-I/home/john/zope/engage/zeocluster/ffmpeg/parts/faad-build/include
-I/home/john/zope/engage/zeocluster/ffmpeg/parts/vpx-build/include
-I/home/john/zope/engage/zeocluster/ffmpeg/parts/vorbis-build/include
-I/home/john/zope/engage/zeocluster/ffmpeg/parts/ffmpeg-build/include'
--extra-ldflags='-L/home/john/zope/engage/zeocluster/ffmpeg/parts/x264-build/lib
-L/home/john/zope/engage/zeocluster/ffmpeg/parts/ogg-build/lib
-L/home/john/zope/engage/zeocluster/ffmpeg/parts/theora-build/lib
-L/home/john/zope/engage/zeocluster/ffmpeg/parts/lame-build/lib
-L/home/john/zope/engage/zeocluster/ffmpeg/parts/faac-build/lib
-L/home/john/zope/engage/zeocluster/ffmpeg/parts/faad-build/lib
-L/home/john/zope/engage/zeocluster/ffmpeg/parts/vpx-build/lib
-L/home/john/zope/engage/zeocluster/ffmpeg/parts/vorbis-build/lib
-L/home/john/zope/engage/zeocluster/ffmpeg/parts/ffmpeg-build/lib'

The build completes fine, and LD_LIBRARY_PATH=./parts/ffmpeg-build/lib:./parts/x264-build/lib ./parts/ffmpeg-build/bin/ffmpeg runs the binary.

Why is that LD_LIBRARY_PATH necessary? Didn’t I already tell the compiler to link against these libraries?


Source: linux

Leave a Reply