Compilation error at linking of kdenlive

Hi,
I am trying to install from source with
- kdenlive_builder.sh getsources and then
- the new kdenlive_builder given by herrej01 here http://www.kdenlive.org/bbforum/viewtopic.php?f=8&t=339#p1238

Everything is fine (mlt can compile with the latest ffmpeg) until the linking (that is performed at sudo make install) of kdenlive.
I have the following error:

---[kdenlive] sudo make install
[ 98%] Built target kdenlive
[ 98%] Built target kdenlive_renderer
[100%] Built target translations
Linking CXX executable CMakeFiles/CMakeRelink.dir/kdenlive
/usr/bin/ld: warning: libmlt.so.0.2.5, needed by /home/olefebvr/usr/kdenlive_built/lib/libmlt++.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libmiracle.so.0.2.5, needed by /home/olefebvr/usr/kdenlive_built/lib/libmlt++.so, not found (try using -rpath or -rpath-link)

and then a sequence of "undefined reference".
Obviously, mlt and mlt++ are already compile and when I do a cmake . in the kdenlive directory I get:

-- Found MLT INSTALL PATH: /home/olefebvr/usr/kdenlive_built/bin/mlt-config , /home/olefebvr/usr/kdenlive_built
-- Found MLT INCLUDES: /home/olefebvr/usr/kdenlive_built/include/mlt
-- Found MLT LIBR: /home/olefebvr/usr/kdenlive_built/lib/libmlt.so
-- Found MLT library: /home/olefebvr/usr/kdenlive_built/lib/libmlt.so
-- Found MLT++ INCLUDES: /home/olefebvr/usr/kdenlive_built/include
-- Found MLT++ LIBR: /home/olefebvr/usr/kdenlive_built/lib/libmlt++.so
-- Found MLT++ library: /home/olefebvr/usr/kdenlive_built/lib/libmlt++.so
-- Found FFMPEG INCLUDES: /home/olefebvr/usr/kdenlive_built/include
-- Found FFMPEG LIBR: /home/olefebvr/usr/kdenlive_built/lib/libavformat.so
-- Found FFMPEG library: /home/olefebvr/usr/kdenlive_built/lib/libavformat.so
-- Found KDE3 include dir: /usr/include/kde
-- Found KDE3 library dir: /usr/lib
-- Found KDE3 dcopidl preprocessor: /usr/bin/dcopidl
-- Found KDE3 dcopidl2cpp preprocessor: /usr/bin/dcopidl2cpp
-- Found KDE3 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
-- Configuring done
-- Generating done
-- Build files have been written to: /home/olefebvr/usr/kdenlive_install/kdenlive

Which sounds good.
What is wrong? Thank you for your help.

Hi,

first to say, the version I posted in the forum is a customised one, so I'm not sure it will work for everybody :oops:

Even more, I've discovered some mistakes if you want to install kdenlive in any directory other than /usr. But, as I explained in the previous message, I do not want to overlap espinosa_cz work (very good, by the way ;) ). If he likes any part of the modified script, I prefer him to update the version and then we can correct anything if wrong :)

Anyway, trying to help. If I understand well, you've used both scripts: The old one to get the sources and my version to install. Am I right ? If this is the case, the problem probably comes from the fact that installation paths for libraries are different. I propose you to use only the old version just changing:

- Delete libogg parameter in ffmpeg configuration
- Use installation steps for kdenlive as proposed in my version (cmake+make+make install)

Old version with just these changes should work. If not, let us know and will try to help.

Regards.
JM

This is my (provisional) kdenlive_build script v3.0

