1

I use Debian 5. I was building GN. I followed the instruction provided here. I was executing these commands:

git clone https://gn.googlesource.com/gn
cd gn
python build/gen.py
ninja -C out

While executing ninja -C out/ I receive this message:

ninja: Entering directory `out/'   
[1/238] CXX tools/gn/input_file.o  
FAILED: tools/gn/input_file.o   
clang++ -MMD -MF tools/gn/input_file.o.d  -I/home/us/WebRTCBuild/gn -I/home/us/WebRTCBuild/gn/out -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -std=c++14 -Wno-c++11-narrowing -c /home/us/WebRTCBuild/gn/tools/gn/input_file.cc -o tools/gn/input_file.o    
/bin/sh: clang++: command not found
[2/238] CXX base/callback_internal.o     
FAILED: base/callback_internal.o    
clang++ -MMD -MF base/callback_internal.o.d  -I/home/us/WebRTCBuild/gn -I/home/us/WebRTCBuild/gn/out -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -std=c++14 -Wno-c++11-narrowing -c /home/us/WebRTCBuild/gn/base/callback_internal.cc -o  
base/callback_internal.o       
/bin/sh: clang++: command not found        
ninja: build stopped: subcommand failed.  

As far as I understand problem shown in this message:

/bin/sh: clang++: command not found

I already installed llvm. But it didn't work. I also read that it may be caused by absence of g++. But g++ installed.

Result of executing echo $PATH:

/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/gcc49/bin

2

While the Lenny package archive is not working for me right now, the file /usr/bin/clang++ is provided by the clang package on Debian 8 Jessie. The llvm package does not depend on the clang package so clang may not be installed. Try installing it with sudo apt install clang. If that does not work could you run echo $PATH and post the results?

  • sudo apt install clang and sudo apt-get install clang doesn't work for me. Result of echo $PATH I posted in question – Andriy Buchynskyy Nov 23 '18 at 9:46
0

I solved this problem by avoiding clang compiler. I noticed that in build/gen.py there is option that gives me possibility to set compiler. By default it's clang. So in build/gen.py I changed this part that is below.

def WriteGNNinja(path, platform, host, options): if platform.is_msvc(): cc = os.environ.get('CC', 'cl.exe') cxx = os.environ.get('CXX', 'cl.exe') ld = os.environ.get('LD', 'link.exe') ar = os.environ.get('AR', 'lib.exe') elif platform.is_aix(): cc = os.environ.get('CC', 'gcc') cxx = os.environ.get('CXX', 'g++') ld = os.environ.get('LD', 'g++') ar = os.environ.get('AR', 'ar -X64') else: cc = os.environ.get('CC', 'clang') cxx = os.environ.get('CXX', 'clang++') ld = cxx ar = os.environ.get('AR', 'ar')

I Changed these lines:

cc = os.environ.get('CC', 'clang') cxx = os.environ.get('CXX', 'clang++') ld = cxx ar = os.environ.get('AR', 'ar')

to this:

cc = os.environ.get('CC', 'gcc') cxx = os.environ.get('CXX', 'gcc') ld = cxx ar = os.environ.get('AR', 'gcc')

Now I receive errors during executing ninja -C out but they connected to compiling of code. Problem of /bin/sh: clang++: command not found solved

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.