RPATH, Mac OS X, and how to execute macros from anywhere (part 2)


Unfortunately, I let the original thread reach its deadline…

In the meantime, I tested this:

  • I tried to set absolute paths everywhere in my macro.
  • I tried the last version of ROOT, 6.26/04 (installed with brew)

Again, it works fine when I execute the macro from the directory where it is, but I still get the same error when I try to execute it from another directory:

root [0] .x scripts/PKS2155_macro.C 

RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby 
                Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
                All rights reserved, please read http://roofit.sourceforge.net/license.txt

libLIVlihoodClasses dictionary payload:5:10: remark: could not acquire lock file for module 'LIVlihoodClasses': failed to create unique file /usr/local/Cellar/root/6.26.04/lib/root/LIVlihoodClasses.pcm.lock-8fead47d: Permission denied [-Rmodule-build]
#include "/Users/bolmont/ownCloud/Boulot/LIV HMV/SOFT/YAML_config_file/LIVlib/inc/Data.h"
libLIVlihoodClasses dictionary payload:5:10: remark: building module 'LIVlihoodClasses' as '/usr/local/Cellar/root/6.26.04/lib/root/LIVlihoodClasses.pcm' [-Rmodule-build]
error: unable to open output file '/usr/local/Cellar/root/6.26.04/lib/root/LIVlihoodClasses.pcm': 'Permission denied'
libLIVlihoodClasses dictionary payload:5:10: remark: finished building module 'LIVlihoodClasses' [-Rmodule-build]
libLIVlihoodClasses dictionary payload:5:10: fatal error: could not build module 'LIVlihoodClasses'
#include "/Users/bolmont/ownCloud/Boulot/LIV HMV/SOFT/YAML_config_file/LIVlib/inc/Data.h"
Error in <TInterpreter::AutoParse>: Error parsing payload code for class SimRunnerMinuitFromFile with content:

#line 1 "libLIVlihoodClasses dictionary payload"

I’m still trying to find a workaround, but any help would be really appreciated!

_ROOT Version: 6.26/04
_Platform: Mac OS X 11.6.5
_Compiler: AppleClang

Hi @bolmont ,

thank you for the ping and sorry for the high latency!

@vvassilev @Axel do we want a GitHub issue for this, or how do we proceed?


There are still too many things we don’t understand I’m afraid. Let me try to come up with a list of questions here:

  • what is the content of scripts/PKS2155_macro.C?
  • why does .x scripts/PKS2155_macro.C try to build modules?
  • which files are in the directory /Users/bolmont/ownCloud/Boulot/LIV HMV/SOFT/YAML_config_file/LIVlib/inc/ - is there something that’d cause clang to look for a module for Data.h?
  • Does any Data.h trigger this, even if you have it in $PWD and it’s empty?
  • Content of the file scripts/PK2155_macro.C:

R__ADD_LIBRARY_PATH(/Users/bolmont/ownCloud/Boulot/LIV HMV/SOFT/YAML_config_file/LIVlib-build/lib)

void test_runner(bool UseMC=true, bool UseNuisance=false, bool UseTable=false, bool UseAcceptance=true, bool UseMigMatrix=true,  string fname="./ToyData.dat",Bool_t verbose=true){
  int powLIV = 1; //either 1 or 2
  int mod = 1; // either 1 (LIV) or 2 (DSR)
  double shift =0;

  auto runner = new SimRunnerMinuitFromFile(30,200.0,200.0,verbose);
  SourceHandle* source = (SourceHandle*) new PKS2155Handle(powLIV,mod,shift,UseMC,1,8,UseNuisance,UseTable,UseAcceptance,UseMigMatrix);
  if(UseTable && powLIV==1 && mod==1) source->CreateTables2("PKS2155",250,250,250,-950,950);
  if(UseTable && powLIV==1 && mod==2) source->CreateTables2("PKS2155",250,250,250,-1000,1000);
  if(UseTable && powLIV==2 && mod==1) source->CreateTables2("PKS2155",250,250,250,-750,750);
  if(UseTable && powLIV==2 && mod==2) source->CreateTables2("PKS2155",250,250,250,-1000,1000);
  if(UseTable) source->SetTables("PKS2155");
  // runner->RegisterHandle(source,"./PKS2155NOLIV.txt","./Template.dat");

void PKS2155_macro(){


  • why does .x scripts/PKS2155_macro.C try to build modules? → when I’m in directory scripts, everything works fine. When I’m not, I see the behavior of my message above. I don’t have any idea why the macro tries to build modules. It’s a bit as if when I change the directory, root cannot find the files anymore and tries to re-generate them?
  • All header files are in directory LIVlib/inc/, including Data.h

the content of the libdirectory:

bolmont@host LIVlib-build % ls lib
libLIV.so			libLIVlihoodClasses.rootmap	libLIVlihoodClasses_rdict.pcm
  • Does any Data.h trigger this, even if you have it in $PWD and it’s empty? → Yes.

Another question: is there a way to tell root where to create the pcm file? It seems the problem is that it tries to create it somewhere it shouldn’t.