#!/bin/bash
# Script for easy and SAFE Kdenlive & ffmpeg & mlt & mlt++ build utilizing LD_RUN_PATH
# All subprojects are compiled and installed to specified non-system directory.
# You can safely keep multiple kdenlive/ffmpeg versions.
#
# This sript ensures, that kdenlive will call only desired ffmpeg and mlt libs.
# Using LD_RUN_PATH is a better, more general, alternative to statically link it all together.
# You can verify this it by calling
# cd ~/build/kdenlive/bin && ldd ./kdenlive
# - or -
# cd ~/build/kdenlive/bin && LD_DEBUG=libs ./kdenlive
# Set DEST_DIR in script, otherwise ~/build/kdenlive is used by default.
#
# Espinosa, Aleksander Adamowski (Olo)
# $Id$
#
#
# Usage:
#      kdenlive_builder getsources - call svn to get sources for all subprojects for the first time
#      kdenlive_builder updatesources - call svn to update sources for all subprojects
#      kdenlive_builder clean      - call make clean for all subprojects
#      kdenlive_builder build      - call configure and make and make install for all subprojects
#      kdenlive_builder info       - print revision numbers and dates for each component


# Modify the destination directory if you want
# Or you can copy it afterwars to /opt/kdenlive- or wherever you want.
# Caution: if you pick /usr here, you system kdenlive, ffmpeg  and mlt will be overwritten!
#export DEST_DIR=~/build/kdenlive.$(date +%F_%H_%M)
export DEST_DIR=~/build/kdenlive

case "$1" in

"getsources")
# Download sources of ffmpeg, mtl, mlt++, kdenlive from their SVNs
# Call this as a very first command, call it once, then use updatesources (quicker)
# Subdirectories are created by this command
svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg &&
svn co https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt mlt &&
svn co https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++ mlt++ &&
svn co https://kdenlive.svn.sourceforge.net/svnroot/kdenlive/trunk/kdenlive
;;

"updatesources")
# The same as 'getsources' but quicker
# You must have already all sorces downloaded prior to call this!
cd ffmpeg &&
svn update &&
cd ../mlt &&
svn update &&
cd ../mlt++ &&
svn update &&
cd ../kdenlive &&
svn update
;;

"clean")
cd ffmpeg
make clean
cd ../mlt
make clean
cd ../mlt++
make clean
cd ../kdenlive
make clean
;;

"build")
export PATH=$DEST_DIR/bin:$PATH
export LD_RUN_PATH=../lib

cd ffmpeg &&

#
# FFmpeg configuration settings explained:
#
# Note: Most of the options mean that an external library is required! Remember, many codecs, especially audio codecs,
# are NOT implemented by FFmpeg, or the implementation is inferior.
#
# --enable-gpl        .. enable GPLed libraries, like swscaller - ESSENTIAL, REQUIRED by MLT
# --enable-swscaler   .. enable SW scaller, statically linked lib handled by ffmpeg but GPL - ESSENTIAL, REQUIRED by MLT
# --enable-libmp3lame .. support for mp3 audio codec - STRONGLY RECOMMENDED
# --enable-liba52     .. support for ACC (aka A52) audio codec used in DVDs - STRONGLY RECOMMENDED
# --enable-libogg     .. support for OGG format - RECOMMENDED
# --enable-pp         .. enable post processing of video - required??
# --enable-libtheora  .. support for theora video codec by external lib - RECOMMENDED
# --enable-libvorbis  .. support for theora video codec by external lib - RECOMMENDED
# --enable-libx264    .. support for high quality H264 codec, extern. lib - GOOD TO HAVE
# --enable-libfaad    .. support for Advaced Audio codec - AAC (iPod, some mp4) - GOOD TO HAVE
# --enable-libfaac    .. altern. support for Advaced Audio codec - AAC (iPod, some mp4) - GOOD TO HAVE
#
# --enable-vhook      .. have no idea what is this good for, set on by default
# --enable-x11grab    .. have no idea what is this good for, set on by default
#
# --enable-libgsm     .. support for low bandwith GSM audio codec, mostly speach, not much used in movies
# --enable-libxvid    .. Xvid codec support is well handled by FFmpeg itself - NOT RECOMMENDED
# --enable-amr_nb     .. support for audio codec, not widely used ?
# --enable-amr_wb     .. support for audio codec, not widely used ?
# --enable-libdts     .. support for audio? codec, not widely used ?
#
# --disable-strip     .. disable stipping of debugging symbols to ease debugging
# --enable-debug      .. DEBUGGING support is swith ON by default. For a final distribution wise version remove this paramater
#

# --enable-libogg  ..deprecated, ogg is now supported natively (only) by ffmpeg - Espinosa 25.11.2007

./configure --prefix=$DEST_DIR \
--enable-gpl \
--enable-shared \
--enable-swscaler \
--enable-pp \
--enable-libtheora \
--enable-libmp3lame \
--enable-libvorbis \
--enable-liba52 \
--disable-strip \
--enable-debug &&
make &&
make install &&

cd ../mlt &&
./configure --prefix=$DEST_DIR --enable-gpl --avformat-swscale --enable-motion-est --enable-mmx --enable-debug --disable-gtk2 &&
make &&
make install &&


cd ../mlt++ &&
./configure --prefix=$DEST_DIR --enable-debug &&
make &&
make install &&


cd ../kdenlive &&
rm -f CMakeCache.txt &&
cmake -DCMAKE_INSTALL_PREFIX=$DEST_DIR -DCMAKE_BUILD_TYPE=debugfull . &&
make &&
make install
;;

"info")
# Print SVN revision number and udate date for each component
# Good to know when reporting an error
cd ffmpeg
echo "FFmpeg SVN version:"
LANG=C LC_TIME=C svn info | grep '\(Revision\|Last\ Changed\ Date\)'
cd ../mlt
echo "MLT SVN version:"
LANG=C LC_TIME=C svn info | grep '\(Revision\|Last\ Changed\ Date\)'
cd ../mlt++
echo "MLT++ SVN version:"
LANG=C LC_TIME=C svn info | grep '\(Revision\|Last\ Changed\ Date\)'
cd ../kdenlive
echo "Kdenlive SVN version:"
LANG=C LC_TIME=C svn info | grep '\(Revision\|Last\ Changed\ Date\)'
;;

*)
# print some help
echo 'Kdenlive & ffmpeg & mlt & mlt++ build script utilizing LD_RUN_PATH'
echo 'Set DEST_DIR in script, otherwise ~/build/kdenlive is used by default'
echo 'Usage: '
echo '      kdenlive_builder getsources - call svn to get sources for all subprojects for the first time'
echo '      kdenlive_builder updatesources - call svn to update sources for all subprojects'
echo '      kdenlive_builder clean - clean subdirs. Recommended to call prior to build'
echo '      kdenlive_builder build - build and instal all sources to user defined directory'
echo '      kdenlive_builder info  - print revision numbers and dates for each component'
;;

esac

# Changelog:
# v1.0 - 16.6.2007
#    initial version
# v2.0 - 27.6.2007
#    support for debugging
#    fixes by Olo
#    better ffmpeg help
#    revision number printing, etc.
# SVN revision 3 - 2007-07-07
# v3.0 - adapt for recent CMake adoption in Kdenlive
# import into SVN on Google project hosting

It is based on my older version BTW.

The thing is, it doesn't work due CMake issues when dealing with libs in non /usr directory (as you already pointed out). It is work in progress so check Mantise for related bugreports when they are fixed. J-B-M seems to work on it.

http://www.kdenlive.org/mantis/view.php?id=44

- fixed

http://www.kdenlive.org/mantis/view.php?id=51

- new issue

OK, I cracked the issue No. 51 myself :)
The problem WAS in the script.
CMake simply react little bit differently then Automake and I am no guru in any of them.
The trick was in setting *both* LD_RUN_PATH *and* LD_LIBRARY_PATH. For more info see Mantise bugzilla.

Here is the WORKING version of build script:

