1

I have the following at the end of my .profile file on Ubuntu 18.04:

export PATH=$PATH:/home/tom/Desktop/PACS/moos-ivp/bin

export LD_LIBRARY_PATH=/home/tom/Programs/or-tools_Ubuntu-18.04-64bit_v7.2.6977/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/MATLAB/MATLAB_Runtime/v95/sys/os/glnxa64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/MATLAB/MATLAB_Runtime/v95/bin/glnxa64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/MATLAB/MATLAB_Runtime/v95/runtime/glnxa64

export matlabroot=/usr/local/MATLAB/MATLAB_Runtime/v95

PATH and matlabroot are available to my session after logging in, however, LD_LIBRARY_PATH always returns empty. Unless I source the file manually.

What am I doing wrong?

SirCipher
  • 111
  • 3

1 Answers1

1

Do you have PATH and matlabroot sourced elsewhere, e.g. in .bashrc file?

~/.profile is only sourced for interactive login shells. If you're starting a shell that's interactive, then ~/.bashrc (or your shell of choice) is sourced.

Bart
  • 2,151
  • 1
  • 10
  • 26
  • 1
    see https://superuser.com/questions/183870/difference-between-bashrc-and-bash-profile/183980#183980 for more information – Bart Jul 26 '19 at 11:31
  • No, I don't. It is only defined in .profile. The trouble I'm having is that if I define these exports elsewhere then IntelliJ/Gradle cannot see the variables. Is it possible that the multiple exports for LD_LIBRARY_PATH are causing an issue? – SirCipher Jul 26 '19 at 11:32
  • 1
    define them in `.profile` for IntelliJ and in your `.bashrc` for cli operation. No, multliple exports of `LD_LIBRARY_PATH` will not be an issue unless you export `LD_LIBRARY_PATH` **later** without `MATLAB_Runtime` – Bart Jul 26 '19 at 11:33
  • I will give this a go, thank you. I am still confused as to why my terminal cannot see the LD_LIBRARY_PATH source but can see PATH and matlabroot – SirCipher Jul 26 '19 at 11:37
  • you must export that somewhere, possibly systemwide – Bart Jul 26 '19 at 11:37
  • 1
    @Bart: you should *not* put environment variable definitions in ~/.bashrc - those should go in ~/.profile. Indeed, the link that you provided says so (correctly). What's happening with the OP's question is anybody's guess and putting the definition of `LD_LIBRARY_PATH` in .bashrc will "fix" it, but it will hide the underlying problem that still needs to be resolved. – NickD Jul 26 '19 at 13:28
  • @NickD, fair point – Bart Jul 26 '19 at 14:04