[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [fluid-dev] Linking question
From: |
Pedro Lopez-Cabanillas |
Subject: |
Re: [fluid-dev] Linking question |
Date: |
Sun, 17 Oct 2010 16:57:21 +0200 |
User-agent: |
KMail/1.13.5 (Linux/2.6.34.7-0.4-desktop; KDE/4.4.4; i686; ; ) |
On Sunday 17 October 2010, David Henningsson wrote:
> Build FS from trunk with CMake, with Ubuntu Maverick,
> then trying to install it locally:
>
> $ sudo make install
> [ 97%] Built target libfluidsynth
> [100%] Built target fluidsynth
> Install the project...
> -- Install configuration: "Debug"
> -- Installing: /usr/local/lib64/pkgconfig/fluidsynth.pc
> -- Installing: /usr/local/bin/fluidsynth
> -- Removed runtime path from "/usr/local/bin/fluidsynth"
> -- Installing: /usr/local/lib64/libfluidsynth.so.1.4.1
> -- Up-to-date: /usr/local/lib64/libfluidsynth.so.1
> -- Up-to-date: /usr/local/lib64/libfluidsynth.so
> -- Removed runtime path from "/usr/local/lib64/libfluidsynth.so.1.4.1"
> -- Installing: /usr/local/include/fluidsynth.h
> -- Installing: /usr/local/include/fluidsynth/audio.h
> -- Installing: /usr/local/include/fluidsynth/event.h
> -- Installing: /usr/local/include/fluidsynth/gen.h
> -- Installing: /usr/local/include/fluidsynth/log.h
> -- Installing: /usr/local/include/fluidsynth/midi.h
> -- Installing: /usr/local/include/fluidsynth/misc.h
> -- Installing: /usr/local/include/fluidsynth/mod.h
> -- Installing: /usr/local/include/fluidsynth/ramsfont.h
> -- Installing: /usr/local/include/fluidsynth/seq.h
> -- Installing: /usr/local/include/fluidsynth/seqbind.h
> -- Installing: /usr/local/include/fluidsynth/settings.h
> -- Installing: /usr/local/include/fluidsynth/sfont.h
> -- Installing: /usr/local/include/fluidsynth/shell.h
> -- Installing: /usr/local/include/fluidsynth/synth.h
> -- Installing: /usr/local/include/fluidsynth/types.h
> -- Installing: /usr/local/include/fluidsynth/voice.h
> -- Installing: /usr/local/include/fluidsynth/version.h
> -- Installing: /usr/local/share/man/man1/fluidsynth.1
>
> Looks good, although I'm unsure what "Removed runtime path" means.
By default, CMake adds a RPATH property to the binaries in the build
directory, which is convenient to test the compiled programs without
installing. In this case, if you execute the fluidsynth program in the build
directory, or in the ldd output, you will see that the linked library is also
in the build tree.
$ objdump -x /path/to/libfluidsynth.so | grep RPATH
The default CMake behavior when installing the project is to remove the RPATH,
so the installed programs resolve the library references according to the
usual operating system rules.
More info about the CMake settings w.r.t. RPATH,
http://www.cmake.org/Wiki/CMake_RPATH_handling
> $ which fluidsynth
> /usr/local/bin/fluidsynth
>
> $ ldd /usr/local/bin/fluidsynth
> linux-vdso.so.1 => (0x00007fffe3dff000)
> libfluidsynth.so.1 => /usr/lib/libfluidsynth.so.1 (0x00007f5d2f145000)
> libc.so.6 => /lib/libc.so.6 (0x00007f5d2edc2000)
> libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f5d2ebbc000)
> librt.so.1 => /lib/librt.so.1 (0x00007f5d2e9b4000)
> libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f5d2e6d2000)
> liblash.so.3 => /usr/lib/liblash.so.3 (0x00007f5d2e4c0000)
> libdbus-1.so.3 => /lib/libdbus-1.so.3 (0x00007f5d2e27e000)
> libpthread.so.0 => /lib/libpthread.so.0 (0x00007f5d2e061000)
> libuuid.so.1 => /lib/libuuid.so.1 (0x00007f5d2de5b000)
> libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f5d2db0a000)
> libasound.so.2 => /usr/lib/libasound.so.2 (0x00007f5d2d82b000)
> libjack.so.0 => /usr/lib/libjack.so.0 (0x00007f5d2d60e000)
> libpulse-simple.so.0 => /usr/local/lib/libpulse-simple.so.0
> (0x00007f5d2d40a000)
> libpulse.so.0 => /usr/local/lib/libpulse.so.0 (0x00007f5d2d1c9000)
> libsndfile.so.1 => /usr/lib/libsndfile.so.1 (0x00007f5d2cf63000)
> libreadline.so.6 => /lib/libreadline.so.6 (0x00007f5d2cd22000)
> libm.so.6 => /lib/libm.so.6 (0x00007f5d2ca9f000)
> libdl.so.2 => /lib/libdl.so.2 (0x00007f5d2c89a000)
> /lib64/ld-linux-x86-64.so.2 (0x00007f5d2f429000)
> libpcre.so.3 => /lib/libpcre.so.3 (0x00007f5d2c669000)
> libz.so.1 => /lib/libz.so.1 (0x00007f5d2c450000)
> libpulsecommon-0.9.21.so => /usr/local/lib/libpulsecommon-0.9.21.so
> (0x00007f5d2c202000)
> libFLAC.so.8 => /usr/lib/libFLAC.so.8 (0x00007f5d2bfb7000)
> libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x00007f5d2bae8000)
> libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x00007f5d2b8bc000)
> libogg.so.0 => /usr/lib/libogg.so.0 (0x00007f5d2b6b4000)
> libncurses.so.5 => /lib/libncurses.so.5 (0x00007f5d2b470000)
> libwrap.so.0 => /lib/libwrap.so.0 (0x00007f5d2b265000)
> libnsl.so.1 => /lib/libnsl.so.1 (0x00007f5d2b04a000)
>
> Notice the second line:
>
> libfluidsynth.so.1 => /usr/lib/libfluidsynth.so.1 (0x00007f5d2f145000)
>
> ...shouldn't this be /usr/local/lib64/libfluidsynth.so.1 ? (For
> reference, I've also tried LIB_SUFFIX= to make it install in /usr/lib
> instead, but without success. As you see, my local pulseaudio
> installation is linked to successfully.
>
> I assume that means the binary is calling the wrong library to do all
> the work.
You have two libfluidsynth libraries, one at /usr/lib and another one
installed just now, at /usr/local/lib64. Without setting the RPATH, the
dynamic loader is going to resolve one of them looking first in /lib and
/usr/lib, and then in the paths configured in "/etc/ld.so.conf". There is a
file caching the known libraries, at "/etc/ld.so.cache". To check:
# ldconfig -p | grep libfluidsynth
If you need to keep two installed libraries, and you don't want to use RPATH
on these installed binaries, then you may want to use the environment variable
LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:...
Regards,
Pedro