Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilation failed for package ‘data.table’ on travis-ci #3938

Closed
twangxxx opened this issue Oct 4, 2019 · 5 comments
Closed

compilation failed for package ‘data.table’ on travis-ci #3938

twangxxx opened this issue Oct 4, 2019 · 5 comments

Comments

@twangxxx
Copy link

twangxxx commented Oct 4, 2019

Hi, I got an error on Travis-CI build when I use 'data.table' as one of the dependency packages in my R package.

Almost the same code/configuration below passed the Travis build 3 days ago, however, I did some minor changes today in the documentation of my package and this data.table related error appeared in travis-ci build. I also notice you have a new release of data.table two days ago, so I was wondering if these two things are related.

Here is some information probably helpful:

  1. Error message from Travis:
  • installing source package ‘data.table’ ...
    ** package ‘data.table’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -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 ‘/Users/travis/R/Library/data.table’
  • restoring previous ‘/Users/travis/R/Library/data.table’
    Error in i.p(...) :
    (converted from warning) installation of package ‘data.table’ had non-zero exit status
    Calls: ... with_rprofile_user -> with_envvar -> force -> force -> i.p
    Execution halted
    The command "Rscript travis_script.r" failed and exited with 1 during .
  1. data.table is listed on my DESCRIPTION file under Imports part.

  2. my travis build config file .travis.yml. :

language: R
r: bioc-release
sudo: true
cache: packages
os:

  • osx

before_install:

  • pip install --user -r requirements.txt

install:

  • Rscript travis_script.r

script:

  • travis_wait R CMD build .
  • travis_wait R CMD check *tar.gz --no-manual

after_success:

  • Rscript -e 'devtools::install_github("r-lib/covr");library(covr);codecov()'
  1. And also my travis_script.r file, I use this to install all dependencies with my package.

install.packages("devtools")
library(devtools)

update.packages(ask = FALSE, checkBuilt = TRUE)
devtools::install_deps(dep = T)

Any advice or suggestions on how to solve this problem?

@mattdowle
Copy link
Member

mattdowle commented Oct 5, 2019

Thanks for the detailed info.

clang: error: unsupported option '-fopenmp'

That looks familiar on MacOS. But we're more used to seeing it on user machines rather than Travis. Please see: https://github.com/Rdatatable/data.table/wiki/Installation#openmp-enabled-compiler-for-mac

This one is Travis specific: #3331. See the sentence at the top "In order to compile data.table on Travis OSX, an OpenMP enabled compiler is required, so ..."

I've turned it back on here: #3941

@vincentvanhees
Copy link

vincentvanhees commented Oct 5, 2019

Thanks Matt, that worked for me. To other people stumbling across the same issue and in need for a quick fix: Informed by Matt's reply above and #3331 I added the following lines to my own travis.yml file:

before_install:
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install llvm &&
    export PATH="/usr/local/opt/llvm/bin:$PATH" &&
    export LDFLAGS="-L/usr/local/opt/llvm/lib" &&
    export CFLAGS="-I/usr/local/opt/llvm/include"; fi

As a result my R package (that imports data.table) builds again on Travis for both linux and osx.

@mattdowle
Copy link
Member

mattdowle commented Oct 6, 2019

Great. Thanks for the update. Thanks @MarcusKlik for the solution.

@jeroen
Copy link
Contributor

jeroen commented Oct 18, 2019

Here is a solution that does not require custom compilers. Put this e.g. in your before_install:

sed -i.bak 's/-fopenmp//g' $(R RHOME)/etc/Makeconf

This modifies your R config to opt-out of OpenMP, so you can use standard xcode compilers.

@mattdowle
Copy link
Member

mattdowle commented Oct 18, 2019

@jeroen but that's not a solution if it disables openmp. Rather than the word 'custom' which implies something a little bit bad, I'd lean towards the words 'basic', 'limited' or even 'deficient' (in the sense of something missing) to descibe xcode compilers which lack openmp support by default, unlike windows and linux which support standard openmp built-in by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants