Announcement

Collapse
No announcement yet.

Menu items don't see environment variables

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Menu items don't see environment variables

    Hi all,

    I'm having a problem running custom applications from the K menu.  I have created a menu item for my custom application using the menu editor.  I have some custom environment variables set up in my $HOME/.bashrc, such as PATH and LD_LIBRARY_PATH.  These additional variables point to software I have compiled and installed in /usr/local. 

    When I run the app from the menu, nothing happens.  I see from ~/.xsession-errors that it can't load libraries pointed to by LD_LIBRARY_PATH. 

    So, how do I get customized environment variables to be recognized from the desktop?  Thanks!

    Paul

    #2
    Re: Menu items don't see environment variables

    Paul,

    in order to make your new variable (LD_LIBRARY_PATH) available to other applications, you have to publish it, so to speak - the following two-liner should do the trick:

    Code:
    LD_LIBRARY_PATH="[some stuff]"
    export LD_LIBRARY_PATH
    Remark: PATH is a variable allready in use on a system-wide scale ... therefore, "resetting" this one may proof lethal (!). However, adding contents should work without doing any harm - as follows:

    Code:
    PATH=$PATH:"[additional stuff]"
    export PATH
    HTH
    Birdy

    Comment


      #3
      Re: Menu items don't see environment variables

      Sorry, maybe I should have been more specific.  Here is a snippet from my ~/.bashrc:

      Code:
      LOCAL_DIR=/usr/local
      export PATH=$LOCAL_DIR/bin:$PATH
      export MAN_PATH=$LOCAL_DIR/man:$MAN_PATH
      export LD_LIBRARY_PATH=$LOCAL_DIR/lib:$LD_LIBRARY_PATH
      My app in /usr/local/bin runs fine when run from a terminal.  When I create the K Menu item, I must give the full path, or it is not recognized.  This is because ~/.bashrc is not run when a menu item is selected.

      Unfortunately, specifying the full path does no good.  Even though the program is run (due to the full path), it fails soon after, unable to load libraries that exist in /usr/local/lib.

      Comment


        #4
        Re: Menu items don't see environment variables

        O.k. ... and what happens when you move your code from the "local" ~/.bashrc to the "global" /etc/bashrc or /etc/profile (depending on your system's configuration)?

        Comment


          #5
          Re: Menu items don't see environment variables

          Originally posted by penguin.ch
          O.k. ... and what happens when you move your code from the "local" ~/.bashrc to the "global" /etc/bashrc or /etc/profile (depending on your system's configuration)?
          It does work, but that's a pretty drastic step, forcing all users to accept my configuration.

          What if I wanted KDE to be able to execute my binaries in /home/paul/bin, while fred want's his KDE to know about his binaries in /home/fred/mystuff/bin?  Do we need to pollute /etc/bashrc with all of this?

          The bottom line is that KDE is not reading .bashrc when starting up an icon.  Is there any way to have it do this?  Thanks!

          Comment


            #6
            Re: Menu items don't see environment variables

            Will putting your user PATH to .bash_profile instead of .bashrc help?

            Comment


              #7
              Re: Menu items don't see environment variables

              Originally posted by pwaldo
              Originally posted by penguin.ch
              O.k. ... and what happens when you move your code from the "local" ~/.bashrc to the "global" /etc/bashrc or /etc/profile (depending on your system's configuration)?
              It does work, but that's a pretty drastic step, forcing all users to accept my configuration. [...]
              The bottom line is that KDE is not reading .bashrc when starting up an icon. Is there any way to have it do this?
              I allow your objection in the meantime, I have done some more research and may have found something useful: http://www.linuxjournal.com/article/7718.

              Birdy

              Comment

              Working...
              X