[R-SIG-Mac] Help on reducing size of shared libraries on MacOS on CRAN

Ken Beath ken @end|ng |rom kjbe@th@com@@u
Sun Mar 19 02:10:25 CET 2023


A random sample of packages linking to Rcpp shows that many have NOTEs for installed package size.

I would avoid using special compiler flags, as this is something that may cause problems in the future.

Ken

> On 19 Mar 2023, at 8:27 am, Gilberto Camara <gilberto.camara.inpe using gmail.com> wrote:
> 
> Hi Simon
> 
> Many thanks for your quick response.  
> 
> My concern has to do with the CRAN Repository Policies, which state: "Maintainers will be asked to update packages which show any warnings or significant notes”. Since the concept of what are “significant notes" is not clearly defined, it is natural that maintainers would like their packages to be free of any NOTE.
> 
> That said, your explanation is quite helpful and informative.
> 
> Best regards
> Gilberto
> 
> ============================
> Prof Dr Gilberto Camara
> Senior Researcher
> National Institute for Space Research (INPE), Brazil
> https://gilbertocamara.org/
> =============================
> 
> 
> 
> 
>> On 18 Mar 2023, at 18:19, Simon Urbanek <simon.urbanek using R-project.org> wrote:
>> 
>> Gilberto,
>> 
>> Please note that size checks are not really relevant for binary packages - it is normal for binaries to be large as they may include static libraries (e.g., rgdal has 273Mb). Also note that 4.8Mb is rather small for a library since it also includes debugging symbols (CRAN packages are built with --dsym to make debugging easier) - so is there a particular reason you are concerned about the size? You can always remove the debugging symbols (libs/*.dsym) on your machine if you have issues with size.
>> 
>> Cheers,
>> Simon
>> 
>> 
>>> On 19/03/2023, at 07:02, Gilberto Camara <gilberto.camara.inpe using gmail.com> wrote:
>>> 
>>> Dear R-SIG-MAC members
>>> 
>>> We are the developers of R package sits and would like to ask for your help in solving a problem with library size on R macOS binaries. 
>>> 
>>> Before submission to CRAN, version 1.3.0 of sits (https://cran.r-project.org/web/packages/sits/index.html) has been tested in various environments, including Ubuntu, Fedora, CRAN winbuilder (all flavors). We have tested sits-1.3.0 on r-release-mac-x86_64 and r-release-macos-arm64 with the following configurations:
>>> 
>>> - r-release-macos-x86_64: R 4.2.2, MacMini 3.2GHz, 6 cores, 32 MB RAM, macOS Ventura 3.2.1, Apple clang version 14.0.3 (clang-1403.0.22.14.1).
>>> 
>>> - r-release-macos-arm64: R 4.2.2, MacBookAir, chip ARM M1, 8 cores, 16 MB RAM, macOS Monterrey 12.6,  Apple clang version 14.0.0 (clang-1400.0.29.201). 
>>> 
>>> In our configuration of r-release-macos-x86_64, the installed size is 3.8 MB, and the libs directory size is 436 KB. On r-release-macos-arm64, the installed size is 5.4 MB and the libs directory size is 1.6 MB. 
>>> 
>>> The current CRAN check on sits version 1.3.0 reports a NOTE on r-release-macos-arm64 and r-oldrel-macos-arm64, with an installation size of 7.3Mb with the libs directory size reported as 4.8Mb. CRAN is using Apple clang version 13.0.0 ((clang-1300.0.29.30) on r-release-macos-arm64 and Apple clang version 12.0.0 (clang-1200.0.32.29) on r-oldrel-macos-arm64. 
>>> 
>>> There is a 3.2 MB difference in size between what CRAN reports and what we obtain in our tests for r-release-macos-arm64. We would appreciate your guidance on how to address this problem and, if possible, point to a reliable way to reduce package size in macOS. 
>>> 
>>> Note that our package links to RCpp and RCppArmadillo.
>>> 
>>> Our current Makevars configuration is given below
>>> ==========================================
>>> # suggestion by Dirk Eddelbuettel
>>> SHLIB_CXXLDFLAGS = -Wlto,-S -shared
>>> SHLIB_CXX11LDFLAGS = -Wlto,-S -shared
>>> SHLIB_CXX14LDFLAGS = -Wlto,-S -shared
>>> SHLIB_FCLDFLAGS = -Wlto,-S -shared
>>> SHLIB_LDFLAGS = -Wlto,-S -shared
>>> 
>>> ## suggestion by Dirk Eddelbuettel
>>> PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
>>> PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
>>> 
>>> strippedLib: $(SHLIB)
>>> if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Linux" ]] ; then /usr/bin/strip --strip-debug $(SHLIB); fi
>>> 
>>> clean:
>>> rm -f $(OBJECTS)
>>> 
>>> .phony: strippedLib clean
>>> ===========================================
>>> 
>>> Any help would be much appreciated. 
>>> 
>>> Best regards
>>> Gilberto
>>> ============================
>>> Prof Dr Gilberto Camara
>>> Senior Researcher
>>> National Institute for Space Research (INPE), Brazil
>>> https://gilbertocamara.org/
>>> =============================
>>> 
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac using r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>> 
>> 
> 
> _______________________________________________
> 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