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 Errors on Travis (for R package) #154

Closed
leeper opened this issue May 20, 2016 · 10 comments
Closed

Compilation Errors on Travis (for R package) #154

leeper opened this issue May 20, 2016 · 10 comments
Milestone

Comments

@leeper
Copy link

leeper commented May 20, 2016

I have an R package that imports feather. Builds on Travis are failing due feather failing to compile. Any ideas how to correct?

Here's the set of errors:

* installing *source* package ‘feather’ ...
** package ‘feather’ successfully unpacked and MD5 sums checked
** libs
g++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -I. -I/home/travis/R-bin/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -c RcppExports.cpp -o RcppExports.o
g++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -I. -I/home/travis/R-bin/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -c feather-read.cpp -o feather-read.o
g++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -I. -I/home/travis/R-bin/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -c feather-types.cpp -o feather-types.o
g++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -I. -I/home/travis/R-bin/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -c feather-write.cpp -o feather-write.o
g++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -I. -I/home/travis/R-bin/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -c feather/buffer.cc -o feather/buffer.o
g++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -I. -I/home/travis/R-bin/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -c feather/feather-c.cc -o feather/feather-c.o
g++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -I. -I/home/travis/R-bin/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -c feather/io.cc -o feather/io.o
g++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -I. -I/home/travis/R-bin/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -c feather/metadata.cc -o feather/metadata.o
feather/metadata.cc:29:7: error: expected nested-name-specifier before ‘FBString’
feather/metadata.cc:29:7: error: ‘FBString’ has not been declared
feather/metadata.cc:29:16: error: expected ‘;’ before ‘=’ token
feather/metadata.cc:29:16: error: expected unqualified-id before ‘=’ token
feather/metadata.cc:32:7: error: expected nested-name-specifier before ‘ColumnVector’
feather/metadata.cc:32:7: error: ‘ColumnVector’ has not been declared
feather/metadata.cc:32:20: error: expected ‘;’ before ‘=’ token
feather/metadata.cc:32:20: error: expected unqualified-id before ‘=’ token
feather/metadata.cc:178:3: error: ‘ColumnVector’ does not name a type
feather/metadata.cc: In member function ‘feather::Status feather::metadata::TableBuilder::Impl::Finish()’:
feather/metadata.cc:146:5: error: ‘FBString’ was not declared in this scope
feather/metadata.cc:146:14: error: expected ‘;’ before ‘desc’
feather/metadata.cc:148:7: error: ‘desc’ was not declared in this scope
feather/metadata.cc:154:9: error: ‘desc’ was not declared in this scope
feather/metadata.cc:156:27: error: ‘columns_’ was not declared in this scope
feather/metadata.cc:157:34: error: unable to deduce ‘auto’ from ‘<expression error>’
feather/metadata.cc: In member function ‘void feather::metadata::TableBuilder::Impl::add_column(const flatbuffers::Offset<feather::fbs::Column>&)’:
feather/metadata.cc:173:5: error: ‘columns_’ was not declared in this scope
feather/metadata.cc: In constructor ‘feather::metadata::TableBuilder::TableBuilder()’:
feather/metadata.cc:190:5: error: type ‘feather::metadata::TableBuilder’ is not a direct base of ‘feather::metadata::TableBuilder’
make: *** [feather/metadata.o] Error 1
ERROR: compilation failed for package ‘feather’
* removing ‘/usr/local/lib/R/site-library/feather’
@hadley
Copy link
Collaborator

hadley commented May 20, 2016

The problem is -std=c++0x - but I don't know why it wouldn't be picking up the SystemRequirements: C++11. Any ideas @jimhester ?

@jimhester
Copy link
Contributor

I think the problem is the configure file, from https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-C_002b_002b11-code

If a package using C++11 has a configure script it is essential that it selects the correct compiler, via something like

