extendr: .dylib, not .so files are produced on Mac, which makes installation fail

When I tried to R CMD INSTALL . the hello example on Mac, it fails because:

cp: ../target/release/libhello.so: No such file or directory

and I fount that libhello.dylib was produced instead

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (19 by maintainers)

Most upvoted comments

I could have sworn that I had seen the .dylib version working previously, but it’s not now. However, renaming to .so does indeed seem to work fine…

@andy-thomason You could be right. But I think we still need a standard “Makevars”. Note that R is using a dialect of standard “make”. Specifically, in 1.2.1 of Writing R Extensions

A Makevars file is a makefile and is used as one of several makefiles by R CMD SHLIB (which is called by R CMD INSTALL to compile code in the src directory)

The manpage of ?SHLIB shows that,

dllname: the full name of the shared object/DLL to be built, including the extension (typically ‘.so’ on Unix systems, and ‘.dll’ on Windows). If not given, the basename of the object/DLL is taken from the basename of the first file.

So I guess, it will correctly generate .so for both macOS and Linux. Therefore, I suggest to use Makevars as other R packages are using.