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

1

0

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?

Kellerman answered 14/9, 2022 at 6:44 Comment(7)
The GCC 7 release series should have C++11 enabled as standard. Are you sure about the version used? Is there a way to check or see what flags and options are really passed to GCC?Vernation
I'd have assumed the same, I'm not sure what flags are exactly being passed in the script that pip calls. Let me see if I can find those.Kellerman
libcxx is not gcc. Did you actually install gcc, or only libcxx?Guilty
Yup, gcc was also installed. It's 7.3.1 as in the title. Let me update the question body. Thanks for checking :)Kellerman
@Someprogrammerdude I've added the flags from the gcc call. Does anything seem off to youKellerman
For C++ you should really invoke the g++ driver program. And install the g++ package (if it's separate from gcc).Vernation
I found a gcc-c++ package from another thread. I'll answer it here and try to credit the other poster if it still matters to them. Thanks for taking the time to look at this though - the gcc invocation wasn't my choice, it was in the fastText install script. It may be worthwhile submitting a patch to them also, idkKellerman
K
5

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++
Kellerman answered 14/9, 2022 at 6:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.