CXX1X=`"${R_HOME}/bin/R" CMD config CXX1X`
CXX1XSTD=`"${R_HOME}/bin/R" CMD config CXX1XSTD`
CXX="$(CXX1X) $(CXX1XSTD)"
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXX1XFLAGS`
AC_LANG(C++)

I am trying to reproduce the error locally and will send a patch

@jimhester
Copy link
Contributor

Actually I am mistaken, the gcc on travis is only 4.6.3, so you need to modify your .travis.yml to install at least gcc-4.9 in order to have -std=c++11

@jimhester
Copy link
Contributor

So you have to install gcc-4.9 or greater and set CXX1X, CXX1XSTD in ~/.R/Makevars, e.g.

https://github.com/jimhester/rio/blob/9026180fd731aaed34f21cba3b5e207124618e5b/.travis.yml#L8-L20

Which allows you to build successfully, https://travis-ci.org/leeper/rio/builds/131807863#L1367-L1380

This is pretty painful, but I am not sure what can be done to avoid it unless travis updates their default gcc or ubuntu version...

@wesm
Copy link
Owner

wesm commented Aug 3, 2016

is this resolved?

@leeper
Copy link
Author

leeper commented Aug 3, 2016

Yes, @jimhester's travis setup worked for me.

@leeper leeper closed this as completed Aug 3, 2016
@maxheld83
Copy link

maxheld83 commented Jan 20, 2017

This fix would appear to cause other problems, though I am not sure whether this is actually an issue on feather's end.

If so, could this issue be reopened @leeper, @jimhester?

Once I add the above fix to my .travis.yml, travis fails on installing readxl, and doesn't even get to feather:

Installing readxl (0.1.1) ... 
Error: Command failed (1)

Failed to run system command:

	'/home/travis/R-bin/lib/R/bin/R' --vanilla CMD INSTALL '/tmp/RtmprmuGtQ/readxl' --library='/home/travis/build/maxheld83/goodlife/packrat/lib/x86_64-pc-linux-gnu/3.3.2' --install-tests --no-docs --no-multiarch --no-demo 

The command failed with output:
* installing *source* package 'readxl' ...
** package 'readxl' successfully unpacked and MD5 sums checked
** libs
g++ -I/home/travis/R-bin/lib/R/include -DNDEBUG -Iunix -I. -I/home/travis/R-bin/include -I"/home/travis/build/maxheld83/goodlife/packrat/lib/x86_64-pc-linux-gnu/3.3.2/Rcpp/include"  -DTINYFORMAT_NO_VARIADIC_TEMPLATES -std=c++11 -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
cc1plus: error: unrecognized command line option '-std=c++11'
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package 'readxl'
* removing '/home/travis/build/maxheld83/goodlife/packrat/lib/x86_64-pc-linux-gnu/3.3.2/readxl'
Execution halted


The command "R -e "0" --args --bootstrap-packrat" failed and exited with 1 during .

Your build has been stopped.

I'm not sure what to do about that, but the problem seems to stem from the commands added as per the above fix.

Here's the complete .travis.yml:

language: r

sudo: false

install:
  - R -e "0" --args --bootstrap-packrat

warnings_are_errors: false

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - gcc-4.9
      - g++-4.9

before_install: |
  mkdir ~/.R
  cat <<EOF > ~/.R/Makevars
  CXX1X=g++-4.9
  CXX1XSTD=-std=c++11

cache:
  packages: true
  directories:
    - $TRAVIS_BUILD_DIR/_bookdown_files
    - $TRAVIS_BUILD_DIR/packrat/

before_script:
  - chmod +x ./_build.sh
  - chmod +x ./_deploy.sh

script:
  - ./_build.sh
  - ./_deploy.sh

notifications:
  email: false

@jimhester
Copy link
Contributor

jimhester commented Jan 20, 2017

@maxheld83 I think that is actually a bug in readxl. It sets -std=c++11 but does not use the CXX1X compiler. Setting CXX=gcc-4.9 should fix the issue.

@maxheld83
Copy link

maxheld83 commented Jan 21, 2017

thanks @jimhester – is this the same issue as tidyverse/readxl#176 then?

Seems like it is, as per your discussion – I'll then continue the discussion there.

@maxheld83
Copy link

also here, FYI, just setting dist=trusty solves the problem, though I am not sure whether this is recommended.

language: r

sudo: false

dist: trusty

install:
  - R -e "0" --args --bootstrap-packrat

warnings_are_errors: false

cache:
  packages: true
  directories:
    - $TRAVIS_BUILD_DIR/_bookdown_files
    - $TRAVIS_BUILD_DIR/packrat/

before_script:
  - chmod +x ./_build.sh
  - chmod +x ./_deploy.sh

script:
  - ./_build.sh
  - ./_deploy.sh

notifications:
  email: false

kbroman added a commit to kbroman/qtl2feather that referenced this issue Mar 22, 2017
 - Add sections for building feather on travis;
   see <wesm/feather#154>
   (also needed gfortran in there)

 - Remove the "before script" stuff, as not necessary
jwood000 added a commit to jwood000/RcppAlgos that referenced this issue Jan 29, 2020
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

5 participants