Date: Wed, 23 Jan 2013 08:57:05 +0000 From: David Chisnall <theraven@FreeBSD.org> To: "O. Hartmann" <ohartman@zedat.fu-berlin.de> Cc: Current FreeBSD <freebsd-current@FreeBSD.org> Subject: Re: r245838: make world fails: /usr/src/usr.bin/dtc/dtc.cc:196:24: error: use of undeclared identifier 'optarg', string arg = string(optarg); Message-ID: <86EC4A5E-7426-48D1-B4C4-E60B61FD5797@FreeBSD.org> In-Reply-To: <50FF9C2B.30403@zedat.fu-berlin.de> References: <50FEB409.9060907@zedat.fu-berlin.de> <50FEB83D.1000806@zedat.fu-berlin.de> <50FF9C2B.30403@zedat.fu-berlin.de>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
This appears to be caused by your addition of -stdlib=libc++ -std=c++11 to your CXXFLAGS. So, first of all, thank you for testing libc++!
I tested with libc++ while I was developing dtc, but then was building with libstdc++ while I was removing extraneous includes. Unfortunately, libstdc++ leaks a load of C headers, whereas libc++ is very careful not to. I've now (r245839) explicitly included everything so it now builds with libc++ and in C++11 mode.
Thanks for the report,
David
On 23 Jan 2013, at 08:15, O. Hartmann wrote:
> Make world fails in /usr/src/usr.bin/dtc/dtc.cc with a lot of errors
> com[laining about an undeclared identifier:
>
> [...]
> ===> usr.bin/dtc (obj,depend,all,install)
> /usr/obj/usr/src/tmp/usr/src/usr.bin/dtc created for /usr/src/usr.bin/dtc
> rm -f .depend
> mkdep -f .depend -a -I/usr/obj/usr/src/tmp/legacy/usr/include
> -std=c++11 -stdlib=libc++ /usr/src/usr.bin/dtc/dtc.cc
> /usr/src/usr.bin/dtc/input_buffer.cc /usr/src/usr.bin/dtc/string.cc
> /usr/src/usr.bin/dtc/dtb.cc /usr/src/usr.bin/dtc/fdt.cc
> /usr/src/usr.bin/dtc/checking.cc
> echo dtc: /usr/lib/libc.a /usr/obj/usr/src/tmp/legacy/usr/lib/libegacy.a
>>> .depend
> echo dtc: /usr/lib/libc++.a >> .depend
> c++ -O2 -pipe -O3 -I/usr/obj/usr/src/tmp/legacy/usr/include
> -stdlib=libc++ -std=c++11 -c /usr/src/usr.bin/dtc/dtc.cc
> c++ -O2 -pipe -O3 -I/usr/obj/usr/src/tmp/legacy/usr/include
> -stdlib=libc++ -std=c++11 -c /usr/src/usr.bin/dtc/input_buffer.cc
> /usr/src/usr.bin/dtc/input_buffer.cc:116:11: error: use of undeclared
> identifier 'strtoll'
> [...]
> 7 errors generated.
> *** [string.o] Error code 1
> /usr/src/usr.bin/dtc/input_buffer.cc:218:10: error: use of undeclared
> identifier 'stderr'
> fprintf(stderr, "Current cursor: %d\n", cursor);
> ^
> /usr/src/usr.bin/dtc/input_buffer.cc:219:42: error: use of undeclared
> identifier 'stderr'
> fwrite(&buffer[cursor], size-cursor, 1, stderr);
> ^
> /usr/src/usr.bin/dtc/input_buffer.cc:227:3: error: use of undeclared
> identifier 'perror'
> perror("Failed to stat file");
> ^
> /usr/src/usr.bin/dtc/input_buffer.cc:234:3: error: use of undeclared
> identifier 'perror'
> perror("Failed to mmap file");
> ^
> /usr/src/usr.bin/dtc/input_buffer.cc:249:20: error: use of undeclared
> identifier 'stdin'
> while ((c = fgetc(stdin)) != EOF)
> ^
> /usr/src/usr.bin/dtc/input_buffer.cc:249:31: error: use of undeclared
> identifier 'EOF'
> while ((c = fgetc(stdin)) != EOF)
> ^
> 15 errors generated.
> *** [input_buffer.o] Error code 1
> /usr/src/usr.bin/dtc/dtb.cc:87:2: error: use of undeclared identifier
> 'write'
> write(fd, buffer.data(), buffer.size());
> ^
> /usr/src/usr.bin/dtc/dtb.cc:125:2: error: use of undeclared identifier
> 'snprintf'; did you mean 'vswprintf'?
> snprintf(out, 3, "%.2hhx", b);
> ^~~~~~~~
> vswprintf
> /usr/include/wchar.h:130:5: note: 'vswprintf' declared here
> int vswprintf(wchar_t * __restrict, size_t n, const wchar_t *
> __restrict,
> ^
> /usr/src/usr.bin/dtc/dtb.cc:125:11: error: cannot initialize a parameter
> of type 'wchar_t *' with an lvalue of type 'char [3]'
> snprintf(out, 3, "%.2hhx", b);
> ^~~
> /usr/include/wchar.h:130:35: note: passing argument to parameter here
> int vswprintf(wchar_t * __restrict, size_t n, const wchar_t *
> __restrict,
> ^
> /usr/src/usr.bin/dtc/dtb.cc:218:2: error: use of undeclared identifier
> 'write'
> write(fd, buffer.data(), buffer.size());
> ^
> /usr/src/usr.bin/dtc/dtb.cc:259:11: error: use of undeclared identifier
> 'stderr'
> fprintf(stderr, "Missing magic token in header. Got %"
> PRIx32
> ^
> 5 errors generated.
> *** [dtb.o] Error code 1
> /usr/src/usr.bin/dtc/dtc.cc:102:15: error: use of undeclared identifier
> 'getopt'
> while ((ch = getopt(argc, argv, options)) != -1)
> [...]
>
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.18 (Darwin)
iQIcBAEBAgAGBQJQ/6XiAAoJEKx65DEEsqIdRl8P/1xiRx/UPA2kv+xRb+ANobi8
x7oHcrCAA4DosqtzA70mBMgH7FAL5s2QlaCRv24smyeWK4JhmdFuARv+K/AnhPaT
2ItHDh8sqtjKlmxBCsOW3HcbrrNI7MQEFuJE8IlKNDWJ1UvbumexoVNWdWiJFGj2
MARMC3flMhP8YSgy//daSe7s3DJsbxunoLPi86qLgTGS/DNzl5cY5pMQHvt6mMZ0
Oob5eTt13WKyXtBCytVOmHZ2gWW3k3IIayyhJ7x0izYIeILi21yxisHVyNf6Tzcy
1uEGZiieOl/2wzucYHkD3gY9KF9mjRT9oxZxm4bF82TbJBU0tBL+njqK/plTt1IW
LpGASa/XHhq0aROebNBlDAe/wt7f2K9zpy4+rJXCPEkfNo1c8J0ndXZQ42HVQbWG
k12Md0zX/a9RlOv1Iba9EFFIMMPOBdN3i9DOLcY6H22RaOITSFXkEKpJkhMMyqBQ
0Ae2P3eVRUP80SaUBjtsFGB6SpoUNnaXn77fe5BwairFJoBC2PijR4hU4mEHf5Ok
HDuYuPL7EsGS0tW38+25KddHGBSKc8CLQb4d8M4Dn/NMQjLgkA5mQ5ZBiiP2Jgu8
GFjli3H+T3YNPE3Drsj2cZY+XCWGcH62Kg5XWRhYT4dO4/EbgrahVqY9RCsICsNr
65BLxJwvLrQfS7Nd/BWu
=oovN
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86EC4A5E-7426-48D1-B4C4-E60B61FD5797>
