Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Qt Creator installed on Ubuntu 10.04 LTS. When I launch Qt Creator from the desktop I can build the application I am working on but cannot run or debug it. After struggling quite a bit I found that LD_LIBRARY_PATH is not set for applications that are run from the desktop. If I start Qt Creator from bash (where LD_LIBRARY_PATH is set in .bashrc) everything runs and debugs perfectly.

How do I set LD_LIBRARY_PATH so that it is set for all running applications?

share|improve this question

This seems like a bug in the application itself. It should have a wrapper script that correctly sets any needed LD_LIBRARY_PATH variables. Be careful when writing such a script, though, since you do not want to have any empty portion of the LD_LIBRARY_PATH string between the colons it uses as path separators. For example, this could result in a bad path, if the variable was empty initially (resulting in a leading empty string before the colon):


So, when adding a path, you'll want to test for the empty string first. For example, using shell code:

share|improve this answer

Create a new file /etc/ containing:

# Begin /etc/
# whatever else #

Update the dynamic loader cache by running:

share|improve this answer

In addition to .bashrc, also set the environment variable in .profile. This file will get processed and loaded by your session, so it should affect everything running as your user. Also: This file says it is not read by Bash if .bashrc exists, but it seems to apply still (perhaps since Bash inherits the X session from where it was started). It doesn't hurt to have the variable in both files, though.

share|improve this answer
I tried creating .profile as well with no luck. – dwj Oct 28 '10 at 16:44
I read somewhere that there is a "safety" feature of Ubuntu(Debian?) that can't let you set LD_LIBRARY_PATH at startup since it is overwritten after loading .profile. There are still workarounds. – alfC Nov 7 '11 at 6:32

set it in /etc/bash.bashrc near the top to make a system wide change on bootup.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.