[R-SIG-Mac] procedure to ship libomp.dylib run-time with package

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Thu Jun 27 19:16:17 CEST 2024


Tim,

There is no need to worry about libomp.dylib on macOS with CRAN packages as libomp is already shipped with R. When the package its built on CRAN, it will be pointed correctly to the version inside R.

However, in your output it seems that the problem may be that the user is using the wrong R version - the package is installed for R 4.4, but it seems to be looking for libomp in R 4.3. They are compatible, but the paths look wrong.  It is not clear to me what paths you used when building the package binary. Note that the package can only be installed for the same version that it has been compiled for. Also if you compile against libomp you have to either link against the version in R or use install_name_tool to change the linking path to make sure it points to the R version. Either way, check with tool -L to see what you are linking to.

Cheers,
Simon



> On 24 Jun 2024, at 23:00, Timothy Bates <tim.bates using ed.ac.uk> wrote:
> 
> At https://mac.r-project.org/openmp/ it  says
> "any package you compile against libomp.dylib will need that run-time so you have to ship it with your package or have users install it”
> 
> Are there  any  instructions on what to do/where to put libomp.dylib so it will be found?
> 
> I’ve compiled a package (OpenMx) in which OpenMP is working locally but other users get the error:
> 
> require(OpenMx)
> Error: package or namespace load failed for ‘OpenMx’ in dyn.load(file, DLLpath = DLLpath, ...):
> unable to load shared object '/Users/***/Library/R/x86_64/4.4/library/OpenMx/libs/OpenMx.so':
> 
> dlopen(/Users/***/Library/R/x86_64/4.4/library/OpenMx/libs/OpenMx.so, 0x0006): Library not loaded: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libomp.dylib
> 
> 
> The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list