Skip to content

r-universe-org/macos-cross

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MacOS Cross

Docker images prepared for cross compiling R packages for MacOS using osxcross.

Hello world

To start the image prepared for R-4.3-x86_64 cross:

docker run -it ghcr.io/r-universe-org/macos-cross/r-4.3-x86_64

To cross compile a package, we first install the binary package with dependencies for the host architecture (Linux):

# Install host binaries + dependencies
R -e "install.packages('pdftools', repos = 'https://p3m.dev/cran/__linux__/jammy/latest')"

Then we compile the source package:

mkdir -p maclibs
curl -OL "https://cran.r-project.org/src/contrib/Archive/pdftools/pdftools_3.3.3.tar.gz"
R CMD INSTALL pdftools_3.3.3.tar.gz --build --no-test-load --library=maclibs

We use --no-test-load because the cross-compiled MacOS binary cannot be loaded on Linux.

Also make sure to pass a --library to make sure the MacOS compiled packages do not get installed into your real package library with Linux packages, because again, they cannot actually be loaded on MacOS.

About

Cross compiling R packages for MacOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages