Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic linking error #1247

Closed
Titzi90 opened this issue Sep 5, 2014 · 6 comments
Closed

Dynamic linking error #1247

Titzi90 opened this issue Sep 5, 2014 · 6 comments

Comments

@Titzi90
Copy link
Contributor

Titzi90 commented Sep 5, 2014

Error at start up of external projects (like HPCG in miniapp rep.) after Cmake changes ( Pull request #1204):
error while loading shared libraries: libhpx.so.0: cannot open shared object file: No such file or directory

works fine if I manually add the path ("LD_LIBRARY_PATH=/path/to/hpx/installdir/lib/")
I think this path must be set in some CMake file.

At build time I use "-DHPX_DIR=/path/to/hpx/intalldir/lib/cmake/hpx" as described in the email from Thomas after his merge.

@hkaiser hkaiser added this to the 0.9.9 milestone Sep 5, 2014
@sithhell
Copy link
Member

sithhell commented Sep 8, 2014

This is a difficult issue to solve and I would like to discuss the different options we have here and start with an explanation how it worked before.
In the past, the FindHPX.cmake script used a manually computed rpath (from HPX_RPATH) to set a rpath for the compiled binaries. Whenever doing a hpx_add_executable (for example), the HPX cmake scripts added the necessary linker flags to set the rpath's to whatever was set in that CMake variable.

This approach worked to some extend but was neither elegant nor working consistently when people didn't use hpx_add_example. Or when installing binaries, the RPATH wouldn't get adapted correctly etc.

Fortunately, CMake comes with proper support to set the rpath for a compile executable (or not). You can see the documentation about it here: http://www.cmake.org/Wiki/CMake_RPATH_handling

In the latest changes i switched to conform to this behavior. What I find strange though is that CMake isn't setting the HPX path when linking an executable in the build dir ... but that is probably a cmake issue.

Now. In order to solve this issue you could either (every single option would require additional documentationt):

For the last option, this could be done, theoretically, by the HPXConfig.cmake script if some variable is set (for example if HPX_FULL_RPATH), or we can provide a cmake function which can be called by external projects to use this setting.

What would you like to happen?

@hkaiser
Copy link
Member

hkaiser commented Sep 9, 2014

I think requiring for the user to specify LD_LIBRARY_PATH is ok as it conforms to the use of other libraries.

@hkaiser
Copy link
Member

hkaiser commented Sep 13, 2014

Can we all agree on requiring to set LD_LIRARY_PATH (needs documentation!) and then close this ticket?

@sithhell
Copy link
Member

Yes, or use what is recommended by the cmake documentation. Closing.

@hkaiser
Copy link
Member

hkaiser commented Sep 14, 2014

Do we have that documented?

@sithhell
Copy link
Member

No. Reopening until docs are there.

@sithhell sithhell reopened this Sep 14, 2014
@sithhell sithhell self-assigned this Sep 14, 2014
This was referenced Sep 14, 2014
sithhell added a commit that referenced this issue Oct 30, 2014
sithhell added a commit that referenced this issue Oct 31, 2014
(cherry picked from commit 4454a57)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants