Tim, Unfortunately, there isn't a nice way of including OpenMP for macOS within a package. One potential avenue would be to use a `configure.ac` file to check for whether OpenMP headers are present on the macOS computer and, then, allow the correct OpenMP compilation flags to be set. However, this requires the user to compile from source instead of using a CRAN binary.
Unfortunately, there isn't going to be an easier way as OpenMP on macOS with R is experimental by nature. Best regards, James ________________________________ From: R-SIG-Mac <r-sig-mac-boun...@r-project.org> on behalf of Timothy Bates <tim.ba...@ed.ac.uk> Sent: Tuesday, June 25, 2024 10:00 PM To: Kasper Daniel Hansen <kasperdanielhan...@gmail.com>; Sparapani, Rodney <rspar...@mcw.edu> Cc: R list <R-SIG-Mac@r-project.org> Subject: Re: [R-SIG-Mac] procedure to ship libomp.dylib run-time with package Thanks Kasper, I read those lines and had installed the openmp software as instructed. It all works fine for me. But users don’t have my usr/ folder, not can a package write to their usr/ folder. so what is confusing is how the user will get this lib. Where should make place libraries like libomp within the package so that if a user merely install.packages() it, the library will be found and loaded? Best, tim Sent from Outlook for iOS<https://urldefense.com/v3/__https://aka.ms/o0ukef__;!!DZ3fjg!_OUXHENJ_6aGlU-humThmTaUR5okhDKW2EGEY49AjJ4AN8eXBWtZCWE3O01pnyxbRpGQDhCl8MMLThVBbUXDuipI$ > ________________________________ From: Kasper Daniel Hansen <kasperdanielhan...@gmail.com> Sent: Tuesday, June 25, 2024 11:34:42 AM To: Sparapani, Rodney <rspar...@mcw.edu> Cc: Timothy Bates <tim.ba...@ed.ac.uk>; R list <R-SIG-Mac@r-project.org> Subject: Re: [R-SIG-Mac] procedure to ship libomp.dylib run-time with package This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe. If you read the next couple of sentences on that page, it says The following are links to libomp OpenMP run-time built from official LLVM release sources using Xcode compilers. They are signed and support macOS 10.13 (High Sierra) and higher. All tar-balls contain the system tree usr/local/lib and usr/local/include so the recommended installation is to type in Terminal: curl -O https://urldefense.com/v3/__https://mac.r-project.org/openmp/openmp-14.0.6-darwin20-Release.tar.gz__;!!DZ3fjg!_OUXHENJ_6aGlU-humThmTaUR5okhDKW2EGEY49AjJ4AN8eXBWtZCWE3O01pnyxbRpGQDhCl8MMLThVBbWfUKf7B$ sudo tar fvxz openmp-14.0.6-darwin20-Release.tar.gz -C / I think that is pretty clear? Note the -C / as part of the last line, that tells tar where to put it on the system. On Tue, Jun 25, 2024 at 8:20 AM Sparapani, Rodney via R-SIG-Mac <r-sig-mac@r-project.org<mailto:r-sig-mac@r-project.org>> wrote: Hi Tim: /usr/local/lib it seems. See the following page https://urldefense.com/v3/__https://mac.r-project.org/openmp/__;!!DZ3fjg!_OUXHENJ_6aGlU-humThmTaUR5okhDKW2EGEY49AjJ4AN8eXBWtZCWE3O01pnyxbRpGQDhCl8MMLThVBbaQGheD_$ -- Rodney Sparapani, Associate Professor of Biostatistics, He/Him/His Vice President, Wisconsin Chapter of the American Statistical Association Institute for Health and Equity, Division of Biostatistics Medical College of Wisconsin, Milwaukee Campus If this is outside of working hours, then please respond when convenient. From: R-SIG-Mac <r-sig-mac-boun...@r-project.org<mailto:r-sig-mac-boun...@r-project.org>> on behalf of Timothy Bates <tim.ba...@ed.ac.uk<mailto:tim.ba...@ed.ac.uk>> Date: Monday, June 24, 2024 at 4:00 PM To: R list <R-SIG-Mac@r-project.org<mailto:R-SIG-Mac@r-project.org>> Subject: [R-SIG-Mac] procedure to ship libomp.dylib run-time with package ATTENTION: This email originated from a sender outside of MCW. Use caution when clicking on links or opening attachments. ________________________________ At https://urldefense.com/v3/__https://mac.r-project.org/openmp/__;!!H8mHWRdzp34!4HZ0uFxJQ121gF_TnX99OuMlgIXM600pq8wCbWruoLsdLTtaFgRB5_gMopCtxD0N9M4tUOO-7hBGADHx1sk$<https://urldefense.com/v3/__https:/mac.r-project.org/openmp/__;!!H8mHWRdzp34!4HZ0uFxJQ121gF_TnX99OuMlgIXM600pq8wCbWruoLsdLTtaFgRB5_gMopCtxD0N9M4tUOO-7hBGADHx1sk$> 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@r-project.org<mailto:R-SIG-Mac@r-project.org> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mac__;!!H8mHWRdzp34!4HZ0uFxJQ121gF_TnX99OuMlgIXM600pq8wCbWruoLsdLTtaFgRB5_gMopCtxD0N9M4tUOO-7hBGdICDldE$<https://urldefense.com/v3/__https:/stat.ethz.ch/mailman/listinfo/r-sig-mac__;!!H8mHWRdzp34!4HZ0uFxJQ121gF_TnX99OuMlgIXM600pq8wCbWruoLsdLTtaFgRB5_gMopCtxD0N9M4tUOO-7hBGdICDldE$> [[alternative HTML version deleted]] _______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@r-project.org<mailto:R-SIG-Mac@r-project.org> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mac__;!!DZ3fjg!_OUXHENJ_6aGlU-humThmTaUR5okhDKW2EGEY49AjJ4AN8eXBWtZCWE3O01pnyxbRpGQDhCl8MMLThVBbYOwLI1d$ -- Best, Kasper [[alternative HTML version deleted]] _______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mac__;!!DZ3fjg!_OUXHENJ_6aGlU-humThmTaUR5okhDKW2EGEY49AjJ4AN8eXBWtZCWE3O01pnyxbRpGQDhCl8MMLThVBbYOwLI1d$ [[alternative HTML version deleted]] _______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac