rspatial / terra

R package for spatial data handling https://rspatial.github.io/terra/reference/terra-package.html
GNU General Public License v3.0
541 stars 89 forks source link

terra build fails on macOS since implementing dropLevels #769

Closed johnbaums closed 2 years ago

johnbaums commented 2 years ago

terra build is failing on macOS with the following errors:

In file included from spatRaster.cpp:18:
In file included from ./spatRaster.h:18:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:183:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:138:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:215:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:673:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/limits:149:85: error: no matching constructor for initialization of
      'std::__libcpp_numeric_limits<std::__bit_const_reference<std::vector<bool>>, false>::type' (aka 'std::__bit_const_reference<std::vector<bool>>')
    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();}
                                                                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/limits:450:93: note: in instantiation of member function
      'std::__libcpp_numeric_limits<std::__bit_const_reference<std::vector<bool>>, false>::min' requested here
    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
                                                                                            ^
./NA.h:25:97: note: in instantiation of member function 'std::numeric_limits<std::__bit_const_reference<std::vector<bool>>>::min' requested
      here
    static constexpr T value = std::is_floating_point<T>::value ? NAN : std::numeric_limits<T>::min();
                                                                                                ^
./NA.h:56:24: note: in instantiation of template class 'NA<std::__bit_const_reference<std::vector<bool>>>' requested here
        bool b = v == (NA<T>::value);
                       ^
