Pkgbuild::compile_dll() on previously working rstantools-based package fails with "file too big" error

If you still have issues, send me a link to a github repo for the package and I’ll have a look at other compiler flags which can be used while still keeping CRAN happy

Can confirm that removing the flags and resubmitting caused no issues, and it has officially passed all tests on all systems that CRAN tests; thank you @andrjohns as always!

Bumping this thread because a user of my package has recently updated from R 4.3.x to R 4.4.0 on MacOS 14.4.1 (23E224), following the toolchain configuration instructions on the wiki, and now installation is failing. The operative part of the error message seems to indicate the problem is that the new version of clang doesn’t support the -Wa,-mbig-obj flag:

using C++ compiler: ‘Apple clang version 15.0.0 (clang-1500.3.9.4)’
using C++17
using SDK: ‘MacOSX14.4.sdk’

clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -DUSE_STANC3 -D_HAS_AUTO_PTR_ETC=0 -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppEigen/include' -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppParallel/include' -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/rstan/include' -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/StanHeaders/include' -I/opt/R/arm64/include    -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppParallel/include' -D_REENTRANT -DSTAN_THREADS   -Wa,-mbig-obj -fPIC  -falign-functions=64 -Wall -g -O2  -O3 -mtune=native -arch arm64 -ftemplate-depth-256  -c RcppExports.cpp -o RcppExports.o
clang: error: unsupported argument '-mbig-obj' to option '-Wa,'
make: *** [RcppExports.o] Error 1

It appears that R 4.4.0 / RTools 4.4 on Windows is still fine, so the problem is Mac-specific. @andrjohns, any ideas on a workaround that would keep the Mac compiler happy, or alternative flags that would fix the original verbose output / “file too big” issue regardless of OS? Thank you in advance!

Is there a reason you need the flag on MacOS?

The file too big errors have only occurred so far on windows when compiling/building using RStudio

I haven’t tested compilation on MacOS without the flag, so you may be right. But is there a way to specify it programmatically in the package Makevars such that it’s only invoked when compiling on Windows? (Sorry if that’s a stupid question; I am not an expert in these dark arts.)

R packages can have a separate Makevars.win file to allow Windows-specific configuration.

Alternatively you could try a block like:

ifeq ($(OS),Windows_NT)
  PKG_CXXFLAGS += ...
endif

But just to re-iterate, the handling of file too big errors is only needed when testing locally. You will need to remove the flags before a CRAN submission or the package will be rejected (the flags are not portable)

Ah right, of course. So you would only modify the configure.win file per your earlier post.

This package is not and probably never will be on CRAN, and my experience has been that the verbose output / “file too big” error occurs when installing from GitHub as well as compiling locally.

Again, thanks so much for your help! Hopefully this will take care of the Mac issue.