Install rdatatable from source on mac catalina

Viewed 65

I have 'meticulously' followed the rdatatable's mac installation wiki. I also tried to follow this blog post to install r via homebrew and then install packages from source.

However, there seems to be a problem that I cannot figure out by myself. Could you please help me out here? I recently downgraded my mac from Big Sur to Catalina. I was able to install packages from source both on Big Sur and previously on Catalina.

install.packages("data.table", type = "source", repos = "https://Rdatatable.gitlab.io/data.table")
#> Warning in install.packages("data.table", type = "source", repos = "https://
#> Rdatatable.gitlab.io/data.table"): installation of package 'data.table' had non-
#> zero exit status
char    *cgetcap(char *, const char *, int);
                                    ^
                                     _Nullable
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:281:34: note: insert '_Nonnull' if the pointer should never be null
char    *cgetcap(char *, const char *, int);
                                    ^
                                     _Nonnull
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:281:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
char    *cgetcap(char *, const char *, int);
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:281:6: note: insert '_Nullable' if the pointer may be null
char    *cgetcap(char *, const char *, int);
        ^
          _Nullable 
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:281:6: note: insert '_Nonnull' if the pointer should never be null
char    *cgetcap(char *, const char *, int);
        ^
          _Nonnull 
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:283:19: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int      cgetent(char **, char **, const char *);
                      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:283:19: note: insert '_Nullable' if the pointer may be null
int      cgetent(char **, char **, const char *);
                      ^
                       _Nullable

.
.
.
                                                               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:328:57: note: insert '_Nullable' if the pointer may be null
            int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape)
                                                               ^
 
                                          ^
                                            _Nonnull 
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:359:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
extern char *suboptarg;         /* getsubopt(3) external variable */
            ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:359:13: note: insert '_Nullable' if the pointer may be null
extern char *suboptarg;         /* getsubopt(3) external variable */
            ^
              _Nullable 
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:359:13: note: insert '_Nonnull' if the pointer should never be null
extern char *suboptarg;         /* getsubopt(3) external variable */
            ^
              _Nonnull 
215 warnings and 2 errors generated.
make: *** [assign.o] Error 1
ERROR: compilation failed for package ‘data.table’

Created on 2021-03-28 by the reprex package (v1.0.0)

Session info
sessionInfo()
#> R version 4.0.4 (2021-02-15)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Catalina 10.15.7
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.27     assertthat_0.2.1  magrittr_2.0.1    reprex_1.0.0     
#>  [5] evaluate_0.14     highr_0.8         rlang_0.4.10      stringi_1.5.3    
#>  [9] cli_2.3.1         fs_1.5.0          rmarkdown_2.7     tools_4.0.4      
#> [13] stringr_1.4.0     glue_1.4.2        xfun_0.22         yaml_2.2.1       
#> [17] compiler_4.0.4    htmltools_0.5.1.1 knitr_1.31
1 Answers

The installations worked with gcc! Commented out the clang compiler options and tried with gcc and installed data.table from source with openmp support.

# # if you downloaded llvm manually above, replace with your chosen NEW_PATH/clang
# LLVM_LOC = /usr/local/opt/llvm
# CC=$(LLVM_LOC)/bin/clang -fopenmp
# CXX=$(LLVM_LOC)/bin/clang++ -fopenmp
# # -O3 should be faster than -O2 (default) level optimisation ..
# CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
# CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
# LDFLAGS=-L/usr/local/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib
# CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LLVM_LOC)/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include

# GCC (Official GNU fortran) ver

 LOC = /usr/local/gfortran
 CC=$(LOC)/bin/gcc -fopenmp
 CXX=$(LOC)/bin/g++ -fopenmp
 CXX11 = $(LOC)/bin/g++ -fopenmp # for fst package
 
 CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
 CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
 LDFLAGS=-L$(LOC)/lib -Wl,-rpath,-I$(LOC)/lib
 CPPFLAGS=-I$(LOC)/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
Related