Hi all,

I added this to "Post-installation Actions" in Advanced/GUI tab:

<addLibraryToPath><path>${installdir}/libraries</path></addLibraryToPath>

that the system find the libs for my app, but it doesn't work! How can I do this correctly?

Thx!

Kai

asked 24 Mar '12, 14:50

Kai%20Heitkamp's gravatar image

Kai Heitkamp
26778
accept rate: 0%

Did you get any error? Are you installing as root? Could you check if the path was added to /etc/ld.so.conf?

(25 Mar '12, 06:45) juanjo ♦♦

No error, installed as user! ...is that working with "addLibraryToPath"?

(25 Mar '12, 07:06) Kai Heitkamp

Ok, but I need a installer used by a regular user. What can I do that the system find my libraries?

(25 Mar '12, 10:06) Kai Heitkamp

To add a library to the library path, you could set the LD_LIBRARY_PATH on Linux or DYLD_LIBRARY_PATH on OS X. You could use an <addTextToFile> action to modify the .bashrc:

<addTextToFile>
    <file>~/.bashrc</file>
    <text>export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${installdir}/libraries" </text>
</addTextToFile>

A better option would be to create a wrapper to your application that will first load the appropriate environment variables. For example, to call an application ${installdir}/bin/app.run, you could rename it to ${installdir}/bin/app.run.bin and create a shell script ${installdir}/bin/app.run, with contents:

#!/bin/sh         
LD_LIBRARY_PATH=${installdir}/libraries:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

exec $0.bin "$@"

That will launch your application with the proper environment without altering the user configuration.

link

answered 25 Mar '12, 10:29

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

Oh, I just had this idea with a launch script file too! :)

Thank you very much for your help!

(25 Mar '12, 10:40) Kai Heitkamp

Currently, the action just works with system scope so it requires root privileges. If you are installing as a regular user you should see a message logged in the installation log saying:

Warning: addLibraryToPath: unable to execute this action (you need to be root)
link

answered 25 Mar '12, 09:59

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×27
×14
×13
×2

Asked: 24 Mar '12, 14:50

Seen: 2,828 times

Last updated: 26 Mar '12, 11:00