If there is no LIBRARY_PATH set in the environment, the line in ./df sets it to ":./libs", which works just fine. No problem there.
Err, no. Your changing LD_LIBRARY_PATH to ":./libs" is definitely messing something up.
As a proof, this is the output of
ldd dwarfort.exe, where you can see that it knows where to find every library except for:
libboost_regex.so.1.35.0 => not found
libgraphics.so => not found
that you bundle.
$ ldd dwarfort.exe
linux-gate.so.1 => (0xf77bc000)
libgtk-x11-2.0.so.0 => /usr/lib32/libgtk-x11-2.0.so.0 (0xf73dd000)
libgdk-x11-2.0.so.0 => /usr/lib32/libgdk-x11-2.0.so.0 (0xf7348000)
libatk-1.0.so.0 => /usr/lib32/libatk-1.0.so.0 (0xf732a000)
libpangoft2-1.0.so.0 => /usr/lib32/libpangoft2-1.0.so.0 (0xf7301000)
libgdk_pixbuf-2.0.so.0 => /usr/lib32/libgdk_pixbuf-2.0.so.0 (0xf72e7000)
libpangocairo-1.0.so.0 => /usr/lib32/libpangocairo-1.0.so.0 (0xf72da000)
libgio-2.0.so.0 => /usr/lib32/libgio-2.0.so.0 (0xf7244000)
libcairo.so.2 => /usr/lib32/libcairo.so.2 (0xf71bc000)
libpango-1.0.so.0 => /usr/lib32/libpango-1.0.so.0 (0xf7174000)
libfreetype.so.6 => /usr/lib32/libfreetype.so.6 (0xf70f5000)
libfontconfig.so.1 => /usr/lib32/libfontconfig.so.1 (0xf70c8000)
libgobject-2.0.so.0 => /usr/lib32/libgobject-2.0.so.0 (0xf708a000)
libgmodule-2.0.so.0 => /usr/lib32/libgmodule-2.0.so.0 (0xf7084000)
libglib-2.0.so.0 => /lib32/libglib-2.0.so.0 (0xf6fce000)
libopenal.so.1 => /usr/lib32/libopenal.so.1 (0xf6eb1000)
libsndfile.so.1 => /usr/lib32/libsndfile.so.1 (0xf6e45000)
libSDL-1.2.so.0 => /usr/lib32/libSDL-1.2.so.0 (0xf6dab000)
libSDL_image-1.2.so.0 => /usr/lib32/libSDL_image-1.2.so.0 (0xf6d8d000)
libGLU.so.1 => /usr/lib32/libGLU.so.1 (0xf6d1d000)
libboost_regex.so.1.35.0 => not found
libgraphics.so => not found
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf6c2b000)
libm.so.6 => /lib32/libm.so.6 (0xf6c04000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf6be6000)
libc.so.6 => /lib32/libc.so.6 (0xf6aa1000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf6a88000)
libX11.so.6 => /usr/lib32/libX11.so.6 (0xf6959000)
libXcomposite.so.1 => /usr/lib32/libXcomposite.so.1 (0xf6955000)
libXdamage.so.1 => /usr/lib32/libXdamage.so.1 (0xf6951000)
libXfixes.so.3 => /usr/lib32/libXfixes.so.3 (0xf694b000)
libXext.so.6 => /usr/lib32/libXext.so.6 (0xf693b000)
libXrender.so.1 => /usr/lib32/libXrender.so.1 (0xf6931000)
libXinerama.so.1 => /usr/lib32/libXinerama.so.1 (0xf692e000)
libXi.so.6 => /usr/lib32/libXi.so.6 (0xf6922000)
libXrandr.so.2 => /usr/lib32/libXrandr.so.2 (0xf6919000)
libXcursor.so.1 => /usr/lib32/libXcursor.so.1 (0xf690e000)
libz.so.1 => /usr/lib32/libz.so.1 (0xf68f8000)
libdl.so.2 => /lib32/libdl.so.2 (0xf68f4000)
libpcre.so.3 => /lib32/libpcre.so.3 (0xf68c2000)
libresolv.so.2 => /lib32/libresolv.so.2 (0xf68ae000)
libselinux.so.1 => /lib32/libselinux.so.1 (0xf6893000)
libpixman-1.so.0 => /usr/lib32/libpixman-1.so.0 (0xf684c000)
libdirectfb-1.2.so.0 => /usr/lib32/libdirectfb-1.2.so.0 (0xf67d2000)
libfusion-1.2.so.0 => /usr/lib32/libfusion-1.2.so.0 (0xf67c7000)
libdirect-1.2.so.0 => /usr/lib32/libdirect-1.2.so.0 (0xf67af000)
libpng12.so.0 => /usr/lib32/libpng12.so.0 (0xf6787000)
libxcb-render-util.so.0 => /usr/lib32/libxcb-render-util.so.0 (0xf6782000)
libxcb-render.so.0 => /usr/lib32/libxcb-render.so.0 (0xf6779000)
libxcb.so.1 => /usr/lib32/libxcb.so.1 (0xf675a000)
libexpat.so.1 => /lib32/libexpat.so.1 (0xf6733000)
libFLAC.so.8 => /usr/lib32/libFLAC.so.8 (0xf66e3000)
libvorbisenc.so.2 => /usr/lib32/libvorbisenc.so.2 (0xf65e9000)
libvorbis.so.0 => /usr/lib32/libvorbis.so.0 (0xf65be000)
libogg.so.0 => /usr/lib32/libogg.so.0 (0xf65b6000)
libasound.so.2 => /usr/lib32/libasound.so.2 (0xf64ee000)
libjpeg.so.62 => /usr/lib32/libjpeg.so.62 (0xf64ca000)
libtiff.so.4 => /usr/lib32/libtiff.so.4 (0xf6471000)
libGL.so.1 => /usr/lib32/libGL.so.1 (0xf63e0000)
/lib/ld-linux.so.2 (0xf77bd000)
libXau.so.6 => /usr/lib32/libXau.so.6 (0xf63db000)
libXdmcp.so.6 => /usr/lib32/libXdmcp.so.6 (0xf63d6000)
librt.so.1 => /lib32/librt.so.1 (0xf63cd000)
Now look at what happens if I prepend your command:
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./libs" ldd dwarfort.exe
linux-gate.so.1 => (0xf7778000)
libgtk-x11-2.0.so.0 => /usr/lib32/libgtk-x11-2.0.so.0 (0xf7399000)
libgdk-x11-2.0.so.0 => /usr/lib32/libgdk-x11-2.0.so.0 (0xf7304000)
libatk-1.0.so.0 => /usr/lib32/libatk-1.0.so.0 (0xf72e6000)
libpangoft2-1.0.so.0 => /usr/lib32/libpangoft2-1.0.so.0 (0xf72bd000)
libgdk_pixbuf-2.0.so.0 => /usr/lib32/libgdk_pixbuf-2.0.so.0 (0xf72a3000)
libpangocairo-1.0.so.0 => /usr/lib32/libpangocairo-1.0.so.0 (0xf7296000)
libgio-2.0.so.0 => /usr/lib32/libgio-2.0.so.0 (0xf7200000)
libcairo.so.2 => /usr/lib32/libcairo.so.2 (0xf7178000)
libpango-1.0.so.0 => /usr/lib32/libpango-1.0.so.0 (0xf7130000)
libfreetype.so.6 => /usr/lib32/libfreetype.so.6 (0xf70b1000)
libfontconfig.so.1 => /usr/lib32/libfontconfig.so.1 (0xf7084000)
libgobject-2.0.so.0 => /usr/lib32/libgobject-2.0.so.0 (0xf7046000)
libgmodule-2.0.so.0 => /usr/lib32/libgmodule-2.0.so.0 (0xf7040000)
libglib-2.0.so.0 => /lib32/libglib-2.0.so.0 (0xf6f8a000)
libopenal.so.1 => /usr/lib32/libopenal.so.1 (0xf6e6d000)
libsndfile.so.1 => /usr/lib32/libsndfile.so.1 (0xf6e01000)
libSDL-1.2.so.0 => /usr/lib32/libSDL-1.2.so.0 (0xf6d67000)
libSDL_image-1.2.so.0 => /usr/lib32/libSDL_image-1.2.so.0 (0xf6d49000)
libGLU.so.1 => /usr/lib32/libGLU.so.1 (0xf6cd9000)
libboost_regex.so.1.35.0 => ./libs/libboost_regex.so.1.35.0 (0xf6cd7000)
libgraphics.so => ./libs/libgraphics.so (0xf6925000)
libstdc++.so.6 => ./libs/libstdc++.so.6 (0xf6831000)
libm.so.6 => /lib32/libm.so.6 (0xf680a000)
libgcc_s.so.1 => ./libs/libgcc_s.so.1 (0xf67fb000)
libc.so.6 => /lib32/libc.so.6 (0xf66b6000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf669d000)
libX11.so.6 => /usr/lib32/libX11.so.6 (0xf656e000)
libXcomposite.so.1 => /usr/lib32/libXcomposite.so.1 (0xf6569000)
libXdamage.so.1 => /usr/lib32/libXdamage.so.1 (0xf6566000)
libXfixes.so.3 => /usr/lib32/libXfixes.so.3 (0xf6560000)
libXext.so.6 => /usr/lib32/libXext.so.6 (0xf6550000)
libXrender.so.1 => /usr/lib32/libXrender.so.1 (0xf6546000)
libXinerama.so.1 => /usr/lib32/libXinerama.so.1 (0xf6542000)
libXi.so.6 => /usr/lib32/libXi.so.6 (0xf6537000)
libXrandr.so.2 => /usr/lib32/libXrandr.so.2 (0xf652e000)
libXcursor.so.1 => /usr/lib32/libXcursor.so.1 (0xf6523000)
libz.so.1 => /usr/lib32/libz.so.1 (0xf650d000)
libdl.so.2 => /lib32/libdl.so.2 (0xf6508000)
libpcre.so.3 => /lib32/libpcre.so.3 (0xf64d7000)
libresolv.so.2 => /lib32/libresolv.so.2 (0xf64c3000)
libselinux.so.1 => /lib32/libselinux.so.1 (0xf64a8000)
libpixman-1.so.0 => /usr/lib32/libpixman-1.so.0 (0xf6461000)
libdirectfb-1.2.so.0 => /usr/lib32/libdirectfb-1.2.so.0 (0xf63e6000)
libfusion-1.2.so.0 => /usr/lib32/libfusion-1.2.so.0 (0xf63dc000)
libdirect-1.2.so.0 => /usr/lib32/libdirect-1.2.so.0 (0xf63c4000)
libpng12.so.0 => /usr/lib32/libpng12.so.0 (0xf639c000)
libxcb-render-util.so.0 => /usr/lib32/libxcb-render-util.so.0 (0xf6397000)
libxcb-render.so.0 => /usr/lib32/libxcb-render.so.0 (0xf638d000)
libxcb.so.1 => /usr/lib32/libxcb.so.1 (0xf636f000)
libexpat.so.1 => /lib32/libexpat.so.1 (0xf6348000)
libFLAC.so.8 => /usr/lib32/libFLAC.so.8 (0xf62f8000)
libvorbisenc.so.2 => /usr/lib32/libvorbisenc.so.2 (0xf61fe000)
libvorbis.so.0 => /usr/lib32/libvorbis.so.0 (0xf61d2000)
libogg.so.0 => /usr/lib32/libogg.so.0 (0xf61cb000)
libasound.so.2 => /usr/lib32/libasound.so.2 (0xf6103000)
libjpeg.so.62 => /usr/lib32/libjpeg.so.62 (0xf60df000)
libtiff.so.4 => ./libs/libtiff.so.4 (0xf6086000)
libGL.so.1 => /usr/lib32/libGL.so.1 (0xf5ff4000)
/lib/ld-linux.so.2 (0xf7779000)
libXau.so.6 => /usr/lib32/libXau.so.6 (0xf5ff0000)
libXdmcp.so.6 => /usr/lib32/libXdmcp.so.6 (0xf5feb000)
librt.so.1 => /lib32/librt.so.1 (0xf5fe1000)
libjpeg.so.8 => not found
Now it looks for different libjpeg versions, and complains about not finding libjpeg.so.8.
It also now loads a whole bunch of libraries from ./libs instead of the system folders, even down to
libstdc++.so.6 => ./libs/libstdc++.so.6
If I don't add /lib32:/usr/lib32/ to LD_LIBRARY_PATH as I described in my previous post, here's what I get in the console:
./df
./dwarfort.exe: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory
This is with the HEAD tarball btw (which only contains a library file).
Thinking about it, I believe this is the problem: when the program defaults to loading from ./libs, since it loads your libs first, and then the system ones, it must load a mix of libraries that have dependencies on various versions of libjpeg. Does one of your libs depend on libjpeg.so.8?
When I add /lib32:/usr/lib32/ before ./libs, it reverts to loading system libraries first, and it fixes the problem. But we can't expect every user to do this manually.
They are trying to deprecate LD_LIBRARY_PATH in the Unix/Linux world. So why not do things the proper way, especially since it's dead-easy? (Unless there's a portability issue I don't know about...) Just configure your scons file so you end up with
-Wl,-rpath,'$ORIGIN/libs' as a compiler option to gcc. This way you don't mess with system variables of evil repute, and it may even fix the problem above, by preserving the correct loading order of libraries (system first, then your custom ones).
The scratchy sound is a common consequence of using pulseaudio, apparently. What can I say? Pulse is a POS.
I don't even get scratchy sound, though. Just silence.