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

If using CXX1XSTD should also use CXX1X compiler #176

Closed
jimhester opened this issue May 21, 2016 · 3 comments
Closed

If using CXX1XSTD should also use CXX1X compiler #176

jimhester opened this issue May 21, 2016 · 3 comments

Comments

@jimhester
Copy link
Contributor

readxl sets PKG_CXXFLAGS to include CXX1XSTD (added in commit c957ce1), but does not use the CXX1X compiler.

If the user speficies an alternative compiler for CXX1X (and CXX1XSTD) in Makevars this can result in readxl failing to build (see https://travis-ci.org/leeper/rio/builds/131807863#L1641-L1645 for an example).

In addition the comment confuses me, if the issue is compiling C code with the C99 standard as the submission comments suggest, should we not be setting PKG_CFLAGS=-std=c99 instead?

@maxheld83
Copy link

maxheld83 commented Jan 21, 2017

as an intermediate fix, @jimhester suggested (if I understood correctly) to amend my ~/.R/Makevarsas per wesm/feather#154.

I tried the below .travis.yaml additions:

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

But still got a failing build, this time erroring out on feather again.

Installing feather (0.3.1) ... 
[1] "Command failed (1)\n\nFailed to run system command:\n\n\t'/home/travis/R-bin/lib/R/bin/R' --vanilla CMD INSTALL '/tmp/RtmpsvJQDC/feather' --library='/home/travis/build/maxheld83/goodlife/packrat/lib/x86_64-pc-linux-gnu/3.3.2' --install-tests --no-docs --no-multiarch --no-demo \n\nThe command failed with output:\n* installing *source* package 'feather' ...\n** package 'feather' successfully unpacked and MD5 sums checked\nPlatform is little endian. Good.\n** libs\ng++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -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\"   -fpic  -g -O2 -c RcppExports.cpp -o RcppExports.o\nIn file included from feather/api.h:24:0,\n                 from feather_types.h:2,\n                 from RcppExports.cpp:4:\n./feather/common.h:24:28: error: both 'const' and 'constexpr' cannot be used here\n./feather/common.h:25:28: error: both 'const' and 'constexpr' cannot be used here\nIn file included from feather/api.h:25:0,\n                 from feather_types.h:2,\n                 from RcppExports.cpp:4:\n./feather/io.h:73:29: error: expected ';' at end of member declaration\n./feather/io.h:73:35: error: 'override' does not name a type\n./feather/io.h:74:26: error: expected ';' at end of member declaration\n./feather/io.h:74:28: error: 'override' does not name a type\n./feather/io.h:75:59: error: expected ';' at end of member declaration\n./feather/io.h:75:61: error: 'override' does not name a type\n./feather/io.h:93:29: error: expected ';' at end of member declaration\n./feather/io.h:93:35: error: 'override' does not name a type\n./feather/io.h:94:26: error: expected ';' at end of member declaration\n./feather/io.h:94:28: error: 'override' does not name a type\n./feather/io.h:95:59: error: expected ';' at end of member declaration\n./feather/io.h:95:61: error: 'override' does not name a type\n./feather/io.h:108:29: error: expected ';' at end of member declaration\n./feather/io.h:108:35: error: 'override' does not name a type\n./feather/io.h:109:26: error: expected ';' at end of member declaration\n./feather/io.h:109:28: error: 'override' does not name a type\n./feather/io.h:110:59: error: expected ';' at end of member declaration\n./feather/io.h:110:61: error: 'override' does not name a type\n./feather/io.h:150:16: error: expected ';' at end of member declaration\n./feather/io.h:150:18: error: 'override' does not name a type\n./feather/io.h:151:29: error: expected ';' at end of member declaration\n./feather/io.h:151:35: error: 'override' does not name a type\n./feather/io.h:152:51: error: expected ';' at end of member declaration\n./feather/io.h:152:53: error: 'override' does not name a type\n./feather/io.h:172:16: error: expected ';' at end of member declaration\n./feather/io.h:172:18: error: 'override' does not name a type\n./feather/io.h:173:29: error: expected ';' at end of member declaration\n./feather/io.h:173:35: error: 'override' does not name a type\n./feather/io.h:174:51: error: expected ';' at end of member declaration\n./feather/io.h:174:53: error: 'override' does not name a type\nmake: *** [RcppExports.o] Error 1\nERROR: compilation failed for package 'feather'\n* removing '/home/travis/build/maxheld83/goodlife/packrat/lib/x86_64-pc-linux-gnu/3.3.2/feather'"
Error: Command failed (1)

Failed to run system command:

	'/home/travis/R-bin/lib/R/bin/R' --vanilla CMD INSTALL '/tmp/RtmpsvJQDC/feather' --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 'feather' ...
** package 'feather' successfully unpacked and MD5 sums checked
Platform is little endian. Good.
** libs
g++ -std=c++0x -I/home/travis/R-bin/lib/R/include -DNDEBUG -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"   -fpic  -g -O2 -c RcppExports.cpp -o RcppExports.o
In file included from feather/api.h:24:0,
                 from feather_types.h:2,
                 from RcppExports.cpp:4:
./feather/common.h:24:28: error: both 'const' and 'constexpr' cannot be used here
./feather/common.h:25:28: error: both 'const' and 'constexpr' cannot be used here
In file incl
Execution halted


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

Your build has been stopped.

Apologies in advance if this is because I am using the makevars wrong.

@maxheld83
Copy link

interestingly, just setting dist = trusty also solves the issue, though I am not sure whether that 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

@jimhester
Copy link
Contributor Author

The first example creates a HEREDOC, so you just need to add CXX=g++-4.9.

Trusty has an older version of GCC as the default, so doesn't run into this issue.

jimhester added a commit to jimhester/readxl that referenced this issue Jan 26, 2017
They are a C99 extension which then requires =c++11 / c++0x causing
other issues (tidyverse#176) as we do not actually use the CXX1X compiler.

The only use of fprintf in ole.c uses two additional arguments, so we
will just hard code that number directly.

Fixes tidyverse#176
jennybc pushed a commit that referenced this issue Jan 26, 2017
They are a C99 extension which then requires =c++11 / c++0x causing
other issues (#176) as we do not actually use the CXX1X compiler.

The only use of fprintf in ole.c uses two additional arguments, so we
will just hard code that number directly.

Fixes #176
@lock lock bot locked and limited conversation to collaborators Oct 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants