Skip to content

Commit

Permalink
Fixing #1247: Dynamic linking error
Browse files Browse the repository at this point in the history
  • Loading branch information
sithhell committed Oct 30, 2014
1 parent 50b7129 commit 4454a57
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
8 changes: 2 additions & 6 deletions CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (c) 2007-2014 Hartmut Kaiser
# Copyright (c) 2011-2013 Thomas Heller
# Copyright (c) 2011-2014 Thomas Heller
# Copyright (c) 2007-2008 Chirag Dekate
# Copyright (c) 2011 Bryce Lelbach
# Copyright (c) 2011 Vinay C Amatya
Expand Down Expand Up @@ -1097,11 +1097,7 @@ if (NOT DEFINED LIB)
endif(NOT DEFINED LIB)

if(HPX_FULL_RPATH)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${LIB}" isSystemDir)
if(isSystemDir EQUAL -1)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB}")
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH On)
hpx_include(SetFullRPATH)
endif()
###############################################################################

Expand Down
14 changes: 14 additions & 0 deletions cmake/HPX_SetFullRPATH.cmake
@@ -0,0 +1,14 @@
# Copyright (c) 2011-2014 Thomas Heller
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

if (NOT DEFINED LIB)
set(LIB "lib")
endif(NOT DEFINED LIB)

list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${LIB}" isSystemDir)
if(isSystemDir EQUAL -1)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB}")
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH On)
6 changes: 6 additions & 0 deletions docs/manual/build_system/using_hpx_cmake.qbk
Expand Up @@ -136,5 +136,11 @@ Optional Parameters are:
If you do not use CMake, you can still build against __hpx__ but you should refer
to the section on __pkg_config__.

[note Since HPX relies on dynamic libraries, the dynamic linker needs to know where to look for them.
If HPX isn't installed into a path which is configured as a linker search path, external projects
need to either set RPATH or adapt LD_LIBRARY_PATH to point to where the hpx libraries reside.
In order to set RPATHs, you can include HPX_SetFullRPATH in your project after all libraries you want
to link against have been added. Please also consult the CMake documentation [@http://www.cmake.org/Wiki/CMake_RPATH_handling `here`]]

[endsect] [/ Using HPX with CMake based projects]

0 comments on commit 4454a57

Please sign in to comment.