From: Jan Uhlir <espinosa_cz@ce...> - 2007-06-14 17:04:59
As I am experimenting with latest build of kdenlive, mlt and ffmpeg from SVN, I do not want to break stable system versions,
so I decided to build everything into a special directory in userspace for easy testing, upgrading and debugging.
The trick is to persuade runtime linker pick libraries from build directory and not from system.
One option is to set LD_LIBRARY_PATH every time kdenlive is launched.
More convenient way is to instruct binaries and libs itself to prefer another directory when looking for dynamic libraries.
I discovered RPATH which seems to do exactly this.
But how to set it to build process?
export LDFLAGS=$LDFLAGS -rpath=../lib
But if I try 'ldd' on created libs or binaries, it prints out that library calls system libraries from /usr/lib and not those builded from ~/build/lib
There is not much help about RPATH on internet.
By the way, I'm creating a bash script for building the whole lot - ffmpeg, mlt, mlt++. kdenlive with suggested parameters and necessary isolation from the rest of the system.
If would like to share it indeed. This could make building kdendlive & corp. more easy.
If I try
export CFLAGS=$CFLAGS -Wl,--rpath -Wl,../lib
export CFLAGS=$CFLAGS -Wl,--rpath,../lib
then this warning appears on each gcc call:
gcc: --rpath: linker input file unused because linking not done
gcc: ../lib: linker input file unused because linking not done
and also (?)
gcc: unrecognized option '-rpath=../lib'
export LDFLAGS="$LDFLAGS -rpath ../lib" causes complete fail of ./configure, error message that
gcc is unable to create executable
I guess it is not necessary to manually set LD_LIBRARY_PATH variable prior to compilation.
More confusion, sometimes is reffered as RPATH sometimes as LD_RUN_PATH.
Which one is right for gcc/linux/automake systems?