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

Package installation error: "C++11 standard requested but CXX11 is not defined" #26

Closed
ghost opened this issue May 26, 2017 · 27 comments
Closed

Comments

@ghost
Copy link

ghost commented May 26, 2017

Hi

I have been trying to install packages such as text2vec on MRO open 3.4.0 on a completely updated Linux Mint 18.1 64 bit system and I am getting the above-mentioned error message; here are more details:

.libPaths()

[1] "/home/laptop/R/x86_64-pc-linux-gnu-library/3.3"

[2] "/usr/lib64/microsoft-r/3.4/lib64/R/library"

install.packages("text2vec", lib=.libPaths()[2])

[...]

* installing source package ‘text2vec’ ...

** package ‘text2vec’ successfully unpacked and MD5 sums checked

** libs

Error in .shlib_internal(args) :

C++11 standard requested but CXX11 is not defined

* removing ‘/usr/lib64/microsoft-r/3.4/lib64/R/library/text2vec’

I have seen this discussion http://r.789695.n4.nabble.com/R-3-4-has-broken-C-11-support-td4732692.html but it didn't help me figure out what to do. Here's some info that might help:

R.version

platform x86_64-pc-linux-gnu

arch x86_64

os linux-gnu

system x86_64, linux-gnu

status

major 3

minor 4.0

year 2017

month 04

day 21

svn rev 72570

language R

version.string R version 3.4.0 (2017-04-21)

nickname You Stupid Darkness

Any thoughts?

@aarongrider
Copy link

Hi @stgries.

This was a bug in the CRAN R release. They have release a patch and we are in the process of patching our distribution right now. You should see an update soon.

@ghost
Copy link
Author

ghost commented May 26, 2017 via email

@aarongrider
Copy link

Hi @stgries,
I'm sorry, I was actually mistaken. The bug from CRAN is a different issue that we will be soon releasing a patch for, but this one is our bug :) We will be looking into it and keep you updated.

@aarongrider
Copy link

We will targeting a fix for this in our next release. Unfortunately it's not as simple as just updating our compiler flags since we are using a different toolchain to enable support for older platforms.

In the meantime, you should be able to copy the correct flags into your /etc/Makeconf. The provided Makeconf configuration should work for CentOS 7.

Makeconf.txt

@mjmg
Copy link

mjmg commented May 27, 2017

@aarongrider Provided patch for Makeconf fails under CENTOS7

Based on CRAN R 3.4.0 notes

INSTALLATION on a UNIX-ALIKE

configure now adds a compiler switch for C++11 code, even if the compiler supports C++11 by default. (This ensures that g++ 6.x uses C++11 mode and not its default mode of C++14 with ‘GNU extensions’.)

The tests for C++11 compliance are now much more comprehensive. For gcc < 4.8, the tests from R 3.3.0 are used in order to maintain the same behaviour on Linux distributions with long-term support.

