@@ -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