Problem loading Garfield libraries in MacOs

I am running into problems while trying to load Garfield libraries into ROOT.

Just after the Garfield compilation succeeds, I load the Garfield setup.sh and try using gSystem->Load("libGarfield.dylib").

I get the following error:

- Installing: /Users/jgalan/apps/garfield6/share/Garfield/cmake/GarfieldTargets.cmake
-- Installing: /Users/jgalan/apps/garfield6/share/Garfield/cmake/GarfieldTargets-release.cmake
-- Installing: /Users/jgalan/apps/garfield6/share/Garfield/cmake/GarfieldConfig.cmake
-- Installing: /Users/jgalan/apps/garfield6/share/Garfield/cmake/GarfieldConfigVersion.cmake
-- Installing: /Users/jgalan/apps/garfield6/share/Garfield/setupGarfield.sh
-- Installing: /Users/jgalan/apps/garfield6/share/Garfield/setupGarfield.csh

Javiers-MBP:installation jgalan$ source /Users/jgalan/apps/garfield6/share/Garfield/setupGarfield.sh
Javiers-MBP:installation jgalan$ root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.26/10                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosx64 on Nov 16 2022, 10:42:54                      |
  | From tags/v6-26-10@v6-26-10                                      |
  | With Apple clang version 14.0.0 (clang-1400.0.29.202)            |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] gSystem->Load("libGarfield.dylib");
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Users/jgalan/apps/garfield6/lib/libGarfield.0.3.0.dylib, 0x0009): Library not loaded: @rpath/libmagboltz.11.dylib
  Referenced from: <F5C2FAE8-2631-3195-A61B-31EA277A7369> /Users/jgalan/apps/garfield6/lib/libGarfield.0.3.0.dylib
  Reason: tried: '/Users/jgalan/rest-framework/install/lib/libmagboltz.11.dylib' (no such file), '/Users/jgalan/apps/root-6.26.10/install/lib/libmagboltz.11.dylib' (no such file), '=/Users/jgalan/rest-framework/install/lib/libmagboltz.11.dylib' (no such file), '/Users/jgalan/apps/root-6.26.10/install/lib/../lib/libmagboltz.11.dylib' (no such file), '/Users/jgalan/apps/root-6.26.10/install/bin/../lib/libmagboltz.11.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libmagboltz.11.dylib' (no such file), '/Users/jgalan/apps/root-6.26.10/install/lib/../lib/libmagboltz.11.dylib' (no such file), '/Users/jgalan/apps/root-6.26.10/install/bin/../lib/libmagboltz.11.dylib' (no such file), '/usr/local/lib/libmagboltz.11.dylib' (no such file), '/usr/lib/libmagboltz.11.dylib' (no such file, not in dyld cache)
root [1] 

I would expect that setupGarfield.sh would load all the necessary paths.

It seems it tries to find libmagboltz.11.dylib. The file is found inside /Users/jgalan/apps/garfield6/lib, same place as libGarfield.dylib. So why it does not find it? Perhaps in MacOs magboltz needs to be added to the compilation targets somewhere.

Any help welcome!
Thanks!

Hi @Javier_Galan,

It seems it’s trying to locate the library using only the @rpath (run path) of the binary -in this case the ROOT binary-.
Perhaps you could try manually adding the directory you mention as part of the library search path list, as in

$ export DYLD_LIBRARY_PATH=/Users/jgalan/apps/garfield6/lib:$DYLD_LIBRARY_PATH
$ root
root [0] gSystem->Load("libGarfield.dylib"); // or alternatively, write
                                             // the full path here
...

For this, maybe @hschindl knows better.

Cheers,
J.

I get a different error now. Perhaps is not properly finding the pcm file?

root [0] gSystem->Load("libGarfield.dylib");
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for Medium.hh
   requested to autoload type Garfield::Medium
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for Solid.hh
   requested to autoload type Garfield::Solid
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for Geometry.hh
   requested to autoload type Garfield::Geometry
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for Component.hh
   requested to autoload type Garfield::Component
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for Sensor.hh
   requested to autoload type Garfield::Sensor
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for ViewDrift.hh
   requested to autoload type Garfield::ViewDrift
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for AvalancheMicroscopic.hh
   requested to autoload type Garfield::AvalancheMicroscopic
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for ComponentGrid.hh
   requested to autoload type Garfield::ComponentGrid
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for ComponentFieldMap.hh
   requested to autoload type Garfield::ComponentFieldMap

To me it seems like some path is missing in the include path list, but @hschindl perhaps knows or has seen this before.

Out of curiosity, did you source the setupGarfield.sh file in your current shell?

Can you try loading libmagboltz before libGarfield?

gSystem->Load("libmagboltz.dylib");
gSystem->Load("libGarfield.dylib");

Perhaps the dictionaries haven’t been generated, or they were not included inside the target?

Hm, strange… it works on my MacBook (macOS 12.6, ROOT 6.26/02). What OS and ROOT version are you using?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.