An alternative compiler for C++11 is now specified with CXX11, not CXX1X. Likewise C++11 flags are specified with CXX11FLAGS and the standard (e.g., -std=gnu++11 is specified with CXX11STD.

configure now tests for a C++14-compliant compiler by testing some basic features. This by default tries flags for the compiler specified by CXX11, but an alternative compiler, options and standard can be specified by variables CXX14, CXX14FLAGS and CXX14STD (e.g., -std=gnu++14).

There is a new macro CXXSTD to help specify the standard for C++ code, e.g. -std=c++98. This makes it easier to work with compilers which default to a later standard: for example, with CXX=g++6 CXXSTD=-std=c++98 configure will select commands for g++ 6.x which conform to C++11 and C++14 where specified but otherwise use C++98.

It seems CXX1X is no longer accepted by R 3.4 version. Will have to double check this.

CENTOS 7 compiler also gives error on a bunch of packages based on Makeconf patch gcc/g++ parameters :

gcc: error: unrecognized command line option '-Wdate-time'

Please confirm if next MRO release will be the 3.4.1 version. If so then this will be ~1 month after CRAN R 3.4.1 release?

@kuzmenkov111
Copy link

Same problem on ubuntu 14.04 cant install fst package
Error in .shlib_internal(args) :
C++11 standard requested but CXX11 is not defined

  • removing ‘/usr/lib64/microsoft-r/3.4/lib64/R/library/fst’

@tspanos
Copy link

tspanos commented Jun 15, 2017

I have the same issue on Red Hat Enterprise Linux 7.3. The OS is fully updated. In my case I am attempting to install package xgboost.

installing *source* package ‘xgboost’ ...
package ‘xgboost’ successfully unpacked and MD5 sums checked
configure: creating ./config.status
config.status: creating src/Makevars
libs
Error in .shlib_internal(args) :
C++11 standard requested but CXX11 is not defined
removing ‘/usr/lib64/microsoft-r/3.4/lib64/R/library/xgboost’

GCC details.

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

@bgreve
Copy link

bgreve commented Jun 27, 2017

I'm running into the same problem when trying to install the feather package in MRO 3.4.0 on Red Hat Enterprise Linux 7.3:
Error in .shlib_internal(args) : C++11 standard requested but CXX11 is not defined
I tried updating the compiler flags according to the Makeconf.txt provided above but couldn't get it to work. There's no known workaround at this point, right?

@mjmg
Copy link

mjmg commented Jun 28, 2017

I was able to get past the error by editing the Makeconf file as follows:

  1. Remove/Comment out:
CXX1X = 
CXX1XFLAGS = 
CXX1XPICFLAGS = 
CXX1XSTD = 
  1. Replace with:
CXX11 = g++
CXX11FLAGS = -O2 -g $(LTO)
CXX11PICFLAGS = -fPIC
CXX11STD = -std=c++11

Now the compile fails at the linking stage:

sh: line 2: -L/usr/lib64/microsoft-r/3.4/lib64/R/lib: No such file or directory

EDIT:
You also have to change the following:

  1. Remove/Comment out:
SHLIB_CXX1XLD = $(CXX1X) $(CXX1XSTD)
SHLIB_CXX1XLDFLAGS = -shared
  1. Replace with:
SHLIB_CXX11LD = $(CXX11) $(CXX11STD)
SHLIB_CXX11LDFLAGS = -shared

In summary, all instances of "CXX1X" should be replaced with "CXX11" in your

${R_HOME}/etc/Makeconf

for system changes or

~/.R/Makevars

for per user changes to resolve the

C++11 standard requested but CXX11 is not defined

error when building some packages that depend on C++11 code.

@bgreve
Copy link

bgreve commented Jul 4, 2017

Thanks mjmg, I edited the Makeconf according to your instructions and it almost works. But eventually, it now throws the following error (when trying to install the feather package):

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [feather.so] Error 1
ERROR: compilation failed for package ‘feather’

Feels like I'm almost there. Do you have any more ideas for the workaround?

EDIT: Ignore that, I had a typo in one of the flag names despite double-checking everything twice. mjmg's solution works for me as well.

@mjmg
Copy link

mjmg commented Jul 5, 2017

@bgreve Package feather installs fine on my CENTOS7 docker container and FEDORA 25 host

@chendaniely
Copy link

chendaniely commented Jul 7, 2017

thanks @mjmg your solution worked.

I would add it wasn't as simple as replace CXX1X with CXX11 since the flags were not provided in the original Makeconf

Here are the original (comment out) and 'corrections'

# CXX1X = 
# CXX1XFLAGS = 
# CXX1XPICFLAGS = 
# CXX1XSTD = 
CXX11 = g++
CXX11FLAGS = -O2 -g $(LTO)
CXX11PICFLAGS = -fPIC
CXX11STD = -std=c++11


# SHLIB_CXX1XLD = $(CXX1X) $(CXX1XSTD)
# SHLIB_CXX1XLDFLAGS = -shared
SHLIB_CXX11LD = $(CXX11) $(CXX11STD)
SHLIB_CXX11LDFLAGS = -shared

edit:

if you need a Makeconf to just paste (without having to manually edit lines) here's the one I've been using for our docker images: https://github.com/bi-sdal/mro-ldap-ssh-c7/blob/master/Makeconf

@dtrv
Copy link

dtrv commented Jul 20, 2017

Same problem on SLES12 and installing shiny. @mjmg solution works!

@yo904
Copy link

yo904 commented Aug 6, 2017

I'm getting the same error while installing ITKR using the following command.

devtools::install_github( "stnava/ITKR" )
...
** libs
Error in .shlib_internal(args) :
C++11 standard requested but CXX11 is not defined

  • removing ‘/home/ysk/R/x86_64-pc-linux-gnu-library/3.3/ITKR’
    Installation failed: run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), stderr_line_callback = real_callback(stderr), stdout_callback = real_block_callback, stderr_callback = real_block_callback, echo_cmd = echo, echo = show, spinner = spinner, error_on_status = fail_on_status, timeout = timeout) : System command error

However, I don't have Makeconf file in my /etc/ directory.
Is there any possible solution for me?
I'm using Ubuntu 16.04 & MRO 3.4

platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 4.0
year 2017
month 04
day 21
svn rev 72570
language R
version.string R version 3.4.0 (2017-04-21)
nickname You Stupid Darkness


Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial

@bgreve
Copy link

bgreve commented Aug 6, 2017

yo904, it's not in your /etc under root. Have you checked within your R_HOME directory for the etc directory, perhaps in one of the subfolders?

@yo904
Copy link

yo904 commented Aug 6, 2017