#!/bin/bash
# Script for easy and SAFE Kdenlive & ffmpeg & mlt & mlt++ build utilizing LD_RUN_PATH
# All subprojects are compiled and installed to specified non-system directory.
# You can safely keep multiple kdenlive/ffmpeg versions.
#
# This sript ensures, that kdenlive will call only desired ffmpeg and mlt libs.
# Using LD_RUN_PATH is a better, more general, alternative to statically link it all together.
# You can verify this it by calling
# cd ~/build/kdenlive/bin && ldd ./kdenlive
# - or -
# cd ~/build/kdenlive/bin && LD_DEBUG=libs ./kdenlive
# Set DEST_DIR in script, otherwise ~/build/kdenlive is used by default.
#
# Espinosa, Aleksander Adamowski (Olo)
# $Id$
#
#
# Usage:
#      kdenlive_builder getsources - call svn to get sources for all subprojects for the first time
#      kdenlive_builder updatesources - call svn to update sources for all subprojects
#      kdenlive_builder clean      - call make clean for all subprojects
#      kdenlive_builder build      - call configure and make and make install for all subprojects
#      kdenlive_builder info       - print revision numbers and dates for each component


# Modify the destination directory if you want
# Or you can copy it afterwars to /opt/kdenlive- or wherever you want.
# Caution: if you pick /usr here, you system kdenlive, ffmpeg  and mlt will be overwritten!
#export DEST_DIR=~/build/kdenlive.$(date +%F_%H_%M)
export DEST_DIR=~/build/kdenlive

case "$1" in

"getsources")
# Download sources of ffmpeg, mtl, mlt++, kdenlive from their SVNs
# Call this as a very first command, call it once, then use updatesources (quicker)
# Subdirectories are created by this command
svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg &&
svn co https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt mlt &&
svn co https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++ mlt++ &&
svn co https://kdenlive.svn.sourceforge.net/svnroot/kdenlive/trunk/kdenlive
;;

"updatesources")
# The same as 'getsources' but quicker
# You must have already all sorces downloaded prior to call this!
cd ffmpeg &&
svn update &&
cd ../mlt &&
svn update &&
cd ../mlt++ &&
svn update &&
cd ../kdenlive &&
svn update
;;

"clean")
cd ffmpeg
make clean
cd ../mlt
make clean
cd ../mlt++
make clean
cd ../kdenlive
make clean
;;

"build")
export PATH=$DEST_DIR/bin:$PATH
export LD_RUN_PATH=../lib
export LD_LIBRARY_PATH=$DEST_DIR/lib:$LD_LIBRARY_PATH  

cd ffmpeg &&

#
# FFmpeg configuration settings explained:
#
# Note: Most of the options mean that an external library is required! Remember, many codecs, especially audio codecs,
# are NOT implemented by FFmpeg, or the implementation is inferior.
#
# --enable-gpl        .. enable GPLed libraries, like swscaller - ESSENTIAL, REQUIRED by MLT
# --enable-swscaler   .. enable SW scaller, statically linked lib handled by ffmpeg but GPL - ESSENTIAL, REQUIRED by MLT
# --enable-libmp3lame .. support for mp3 audio codec - STRONGLY RECOMMENDED
# --enable-liba52     .. support for ACC (aka A52) audio codec used in DVDs - STRONGLY RECOMMENDED
# --enable-libogg     .. support for OGG format - RECOMMENDED
# --enable-pp         .. enable post processing of video - required??
# --enable-libtheora  .. support for theora video codec by external lib - RECOMMENDED
# --enable-libvorbis  .. support for theora video codec by external lib - RECOMMENDED
# --enable-libx264    .. support for high quality H264 codec, extern. lib - GOOD TO HAVE
# --enable-libfaad    .. support for Advaced Audio codec - AAC (iPod, some mp4) - GOOD TO HAVE
# --enable-libfaac    .. altern. support for Advaced Audio codec - AAC (iPod, some mp4) - GOOD TO HAVE
#
# --enable-vhook      .. have no idea what is this good for, set on by default
# --enable-x11grab    .. have no idea what is this good for, set on by default
#
# --enable-libgsm     .. support for low bandwith GSM audio codec, mostly speach, not much used in movies
# --enable-libxvid    .. Xvid codec support is well handled by FFmpeg itself - NOT RECOMMENDED
# --enable-amr_nb     .. support for audio codec, not widely used ?
# --enable-amr_wb     .. support for audio codec, not widely used ?
# --enable-libdts     .. support for audio? codec, not widely used ?
#
# --disable-strip     .. disable stipping of debugging symbols to ease debugging
# --enable-debug      .. DEBUGGING support is swith ON by default. For a final distribution wise version remove this paramater
#

