Rdatatable / data.table

R's data.table package extends data.frame:
http://r-datatable.com
Mozilla Public License 2.0
3.62k stars 985 forks source link

Error in install package in macOS #3970

Closed salvob41 closed 5 years ago

salvob41 commented 5 years ago

Trying to install the package in macOS Catalina, gives:

clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include  -fopenmp -fPIC  -Wall -g -O2  -c assign.c -o assign.o
clang: error: unsupported option '-fopenmp'
make: *** [assign.o] Error 1
ERROR: compilation failed for package 'data.table'
* removing '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/data.table'
* restoring previous '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/data.table'

The downloaded source packages are in
    '/private/var/folders/kj/fvhs0k6n2g168892ngz9r4y00000gn/T/RtmpOeKci2/downloaded_packages'
Warning message:
In install.packages("data.table") :
  installation of package 'data.table' had non-zero exit status

Confirmed also here: https://cran.r-project.org/web/checks/check_results_data.table.html

Any workaround ?

birdoptera commented 5 years ago

I had this issue and I haven't upgraded to Catalina yet. I solved it by installing r-macos-rtools: https://github.com/rmacoslib/r-macos-rtools

MichaelChirico commented 5 years ago

@salvob41 can you confirm following the instructions for macOS here solve your issue?

https://github.com/Rdatatable/data.table/wiki/Installation

salvob41 commented 5 years ago

@MichaelChirico no, it does not fix it. It gives that error when I type:

install.packages("data.table")

mattdowle commented 5 years ago

@salvob41 is there any chance you just clicked Michael's link and did what it said at the top? If so you need to scroll down. The full link the specific section of that page is: https://github.com/Rdatatable/data.table/wiki/Installation#openmp-enabled-compiler-for-mac There is quite a lot of information online if you copy and paste the error message into Google.

salvob41 commented 5 years ago

@mattdowle yes, Thank you! I should have read it more carefully. The part you sent me installed correctly, although it gave me a huge amount of warnings like these:

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:320:57: note:
      insert '_Nonnull' if the pointer should never be null
  ...int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape)
                                                        ^
                                                         _Nonnull
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:323:18: warning:
      pointer is missing a nullability type specifier (_Nonnull, _Nullable, or
      _Null_unspecified) [-Wnullability-completeness]
void     psort(void *__base, size_t __nel, size_t __width,
                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:323:18: note:
      insert '_Nullable' if the pointer may be null
void     psort(void *__base, size_t __nel, size_t __width,
                    ^
                      _Nullable

a bit too much for an installation maybe?

mattdowle commented 5 years ago

Great. Glad it worked. I copied and pasted the latest warnings and notes into Google and it returned a ton of results unrelated to R or data.table. Lots of mentions of it in the Python ecosystem. stdlib.h, psort and _Nonnull are related to the C library and don't appear in data.table source code. if you have a message that mentions a data.table source file, then please do let us know. But from the snippet you've posted, it looks like a MacOS problem unrelated to R or data.table. MacOS causes us the most issues these days. We literally have zero problems like this for a few years now on Linux and Windows -vs- problem after problem on MacOS.

jangorecki commented 5 years ago

I believe that using gcc compiler rather than clang compiler (MacOS default) may solve most, if not all, of such issues.

lydhr commented 3 years ago

Update Thursday, 22nd of March 2018: I have to add -fopenmp to both clang and clang++ variables in my makevars to be able to build data.table package correctly. This is not exactly what the Data Table wiki recommends. I update the section about the Data Table Package accordingly.