Date: Mon, 30 Jul 2018 09:18:02 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 230184] clang++ failed to include standard header files if '-stdlib=libstdc++' option is specified Message-ID: <bug-230184-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D230184 Bug ID: 230184 Summary: clang++ failed to include standard header files if '-stdlib=3Dlibstdc++' option is specified Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: yasu@utahime.org In the OPTIONS section of clang(1) man page '-stdlib' option is explained as following: ---------------------------------------------------------------------- -stdlib=3D<library> Specify the C++ standard library to use; supported options are libstdc++ and libc++. If not specified, platform default will be used. ---------------------------------------------------------------------- But if '-stdlib=3Dlibstdc++' is specified clang++ fails to include standard header files such as 'iostream' or 'cstdio'. yasu@rolling-vm-freebsd1[1724]% uname -a FreeBSD rolling-vm-freebsd1.home.utahime.org 12.0-CURRENT FreeBSD 12.0-CURR= ENT #0 r336739: Sun Jul 29 07:46:09 JST 2018=20=20=20=20 rootz@rolling-vm-freebsd1.home.utahime.org:/usr0/freebsd/base/obj/usr0/free= bsd/base/head/amd64.amd64/sys/GENERIC_UTAHIME amd64 yasu@rolling-vm-freebsd1[1725]% cat Makefile CXX=3D clang++ RM=3D rm -f CXXFLAGS+=3D -stdlib=3Dlibstdc++ TARGETS =3D cpptest01 \ cpptest02 OBJECTS =3D cpptest01.o \ cpptest02.o all: ${TARGETS} cpptest01: cpptest01.o $(CXX) $(CXXFLAGS) -o $@ $> cpptest02: cpptest02.o $(CXX) $(CXXFLAGS) -o $@ $> clean: ${RM} ${TARGETS} ${OBJECTS} yasu@rolling-vm-freebsd1[1726]% cat cpptest01.cpp #include <iostream> int main(int argc, char **argv) { std::cout << "Hello, World" << std::endl; return 0; } yasu@rolling-vm-freebsd1[1727]% cat cpptest02.cpp #include <cstdio> int main(int argc, char **argv) { std::printf("Hello, World\n"); return 0; } yasu@rolling-vm-freebsd1[1728]% make -k clang++ -O2 -pipe -stdlib=3Dlibstdc++ -c cpptest01.cpp -o cpptest01.o cpptest01.cpp:1:10: fatal error: 'iostream' file not found #include <iostream> ^~~~~~~~~~ 1 error generated. *** Error code 1 (continuing) clang++ -O2 -pipe -stdlib=3Dlibstdc++ -c cpptest02.cpp -o cpptest02.o cpptest02.cpp:1:10: fatal error: 'cstdio' file not found #include <cstdio> ^~~~~~~~ 1 error generated. *** Error code 1 (continuing) `all' not remade because of errors. yasu@rolling-vm-freebsd1[1728]% --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-230184-227>