Community
Participate
Working Groups
Build Identifier: 20110218-0911 As shown at EclipseCon by Andrew, when you want to run the executable that has been linked with a shared library, the exe will not find the shared lib since it is not in the LD_LIBRARY_PATH. The chosen output-directory should be available as a variable. Better solution than automagically adding it: fix the ld-command so that it resolves the path when linking [by adding the run-path option in the link command]. Reproducible: Always
And the variable actually exists as ${ConfigName}, but it isn't available for the run-configuration. Perhaps it should be that. But as I wrote initially, the best thing would be that the path to the shared lib should be added to the linker with -Wl,--rpath -Wl,${workspace_loc:/${ReferencedProject}/${ConfigName}
Patches gratefully accepted.
TBH I think it's a bad idea to add the rpath to the binary as it's asking for problems down the line. In the example given, the rpath is hard-coded to point into the user's workspace. So while the binary might appear to magically work for that user at that instant in time, as soon as the binary is moved to another box, or the workspace is moved, the exe stops working. I think a better bet would be to set the LD_LIBRARY_PATH appropriately and get the launch to use that. That way the binary works nicely within Eclipse - even if the workspace is moved - but as soon as the user runs the binary outside of eclipse it's clear what dependencies the binary requires.