Skip to content

Commit abd03e1

Browse files
committed
[Core] Add a RUNPATH to libraries generated by ACLiC.
1 parent 3d01f17 commit abd03e1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cmake/unix/compiledata.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ echo "#define COMPILER \""`type -path $CXX`"\"" >> "${COMPILEDATA}.tmp"
121121
echo "#define COMPILERVERS \"$COMPILERVERS\"" >> "${COMPILEDATA}.tmp"
122122
echo "#define COMPILERVERSSTR \"$COMPILERVERSSTR\"" >> "${COMPILEDATA}.tmp"
123123
if [ "$CUSTOMSHARED" = "" ]; then
124-
echo "#define MAKESHAREDLIB \"cd \$BuildDir ; $BXX -fPIC -c \$Opt $CXXFLAGS \$IncludePath \$SourceFiles ; $BXX \$Opt \$ObjectFiles $SOFLAGS $LDFLAGS $EXPLLINKLIBS -o \$SharedLib\"" >> "${COMPILEDATA}.tmp"
124+
echo "#define MAKESHAREDLIB \"cd \$BuildDir ; $BXX -fPIC -c \$Opt $CXXFLAGS \$IncludePath \$SourceFiles ; $BXX \$Opt \$ObjectFiles $SOFLAGS $LDFLAGS \$RPath $EXPLLINKLIBS -o \$SharedLib \"" >> "${COMPILEDATA}.tmp"
125125
else
126126
echo "#define MAKESHAREDLIB \"$CUSTOMSHARED\"" >> "${COMPILEDATA}.tmp"
127127
fi

core/base/src/TSystem.cxx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3736,6 +3736,7 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
37363736
cmd.ReplaceAll("\"$BuildDir","$BuildDir");
37373737
cmd.ReplaceAll("$BuildDir","\"$BuildDir\"");
37383738
cmd.ReplaceAll("$BuildDir",build_loc);
3739+
cmd.ReplaceAll("$RPath", "-Wl,-rpath," + gROOT->GetSharedLibDir());
37393740
TString optdebFlags;
37403741
if (mode & kDebug)
37413742
optdebFlags = fFlagsDebug + " ";
@@ -4133,7 +4134,7 @@ void TSystem::SetMakeExe(const char *directives)
41334134
/// construct should be avoided. In particular this description can contain
41344135
/// environment variables, like $ROOTSYS (or %ROOTSYS% on windows).
41354136
/// ~~~ {.cpp}
4136-
/// Five special variables will be expanded before execution:
4137+
/// The following special variables will be expanded before execution:
41374138
/// Variable name Expands to
41384139
/// ------------- ----------
41394140
/// $SourceFiles Name of source files to be compiled
@@ -4142,6 +4143,7 @@ void TSystem::SetMakeExe(const char *directives)
41424143
/// $BuildDir Directory where the files will be created
41434144
/// $IncludePath value of fIncludePath
41444145
/// $LinkedLibs value of fLinkedLibs
4146+
/// $RPath ROOT's library directory is added as -rpath
41454147
/// $DepLibs libraries on which this library depends on
41464148
/// $ObjectFiles Name of source files to be compiler with
41474149
/// their extension changed to .o or .obj
@@ -4155,10 +4157,11 @@ void TSystem::SetMakeExe(const char *directives)
41554157
/// --no_exceptions --signed_chars --display_error_number
41564158
/// --diag_suppress 68 -o $SharedLib");
41574159
///
4158-
/// gSystem->setMakeSharedLib(
4160+
/// // Or adding an rpath to the generated libraries (ROOT's rpath is inserted automatically into $RPath):
4161+
/// gSystem->SetMakeSharedLib(
41594162
/// "Cxx $IncludePath -c $SourceFile;
41604163
/// ld -L/usr/lib/cmplrs/cxx -rpath /usr/lib/cmplrs/cxx -expect_unresolved
4161-
/// \$Opt -shared /usr/lib/cmplrs/cc/crt0.o /usr/lib/cmplrs/cxx/_main.o
4164+
/// \$Opt \$RPath -shared /usr/lib/cmplrs/cc/crt0.o /usr/lib/cmplrs/cxx/_main.o
41624165
/// -o $SharedLib $ObjectFile -lcxxstd -lcxx -lexc -lots -lc"
41634166
///
41644167
/// gSystem->SetMakeSharedLib(

0 commit comments

Comments
 (0)