./vecmath.h:502:8: note: in instantiation of function template specialization 'is_NA<std::__bit_const_reference<std::vector<bool>>>' requested
      here
                if (!is_NA(v[i])) {
                     ^
spatRaster.cpp:1267:7: note: in instantiation of function template specialization 'vany<bool>' requested here
        if (!vany(hascats, true)) {
             ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:139:5: note: candidate constructor not viable: requires
      1 argument, but 0 were provided
    __bit_const_reference(const __bit_const_reference&) = default;
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:142:5: note: candidate constructor not viable: requires
      single argument '__x', but no arguments were provided
    __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:153:5: note: candidate constructor not viable: requires
      2 arguments, but 0 were provided
    __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
    ^
In file included from spatRaster.cpp:23:
In file included from ./vecmath.h:26:
./NA.h:25:24: error: no viable conversion from 'float' to 'const std::__bit_const_reference<std::vector<bool>>'
    static constexpr T value = std::is_floating_point<T>::value ? NAN : std::numeric_limits<T>::min();
                       ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./NA.h:56:24: note: in instantiation of template class 'NA<std::__bit_const_reference<std::vector<bool>>>' requested here
        bool b = v == (NA<T>::value);
                       ^
./vecmath.h:502:8: note: in instantiation of function template specialization 'is_NA<std::__bit_const_reference<std::vector<bool>>>' requested
      here
                if (!is_NA(v[i])) {
                     ^
spatRaster.cpp:1267:7: note: in instantiation of function template specialization 'vany<bool>' requested here
        if (!vany(hascats, true)) {
             ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:139:5: note: candidate constructor not viable: no known
      conversion from 'float' to 'const std::__bit_const_reference<std::vector<bool>> &' for 1st argument
    __bit_const_reference(const __bit_const_reference&) = default;
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:142:5: note: candidate constructor not viable: no known
      conversion from 'float' to 'const __bit_reference<std::vector<bool>> &' for 1st argument
    __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
    ^
2 errors generated.
make: *** [spatRaster.o] Error 1
ERROR: compilation failed for package ‘terra’
* removing ‘/usr/local/lib/R/4.1/site-library/terra’
* restoring previous ‘/usr/local/lib/R/4.1/site-library/terra’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/bl/mxxch6cd6jn6cnj8f24v07ch0000gp/T//RtmpTAHl4w/filedf326a1c699d/terra_1.6-8.tar.gz’ had non-zero exit status
Full install log ```bash > remotes::install_github('rspatial/terra') Downloading GitHub repo rspatial/terra@HEAD ✔ checking for file ‘/private/var/folders/bl/mxxch6cd6jn6cnj8f24v07ch0000gp/T/RtmpTAHl4w/remotesdf32783ee8a7/rspatial-terra-673a2ac/DESCRIPTION’ ... ─ preparing ‘terra’: ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ running ‘cleanup’ ─ checking for LF line-endings in source and make files and shell scripts (678ms) ─ checking for empty or unneeded directories ─ building ‘terra_1.6-8.tar.gz’ Installing package into ‘/usr/local/lib/R/4.1/site-library’ (as ‘lib’ is unspecified) * installing *source* package ‘terra’ ... ** using staged installation configure: CC: clang configure: CXX: clang++ -std=gnu++11 checking for gdal-config... /usr/local/bin/gdal-config checking gdal-config usability... yes configure: GDAL: 3.4.2 checking GDAL version >= 2.0.1... yes checking for gcc... clang checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether clang accepts -g... yes checking for clang option to accept ISO C89... none needed checking how to run the C preprocessor... clang -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking gdal.h usability... yes checking gdal.h presence... yes checking for gdal.h... yes checking GDAL: linking with --libs only... yes checking GDAL: /usr/local/Cellar/gdal/3.4.2_2/share/gdal/pcs.csv readable... no checking GDAL: checking whether PROJ is available for linking:... yes checking GDAL: checking whether PROJ is available fur running:... yes configure: GDAL: 3.4.2 configure: pkg-config proj exists, will use it configure: using proj.h. configure: PROJ: 9.0.0 checking PROJ: checking whether PROJ and sqlite3 are available for linking:... yes checking for geos-config... /usr/local/bin/geos-config checking geos-config usability... yes configure: GEOS: 3.10.2 checking GEOS version >= 3.4.0... yes checking geos_c.h usability... yes checking geos_c.h presence... yes checking for geos_c.h... yes checking geos: linking with -L/usr/local/Cellar/geos/3.10.2/lib -lgeos_c... yes configure: Package CPP flags: -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include configure: Package LIBS: -L/usr/local/Cellar/proj/9.0.0_1/lib -L/usr/local/Cellar/libtiff/4.3.0/lib -lproj -lc++ -lm -ldl -lsqlite3 -ltiff -ljpeg -lz -lcurl -lldap -lz -L/usr/local/Cellar/gdal/3.4.2_2/lib -lgdal -L/usr/local/Cellar/geos/3.10.2/lib -lgeos_c configure: creating ./config.status config.status: creating src/Makevars ** libs clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c RcppFunctions.cpp -o RcppFunctions.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c RcppModule.cpp -o RcppModule.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c arith.cpp -o arith.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c crs.cpp -o crs.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c distRaster.cpp -o distRaster.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c distance.cpp -o distance.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c extract.cpp -o extract.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c file_utils.cpp -o file_utils.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c focal.cpp -o focal.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c gcp.cpp -o gcp.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c gdal_algs.cpp -o gdal_algs.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c gdal_multidimensional.cpp -o gdal_multidimensional.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c gdalio.cpp -o gdalio.o clang -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -Wno-implicit-function-declaration -c geodesic.c -o geodesic.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c geos_methods.cpp -o geos_methods.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c geosphere.cpp -o geosphere.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c graticule.cpp -o graticule.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c math_utils.cpp -o math_utils.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c mediancut.cpp -o mediancut.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c memory.cpp -o memory.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c ncdf.cpp -o ncdf.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c ram.cpp -o ram.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c raster_methods.cpp -o raster_methods.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c raster_stats.cpp -o raster_stats.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c rasterize.cpp -o rasterize.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c read.cpp -o read.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c read_gdal.cpp -o read_gdal.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c read_ogr.cpp -o read_ogr.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c sample.cpp -o sample.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c spatBase.cpp -o spatBase.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c spatDataframe.cpp -o spatDataframe.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c spatFactor.cpp -o spatFactor.o clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.1.3/lib/R/include" -DNDEBUG -I/usr/local/Cellar/proj/9.0.0_1/include -I/usr/local/Cellar/libtiff/4.3.0/include -DHAVE_PROJ_H -I/usr/local/Cellar/gdal/3.4.2_2/include -I/usr/local/Cellar/geos/3.10.2/include -I'/usr/local/lib/R/4.1/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -fPIC -g -O2 -c spatRaster.cpp -o spatRaster.o In file included from spatRaster.cpp:18: In file included from ./spatRaster.h:18: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:183: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:138: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:215: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:14: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:673: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/limits:149:85: error: no matching constructor for initialization of 'std::__libcpp_numeric_limits>, false>::type' (aka 'std::__bit_const_reference>') _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();} ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/limits:450:93: note: in instantiation of member function 'std::__libcpp_numeric_limits>, false>::min' requested here _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();} ^ ./NA.h:25:97: note: in instantiation of member function 'std::numeric_limits>>::min' requested here static constexpr T value = std::is_floating_point::value ? NAN : std::numeric_limits::min(); ^ ./NA.h:56:24: note: in instantiation of template class 'NA>>' requested here bool b = v == (NA::value); ^ ./vecmath.h:502:8: note: in instantiation of function template specialization 'is_NA>>' requested here if (!is_NA(v[i])) { ^ spatRaster.cpp:1267:7: note: in instantiation of function template specialization 'vany' requested here if (!vany(hascats, true)) { ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:139:5: note: candidate constructor not viable: requires 1 argument, but 0 were provided __bit_const_reference(const __bit_const_reference&) = default; ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:142:5: note: candidate constructor not viable: requires single argument '__x', but no arguments were provided __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:153:5: note: candidate constructor not viable: requires 2 arguments, but 0 were provided __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT ^ In file included from spatRaster.cpp:23: In file included from ./vecmath.h:26: ./NA.h:25:24: error: no viable conversion from 'float' to 'const std::__bit_const_reference>' static constexpr T value = std::is_floating_point::value ? NAN : std::numeric_limits::min(); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./NA.h:56:24: note: in instantiation of template class 'NA>>' requested here bool b = v == (NA::value); ^ ./vecmath.h:502:8: note: in instantiation of function template specialization 'is_NA>>' requested here if (!is_NA(v[i])) { ^ spatRaster.cpp:1267:7: note: in instantiation of function template specialization 'vany' requested here if (!vany(hascats, true)) { ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:139:5: note: candidate constructor not viable: no known conversion from 'float' to 'const std::__bit_const_reference> &' for 1st argument __bit_const_reference(const __bit_const_reference&) = default; ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:142:5: note: candidate constructor not viable: no known conversion from 'float' to 'const __bit_reference> &' for 1st argument __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT ^ 2 errors generated. make: *** [spatRaster.o] Error 1 ERROR: compilation failed for package ‘terra’ * removing ‘/usr/local/lib/R/4.1/site-library/terra’ * restoring previous ‘/usr/local/lib/R/4.1/site-library/terra’ Warning message: In i.p(...) : installation of package ‘/var/folders/bl/mxxch6cd6jn6cnj8f24v07ch0000gp/T//RtmpTAHl4w/filedf326a1c699d/terra_1.6-8.tar.gz’ had non-zero exit status ```
System details ```r > version _ platform x86_64-apple-darwin20.6.0 arch x86_64 os darwin20.6.0 system x86_64, darwin20.6.0 status major 4 minor 1.3 year 2022 month 03 day 10 svn rev 81868 language R version.string R version 4.1.3 (2022-03-10) nickname One Push-Up ```

It seems the culprit may be dropLevels (previous commit 20f337fe270cb6f0b3f8174b0a2c21d197f1d0bc builds fine):

https://github.com/rspatial/terra/blob/77badf1cb10da7efa6da037946855d63eb51537e/src/spatRaster.cpp#L1254-L1291

kadyb commented 2 years ago

The same problem is in pkgdown workflow on GHA, which also uses macOS. On Linux (Ubuntu), the package builds fine.

rhijmans commented 2 years ago

I do not have access to a Mac right now, but I am pretty sure this fixes it.

johnbaums commented 2 years ago

I can confirm that the package builds fine now on my macOS system. Thanks Robert.

kadyb commented 2 years ago

pkgdown and R-universe workflows work too!