Re: r245838: make world fails: /usr/src/usr.bin/dtc/dtc.cc:196:24: error: use of undeclared identifier 'optarg', string arg = string(optarg);

From: David Chisnall <theraven_at_FreeBSD.org>
Date: Wed, 23 Jan 2013 08:57:05 +0000
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)
> [...]
> 


Received on Wed Jan 23 2013 - 07:57:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:34 UTC