App installed in ~/usr launches from terminal but not Applications menu (or why does setting ld_library_path in .profile not work as it should)
- by levesque
I have built and installed an application under a directory of my choosing, let's say under /home/jim/usr, so files have been put in three-four folders, all under this $HOME/usr folder (e.g., bin, include, lib, share, etc.).
I can launch this application from the command line just fine as I added the proper paths to my environement variables PATH and LD_LIBRARY_PATH in ~/.bashrc.
I added the same paths to the ~/.profile file, which, if I'm not mistaken, is supposed to be parsed by Ubuntu.
Doesn't work. Nothing. Where can I go from there?
EDIT: I logged out/in and restarted my computer. Both didn't change a thing. The problem seems to come from the fact that no matter what I do the LD_LIBRARY_PATH environment variable is not properly passed to Ubuntu.
Using log files, I found that the application I'm trying to run in this example doesn't find one it's dependencies located in ~/usr/lib.
One solution would be to add the /home/jim/usr/lib folder inside a file located in /etc/ld.so.conf.d/, but I don't have admin rights on this machine.
Making a wrapper script like this one works:
#!/bin/bash
export LD_LIBRARY_PATH=$HLOC/usr/lib
application &> $HOME/application_messages.log
but that would force me to wrap all my home compiled applications with this script. Any ideas?
Why does Ubuntu/Gnome remove the LD_LIBRARY_PATH environment variable from my set variables? Is it because trying to do this is bad practice?
UPDATE (and solution): As found by Christopher, there is a bug report about this on launchpad. LD_LIBRARY_PATH is unset after parsing of the ~/.profile file. See the bug report. Seems the only solution for now is to make a wrapper script.