Add library to path

Answered

Comments

2 comments

  • Avatar
    juanjo

    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)
    
  • Avatar
    juanjo

    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.

Please sign in to leave a comment.