Fairseq: error: command 'gcc' failed with exit status 1 - fairseq/clib/libbleu/libbleu.cpp:9:10: fatal error: 'map' file not found

Created on 25 Sep 2018  Â·  14Comments  Â·  Source: pytorch/fairseq

ython setup.py build develop
running build
running build_py
running build_ext
building 'fairseq.libbleu' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jpope/miniconda3/envs/tf/include -arch x86_64 -I/Users/jpope/miniconda3/envs/tf/include -arch x86_64 -I/Users/jpope/miniconda3/envs/tf/include/python3.7m -c fairseq/clib/libbleu/libbleu.cpp -o build/temp.macosx-10.7-x86_64-3.7/fairseq/clib/libbleu/libbleu.o -std=c++11
fairseq/clib/libbleu/libbleu.cpp:9:10: fatal error: 'map' file not found

include

     ^~~~~

1 error generated.
error: command 'gcc' failed with exit status 1

I'm on majove / 10.14
I have xcode 10.1 beta installed with command line tools.

xcodebuild -version && xcrun --find clang --version
Xcode 9.4.1
Build version 9F2000
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Most helpful comment

For mac os Mojave for me was using export CFLAGS='-stdlib=libc++' before calling python setup.py install

All 14 comments

actually - above error was on 9.4.1

I tried switching to 10.1 and same error.

xcodebuild -version && xcrun --find clang --version
Xcode 10.1
Build version 10O23u
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
(tf) ➜ fairseq git:(master) ✗ /Users/jpope/Documents/tensorflowWorkspace/fairseq
(tf) ➜ fairseq git:(master) ✗ python setup.py build develop
running build
running build_py
running build_ext
building 'fairseq.libbleu' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jpope/miniconda3/envs/tf/include -arch x86_64 -I/Users/jpope/miniconda3/envs/tf/include -arch x86_64 -I/Users/jpope/miniconda3/envs/tf/include/python3.7m -c fairseq/clib/libbleu/libbleu.cpp -o build/temp.macosx-10.7-x86_64-3.7/fairseq/clib/libbleu/libbleu.o -std=c++11
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
fairseq/clib/libbleu/libbleu.cpp:9:10: fatal error: 'map' file not found

include

     ^~~~~

1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1

setup.py

bleu = Extension(
    'fairseq.libbleu',
    sources=[
        'fairseq/clib/libbleu/libbleu.cpp',
        'fairseq/clib/libbleu/module.cpp',
    ],
    extra_compile_args=['-std=libc++'],
)

this didn't work.

Xcode 10 beta 4 - stdlibc++ headers not found;
https://forums.developer.apple.com/thread/106114

(tf) ➜ fairseq git:(master) ✗ gcc --version
Configured with: --prefix=/Applications/Xcode-beta.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
(tf) ➜ fairseq git:(master) ✗ whereis gcc
/usr/bin/gcc
(tf) ➜ fairseq git:(master) ✗ whereis make
/usr/bin/make

so the folder c++ doesn't exist for MacOSX10.14

/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/???

I dragged the c++ folder from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk

to
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

which solved the missing map error - but now I got missing array error.
screen shot 2018-09-25 at 12 39 43 pm

c++ --version
c++ (GCC) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

fixed it using DGTEST_USE_OWN_TR1_TUPLE=1
extra_compile_args=['-stdlib=libc++','-DGTEST_USE_OWN_TR1_TUPLE=1'],
https://gist.github.com/johndpope/7d221fcccb4d478e3450792584566eef

For Linux system solution for me was using export CFLAGS='-std=c++11' before calling python setup.py build develop.

For mac os Mojave for me was using export CFLAGS='-stdlib=libc++' before calling python setup.py install

For mac os Mojave for me was using export CFLAGS='-stdlib=libc++' before calling python setup.py install

thanks a lot. It works for me.

@tlikhomanenko I'm using Ubuntu but I'm still getting the same error even after exporting CFLAGS... any suggestion?

This is the error I get:

building 'fairseq.libbleu' extension
[...]
fairseq/clib/libbleu/module.cpp:9.20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x68_64-linux-gnu-gcc' failed with exit status 1

For mac os Mojave for me was using export CFLAGS='-stdlib=libc++' before calling python setup.py install

THX a lot,you really help me ,it cost me a lot lot lot lot time to solve.feeling my brain is been eating by Zombi

For mac os Mojave for me was using export CFLAGS='-stdlib=libc++' before calling python setup.py install

Thank you @likeucode , it works also for me

For mac os Mojave for me was using export CFLAGS='-stdlib=libc++' before calling python setup.py install

Also worked for me! Thank you !

Was this page helpful?
0 / 5 - 0 ratings