R 3.6 broke build with gcc 5.3, can't find stdlib.h

#1

Before:

g++ -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rpf/include" -I/usr/local/include -fopenmp -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-variable -fdiagnostics-color=auto -DEXTRA_GCC_DIAG -Wno-misleading-indentation -Wno-pragmas -Wno-ignored-attributes -mmacosx-version-min=10.7 -I. -Iinclude -Iinclude/zstd-1.1.0 -Iinclude/zstd-1.1.0/common -Iinclude/zstd-1.1.0/compress -Iinclude/zstd-1.1.0/decompress -D SQLITE_ENABLE_COLUMN_METADATA -D SQLITE_ENABLE_STAT4 -D SQLITE_MAX_EXPR_DEPTH=10000 -D SQLITE_USE_URI=1 -fPIC -Wall -g -O2 -c Compute.cpp -o Compute.o

After:

g++ -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rpf/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fopenmp -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-variable -fdiagnostics-color=auto -DEXTRA_GCC_DIAG -Wno-misleading-indentation -Wno-pragmas -Wno-ignored-attributes -mmacosx-version-min=10.7 -I. -Iinclude -Iinclude/zstd-1.1.0 -Iinclude/zstd-1.1.0/common -Iinclude/zstd-1.1.0/compress -Iinclude/zstd-1.1.0/decompress -D SQLITE_ENABLE_COLUMN_METADATA -D SQLITE_ENABLE_STAT4 -D SQLITE_MAX_EXPR_DEPTH=10000 -D SQLITE_USE_URI=1 -fPIC -Wall -g -O2 -c Compute.cpp -o Compute.o

Error:

   In file included from /usr/local/include/c++/5.3.0/bits/stl_algo.h:59:0,
                    from /usr/local/include/c++/5.3.0/algorithm:62,
                    from Compute.cpp:17:
   /usr/local/include/c++/5.3.0/cstdlib:72:20: fatal error: stdlib.h: No such file or directory
   compilation terminated.
   make[1]: *** [Compute.o] Error 1

What’s up with that? stdlib.h should be easy to find. CC @jeroen @jimhester

#2

Why do you use gcc? We usually compile with clang, either from xcode or the cran version with openmp.

Are you running Mojave? Here R 3.6.0 requires you install the SDK headers:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

See also this thread in r-sig-mac: https://stat.ethz.ch/pipermail/r-sig-mac/2019-April/012955.html

#3

Oh, I forgot that CRAN clang started offering OpenMP support since the end of 2018. How can I use CRAN clang on Travis?

#4

No, this is El Capitan (10.11). See example log. Is El Capitan still supported or is it time to upgrade?

#5

It is recommended to upgrade, see also this topic: https://travis-ci.community/t/library-developer-commandlinetools-sdks-macosx-sdk-missing-on-el-capitain