Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
963 views
in Technique[技术] by (71.8m points)

c++ - unrecognized command line option '-stdlib=libc++' gcc (Homebrew gcc 5.3.0) 5.3.0

I run Mac OSX El Capitan, I have installed via Homebrew gcc version 5.3.0.

I want to install pyopencl (but as I understand it doesn't matter) and when running the following command:

gcc -fno-strict-aliasing -fwrapv -Wall -O3 -DNDEBUG -DPYGPU_PACKAGE=pyopencl -DPYGPU_PYOPENCL=1 -Isrc/c_wrapper/ -I/Users/earendilllock/anaconda/include/python2.7 -c build/temp.macosx-10.5-x86_64-2.7/pyopencl._cffi.cpp -o build/temp.macosx-10.5-x86_64-2.7/build/temp.macosx-10.5-x86_64-2.7/pyopencl._cffi.o -std=c++0x -stdlib=libc++ -mmacosx-version-min=10.7 -arch i386 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

I have obtained the following error:

gcc: error: unrecognized command line option '-stdlib=libc++'
error: command 'gcc' failed with exit status 1
make: *** [all] Error 1

I could not find the solution for resolving that problem via Google, but I hope it exists.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As the error message says, the gcc compiler has no such commandline option as -stdlib. The LLVM clang compiler does. That is because clang offers you the choice of linking the LLVM standard C++ library (libc++) or the GNU standard C++ library (libstdc++), whereas gcc supports only libstdc++.

Delete the option -stdlib=libc++. You might as well also replace -std=c++0x with -std=c++11, since the former denotes experimental support for the 2011 C++11 standard, applicable for gcc versions 4.3 through 4.6.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...