# --enable-libogg  ..deprecated, ogg is now supported natively (only) by ffmpeg - Espinosa 25.11.2007

./configure --prefix=$DEST_DIR \
--enable-gpl \
--enable-shared \
--enable-swscaler \
--enable-pp \
--enable-libtheora \
--enable-libmp3lame \
--enable-libvorbis \
--enable-liba52 \
--disable-strip \
--enable-debug &&
make &&
make install &&

cd ../mlt &&
./configure --prefix=$DEST_DIR --enable-gpl --avformat-swscale --enable-motion-est --enable-mmx --enable-debug --disable-gtk2 &&
make &&
make install &&


cd ../mlt++ &&
./configure --prefix=$DEST_DIR --enable-debug &&
make &&
make install &&


cd ../kdenlive &&
rm -f CMakeCache.txt &&
cmake -DCMAKE_INSTALL_PREFIX=$DEST_DIR -DCMAKE_BUILD_TYPE=debugfull . &&
make &&
make install
;;

"info")
# Print SVN revision number and udate date for each component
# Good to know when reporting an error
cd ffmpeg
echo "FFmpeg SVN version:"
LANG=C LC_TIME=C svn info | grep '\(Revision\|Last\ Changed\ Date\)'
cd ../mlt
echo "MLT SVN version:"
LANG=C LC_TIME=C svn info | grep '\(Revision\|Last\ Changed\ Date\)'
cd ../mlt++
echo "MLT++ SVN version:"
LANG=C LC_TIME=C svn info | grep '\(Revision\|Last\ Changed\ Date\)'
cd ../kdenlive
echo "Kdenlive SVN version:"
LANG=C LC_TIME=C svn info | grep '\(Revision\|Last\ Changed\ Date\)'
;;

*)
# print some help
echo 'Kdenlive & ffmpeg & mlt & mlt++ build script utilizing LD_RUN_PATH'
echo 'Set DEST_DIR in script, otherwise ~/build/kdenlive is used by default'
echo 'Usage: '
echo '      kdenlive_builder getsources - call svn to get sources for all subprojects for the first time'
echo '      kdenlive_builder updatesources - call svn to update sources for all subprojects'
echo '      kdenlive_builder clean - clean subdirs. Recommended to call prior to build'
echo '      kdenlive_builder build - build and instal all sources to user defined directory'
echo '      kdenlive_builder info  - print revision numbers and dates for each component'
;;

esac

# Changelog:
# v1.0 - 16.6.2007
#    initial version
# v2.0 - 27.6.2007
#    support for debugging
#    fixes by Olo
#    better ffmpeg help
#    revision number printing, etc.
# SVN revision 3 - 2007-07-07
# v3.0 - adapt for recent CMake adoption in Kdenlive
# import into SVN on Google project hosting

Olo and herrej01 please update your scripts accordingly.

Thank you for your help, I could compile with your script.
Now there are many installation scripts... :|
The svn of googlecode is not the latest one. How can one ensure to always get the latest version of this extremly useful script, except than by browsing on the forum? Maybe a line on the wiki with the svn command to get it would be useful. :roll:
Thanks again,
olefebvr