Cannot install fastText because gcc 7.3.1 does not support C++11 on Amazon Linux

Viewed 47

I need to install a system that uses fastText onto an Amazon Linux machine.

As practice, I have been trying to build fastText from source inside an Amazon Linux 2 docker image. I noticed gcc wasn't installed by default, so I installed it first. However, running the pip3 install . command inside the fastText directory gives me the following error, also shown in the screenshot below.

RuntimeError: unsupported compiler -- at least C++11 support is needed!

gcc-7.3.1 should support c++11 but "doesn't"

I tried to look for libraries that would give explicit C++11 support, even though gcc >= 4.8 already should, so I installed libcxx.x86_64 from the Fedora EPEL repository, but that did not help.

Neither this question which applies more to Ubuntu-based images nor this question which refers to a separate pip install (and thus may not give the specific version I need) have the answer I'm looking for.

Edited to add compiler params and error message before the traceback:

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall \
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong \
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic \
 -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.7m \
-c /tmp/tmpi609eyh_.cpp -o tmp/tmpi609eyh_.o -std=c++11

    gcc: error trying to exec 'cc1plus': execvp: No such file or directory

Should I be trying to install whatever package contains cc1plus?

1 Answers

Thanks to this answer from @Sourabh-Jain, I installed the gcc-c++ package and was able to move on in my setup process. Whoever comes across this in the future may not need to install both gcc and gcc-c++, but it is what I did. I'll edit this answer later if I manage to streamline the process.

Edit: the command that helped was

yum install gcc-c++
Related