Thank you for your comment. I found Makeconf at /etc/R/.
Although I changed the Makeconf file, I get different error, which I don't know whether Makeconf is related or not.


-- Installing: /usr/local/lib/R/site-library/ITKR/libs/lib/libitkMGHIO-4.12.a
make[1]: Leaving directory '/tmp/RtmpStZg1m/devtoolsd242575b402/stnava-ITKR-f071cb1/src/itkb'
-L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o ITKR.so dummy.o -L/usr/lib/R/lib -lR
/bin/bash: line 2: -L/usr/lib/R/lib: No such file or directory
/usr/share/R/share/make/shlib.mk:6: recipe for target 'ITKR.so' failed
make: *** [ITKR.so] Error 127
ERROR: compilation failed for package ‘ITKR’

  • removing ‘/usr/local/lib/R/site-library/ITKR’
    Installation failed: Command failed (1)

@Data-Jack
Copy link

I am still getting this when installing packages on 3.4.1. The same edits to Makeconf above worked.

@seonghobae
Copy link

Dear all, Why this issue doesn't fix? Should I make a push request?

@jmagosta
Copy link

This error re-appears with install.packages("forecast") on MRO 3.4.1, Ubuntu 16.04, on the "RcppArmadillo" install. It turns out that
package ‘RccpArmadillo’ is not available (for R version 3.4.1)
Work arounds?

@bioinformatist
Copy link

shiny is one of the most popular packages in R, and the package httpuv is one of its dependencies.
When try install httpuv:

install.packages('httpuv')

It comes to:

Installing package into ‘/home/ysun/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  417k  100  417k    0     0   158k      0  0:00:02  0:00:02 --:--:--  158k
* installing *source* package ‘httpuv’ ...
** package ‘httpuv’ successfully unpacked and MD5 sums checked
** libs
Error in .shlib_internal(args) : 
  C++11 standard requested but CXX11 is not defined
* removing ‘/home/ysun/R/x86_64-pc-linux-gnu-library/3.3/httpuv’
Warning in install.packages :
  installation of package ‘httpuv’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpGN8vxY/downloaded_packages’

So it seems C++11 standard requested but CXX11 is not defined error has confused us for long time. If it is a bug in MRO, can anyone fix it?

@seonghobae
Copy link

This issue also reproducible in CentOS 7.

@mjmg
Copy link

mjmg commented Oct 29, 2017

This issue seems to be fixed in MRO 3.4.2

${R_HOME}/etc/Makeconf gives:

CXX11 = g++
CXX11FLAGS = -DU_STATIC_IMPLEMENTATION -g -O2
CXX11PICFLAGS = -fpic
CXX11STD = -std=gnu++11
CXX14 = 
CXX14FLAGS = 
CXX14PICFLAGS = 
CXX14STD = 
CXX17 = 
CXX17FLAGS = 
CXX17PICFLAGS = 
CXX17STD = 
SHLIB_CFLAGS = 
SHLIB_CXXFLAGS = 
SHLIB_CXXLD = $(CXX)
SHLIB_CXXLDFLAGS = -shared
SHLIB_CXX98LD = $(CXX98) $(CXX98STD)
SHLIB_CXX98LDFLAGS = -shared
SHLIB_CXX11LD = $(CXX11) $(CXX11STD)
SHLIB_CXX11LDFLAGS = -shared
SHLIB_CXX14LD = $(CXX14) $(CXX14STD)
SHLIB_CXX14LDFLAGS = -shared
SHLIB_CXX17LD = $(CXX17) $(CXX17STD)
SHLIB_CXX17LDFLAGS = -shared
## legacy
CXX1X = g++
CXX1XFLAGS = -g -O2
CXX1XPICFLAGS = -fpic
CXX1XSTD = -std=gnu++11
SHLIB_CXX1XLD = $(CXX11) $(CXX11STD)
SHLIB_CXX1XLDFLAGS = -shared

@seonghobae
Copy link

seonghobae commented Oct 29, 2017 via email

@xhudik
Copy link

xhudik commented Nov 11, 2017

this issue is happening on HDInsight (ubuntu 16.4, Microsoft Machine Learning Server 1.5.0). It is funny Microsoft has changed the name of the product once or twice since rhis bug was reported, however the bug is still here :)

@reiselgp
Copy link

reiselgp commented Jan 10, 2018

Any solution to this issue? I have a Microsoft R Enterprise 9.2 (Machine Learning Server) running on Azure Ubuntu VM and we are facing this issue with R and C++11 when try to install Prophet (Facebook Forecasting Library)

Best regards.

@xhudik
Copy link

xhudik commented Jan 10, 2018 via email

@luckylara
Copy link

emmm.....,i solve this problem by finding {R_HOME}. in my system it is /usr/lib/R , thank you @mjmg

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