Error "requires a C++11 compiler" while g++4.9 installed
See original GitHub issueI have g++ 4.9 installed but still got this error. Tried to remove ~/.node-gyp
and ~/.npm
and doesn’t work.
g++ -v
:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC)
gcc -v
:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC)
npm install zmq
:
> zmq@2.15.2 install /home/xxx/xxx/xxx/node_modules/zmq
> node-gyp rebuild
make: Entering directory `/home/xxx/xxx/xxx/node_modules/zmq/build'
CXX(target) Release/obj.target/zmq/binding.o
In file included from ../binding.cc:38:
../../nan/nan.h:43:3: error: #error This version of node/NAN/v8 requires a C++11 compiler
In file included from ../binding.cc:24:
/home/xxx/.node-gyp/6.2.0/include/node/v8.h:341: error: expected unqualified-id before ‘using’
However it builds well if I just clone zmq
and manually execute node-gyp rebuild
:
node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.3.1
gyp info using node@6.2.0 | linux | x64
gyp info spawn /usr/local/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/xxx/zmq/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/xxx/.node-gyp/6.2.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/xxx/.node-gyp/6.2.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/xxx/zmq',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/xxx/zmq/build'
CXX(target) Release/obj.target/zmq/binding.o
SOLINK_MODULE(target) Release/obj.target/zmq.node
COPY Release/zmq.node
make: Leaving directory `/home/xxx/zmq/build'
gyp info ok
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (3 by maintainers)
Top Results From Across the Web
configure error "A compiler with support for C++11 language ...
I had to add other repositories to my debian system in order to be able to install gcc 5, which was not in...
Read more >gcc(1) - Linux manual page - man7.org
When you compile C++ programs, you should invoke GCC as g++ instead. The gcc program accepts options and file names as operands. Many...
Read more >Install C11 and C17 support in Visual Studio - Microsoft Learn
Install Windows SDK and CRT support for C11 and C17 in Visual Studio. ... Support requires an updated Universal C Runtime (UCRT) and...
Read more >C Compiler Options Reference - Oracle® Solaris Studio 12.4
This chapter describes the C compiler options in alphabetical order. See Appendix A, Compiler Options Grouped by Functionality for options grouped by ...
Read more >Solution: file requires compiler and library support for C++ ...
Solution to the following error message given be GNU-GCC compiler during compilation. Error : # error This file requires compiler and library ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It worked for me.
CC=/opt/rh/devtoolset-4/root/usr/bin/gcc CXX=/opt/rh/devtoolset-4/root/usr/bin/g++ npm install
In my case, g++4.9 is installed in
/opt/rh/devtoolset-3/root/usr/bin/g++
andworks well.
rm /usr/bin/g++
seems risky for me.