Skip to content

Commit

Permalink
Follow symlink for tcmalloc libraries.
Browse files Browse the repository at this point in the history
The gperftools runtime package will only have the version library files
and not the symbolic link.
Refs #10912
  • Loading branch information
martyngigg committed Jan 16, 2015
1 parent ac780d3 commit bdb2561
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions Code/Mantid/Build/CMake/LinuxPackageScripts.cmake
Expand Up @@ -23,9 +23,19 @@ endif()
set ( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${LIB_DIR};${CMAKE_INSTALL_PREFIX}/${PLUGINS_DIR};${CMAKE_INSTALL_PREFIX}/${PVPLUGINS_DIR} )

###########################################################################
# LD_PRELOAD libraries
# LD_PRELOAD TCMalloc
###########################################################################
set ( EXTRA_LDPRELOAD_LIBS "${TCMALLOC_LIBRARIES}" )
# User systems will only have the libraries and not the symbolic link
# so we must set the preload to the versioned library. We will assume it is
# in the same location as the system that the package was built on
if ( TCMALLOC_LIBRARIES )
execute_process ( COMMAND readlink --no-newline --canonicalize-existing ${TCMALLOC_LIBRARIES}
OUTPUT_VARIABLE TCMALLOC_PRELOAD
RESULT_VARIABLE READLINK_RESULT )
if ( READLINK_RESULT EQUAL 1 )
message ( FATAL_ERROR "Unable to find real file that tcmalloc symlink, ${TCMALLOC_LIBRARIES}, points to." )
endif()
endif()

###########################################################################
# Environment scripts (profile.d)
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Build/CMake/Packaging/launch_mantidplot.sh.in
Expand Up @@ -9,7 +9,7 @@ SCRIPTFILE=$(readlink -f "$0")
INSTALLDIR=$(echo $SCRIPTFILE | sed -r -e 's|^(.*)/(.*)$|\1|g') #.* is greedy and eats up until the final slash

# Define extra libraries and load paths
LOCAL_PRELOAD=$(readlink -f @EXTRA_LDPRELOAD_LIBS@)
LOCAL_PRELOAD=@TCMALLOC_PRELOAD@
if [ -n "${LD_PRELOAD}" ]; then
LOCAL_PRELOAD=${LOCAL_PRELOAD}:${LD_PRELOAD}
fi
Expand Down

0 comments on commit bdb2561

Please sign in to comment.