Difference between revisions of "Avoid LD LIBRARY PATH"

From Wiki for iCub and Friends
Jump to: navigation, search
 
Line 6: Line 6:
  
 
YARP:
 
YARP:
  INSTALL_WITH_RPATH = TRUE
+
  Nothing to do, RPATH is automatically enabled. RPATH can be disabled by setting the CMAKE_SKIP_INSTALL_RPATH option to ON.
  
 
iCub:
 
iCub:

Latest revision as of 16:53, 29 October 2015

First of all, you need to be aware that nothing particular is required if you do *not* install the software or you install it in system directories.

A common solution adopted to make libraries available in the other cases is to use the LD_LIBRARY_PATH environment variable. However some people strongly discourage this solution.

It is possible to avoid setting LD_LIBRARY_PATH, using the rpath. In other words you can instruct cmake to pass flags to the compiler so that binaries contains all the information to localize the variables they need. This achieved by setting the following flags to true in cmake:

YARP:

Nothing to do, RPATH is automatically enabled. RPATH can be disabled by setting the CMAKE_SKIP_INSTALL_RPATH option to ON.

iCub:

ICUB_INSTALL_WITH_RPATH = TRUE


References:

  • Background:

Ref: http://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

  • Why LD_LIBRARY_PATH is bad?

Ref: http://xahlee.org/UnixResource_dir/_/ldpath.html

  • Commands to inspect the rpath or dynamic libraries needed by an executable:
 objdump -x iKinArmCtrl | grep NEEDED

or

 objdump -x iKinArmCtrl | grep RPATH