[R-SIG-Mac] openmp and xcode
Simon Urbanek
@|mon@urb@nek @end|ng |rom R-project@org
Wed Apr 23 04:31:44 CEST 2025
Bill,
the libomp.dylib inside R is there solely for the CRAN binaries to make sure that package binaries on CRAN can use the correct OpenMP runtime. Is it not intended to be used outside of that setup.
That is also why we don’t ship the headers as anyone compiling from sources will have to do a bit of legwork to make sure it works as it is not entirely trivial to do that correctly. The CRAN build machines are setup such that it "just works" to make it easy on package maintainers. However, there are lot of issues/moving parts when building OpenMP-enabled code yourself (as you found out), so it is not encouraged unless you are very familiar with the issues (correct run-time and complier match-up etc.).
That said, Xcode 16.3 is a big jump in the clang versions (from 17 to 19) so I would not recommend it just yet - have you tried Xcode 16.2? I tried to reproduce your problem and it worked just fine with Xcode 16.2 (CLT 16.2 to be precise and my corresponding OpenMP run-time from LLVM 17.0.6). Xcode 16.2 is supported on all macOS versions (and what the arm64 R builds are moving to) so I would suggest trying that first. (I didn't have CLT 16.3 installed yet, so I’ll have to wait for a quiet minute to see if that’s really what breaks.)
Cheers,
Simon
> On 23 Apr 2025, at 02:21, bill+rsigmac using 8pawexpress.com wrote:
>
> If the CRAN R installation for macos includes |libomp.dylib|, is there a reason it does not include the paired |./include/omp*.h| files as well? It’s just three, they’re small, and it seems a reasonable step to making
> building packages that use OpenMP more direct.
>
> Background: I’ve been having some difficulty compiling |data.table| (dev) on my MBP (M4, 15.4.1, R-4.4.3), due to an error (I do not assume it’s this package, I’ve had trouble with other packages too).
>
> |symbol not found in flat namespace '___kmpc_dispatch_deinit' |
>
> When troubleshooting this, I’ve verified that I have Xcode, but it is version 16.3, well past the 14.3 used for R-4.4.3. Sleuthing some more, I realized that it’s an easy mistake to update the |/usr/local/lib/libomp.dylib| file to be a different version than what is distributed in CRAN’s R. I don’t see an easy way to change version within XCode, and when I tried installing XCode-14.3 it says my OS does not support that (old) version. (Even with gfortran 12.2, I can’t fix that error, but that’s a different subject.)
>
> I recognize the challenge in distributing binaries for multiple versions of macos and xcode. I believe R-4.5 is still being built on XCode-14.3, which begs another question of if/when XCode updates are planned for R binaries and CRAN. (Big topic, I understand, I did not find a recent discussion. My apologies if I missed something.)
>
> Thanks,
> Bill
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> 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