Looks like you'd be better off with libintl from Simon's gettext binaries on mac.r-project.org. The compiler is looking for include files in /opt/R/arm64/include and not /opt/homebrew/include.
-pd > On 19 Apr 2025, at 14.45, Gavin Simpson <ucfa...@gmail.com> wrote: > > Dear list > > I seem to be running into a new issue after upgrading to R 4.5.0 that > seems related to this > > * configure is now able to find an external libintl on macOS (the code > from an older GNU gettext distribution failed to try linking with the > macOS Core Foundation framework). > > I'm pretty new to MacOS and I have installed R from homebrew, and > typically use the MacOS X binaries kindly provided by CRAN. However, > for a couple of packages I make extensive use of, I want to make use > of openMP, and so I have been following the excellent instructions on > the mac.r-project.org pages to install the relevant fortran compiler > and libomp. > > Specifically, I am trying to in compile the latest mgcv sources with > openMP support. I have been doing this successfully for some time for > the 4.3 and 4.4 releases of R. But after upgrading to R 4.5.0, > compiling mgcv now throws an compilation error > > In file included from magic.c:27: > ./general.h:4:10: fatal error: 'libintl.h' file not found > 4 | #include <libintl.h> > | ^~~~~~~~~~~ > > (The full compile log is included below if neccessary.) > > I do have gettext installed and I do have libintl.h on my system > > % find /opt -name "libintl.*" -print > /opt/homebrew/include/libintl.h > /opt/homebrew/lib/libintl.dylib > /opt/homebrew/lib/libintl.8.dylib > /opt/homebrew/lib/libintl.a > /opt/homebrew/Cellar/gettext/0.24/include/libintl.h > /opt/homebrew/Cellar/gettext/0.24/lib/libintl.dylib > /opt/homebrew/Cellar/gettext/0.24/lib/libintl.8.dylib > /opt/homebrew/Cellar/gettext/0.24/lib/libintl.a > > My $PATH is > > % print $PATH > /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/usr/local/laps:/usr/local/munki:/usr/local/munkireport:/Applications/quarto/bin:/Users/au690221/.local/bin:/Users/au690221/.local/bin > > I have edited ./src/Makevars in mgcv's sources such that it reads > > % cat ./repo/src/Makevars > PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS) > PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS) > > PKG_LIBS += -lomp > PKG_CPPFLAGS = -Xclang -fopenmp > ## *Both* the above must be *uncommented* for release > > #PKG_CFLAGS = -g -O0 -Wall -pedantic $(SHLIB_OPENMP_CFLAGS) > ## Actually it now seems that you need to reset optimization flag in > ## cd /usr/local/lib/R/etc/ > ## sudo pico Makeconf > ## This file can add flags but not modify what's in the above! > ## `#' out previous line for release (but not without uncommenting openMP) > > But I have tried it with the final pair of PKG_LIBS definitions that > add omp support commented out also. > > My system details are > >> sessionInfo() > R version 4.5.0 (2025-04-11) > Platform: aarch64-apple-darwin20 > Running under: macOS Sequoia 15.4.1 > > Matrix products: default > BLAS: > /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib > LAPACK: > /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; > LAPACK version 3.12.1 > > locale: > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > time zone: Europe/Copenhagen > tzcode source: internal > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] compiler_4.5.0 > > and > > % clang -v > Apple clang version 17.0.0 (clang-1700.0.13.3) > Target: arm64-apple-darwin24.4.0 > Thread model: posix > InstalledDir: /Library/Developer/CommandLineTools/usr/bin > > (So I have installed LLVM 18.1.8 from https://mac.r-project.org/openmp/ ) > > I suspect I will need to solve this by adding the homebrew lib > location to my LD_PATH or similar, but I'm not very familiar with this > process in general and especially so on MacOS X. > > I'd appreciate any help with resolving this issue. > > TIA > > Gavin > > % R CMD INSTALL mgcv_1.9-3.tar.gz > * installing to library ‘/Users/au690221/Library/R/arm64/4.5/library’ > * installing *source* package ‘mgcv’ ... > ** this is package ‘mgcv’ version ‘1.9-3’ > ** using staged installation > ** libs > using C compiler: ‘Apple clang version 17.0.0 (clang-1700.0.13.3)’ > using SDK: ‘MacOSX15.4.sdk’ > clang -arch arm64 > -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG > -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c > coxph.c -o coxph.o > clang -arch arm64 > -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG > -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c > davies.c -o davies.o > clang -arch arm64 > -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG > -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c > discrete.c -o discrete.o > clang -arch arm64 > -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG > -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c > gdi.c -o gdi.o > clang -arch arm64 > -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG > -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c > init.c -o init.o > clang -arch arm64 > -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG > -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c > magic.c -o magic.o > In file included from magic.c:27: > ./general.h:4:10: fatal error: 'libintl.h' file not found > 4 | #include <libintl.h> > | ^~~~~~~~~~~ > 1 error generated. > make: *** [magic.o] Error 1 > ERROR: compilation failed for package ‘mgcv’ > * removing ‘/Users/au690221/Library/R/arm64/4.5/library/mgcv’ > * restoring previous ‘/Users/au690221/Library/R/arm64/4.5/library/mgcv’ > -- > Gavin Simpson, PhD [he/him/his] > [tw] @ucfagls [OrciD] 0000-0002-9084-8413 > [web] fromthebottomoftheheap.net > • Assistant Professor > • Department of Animal & Veterinary Sciences, Aarhus University > • Adjunct Professor, Department of Biology, University of Regina. > > _______________________________________________ > R-SIG-Mac mailing list > R-SIG-Mac@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-mac -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business SchoolSolbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd....@cbs.dk Priv: pda...@gmail.com _______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac