https://sourceware.org/bugzilla/show_bug.cgi?id=17926
Bug ID: 17926 Summary: Explicit #include "getopt.h" to make opt* visible in binutils/dwarf.c Product: binutils Version: 2.26 (HEAD) Status: NEW Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: antoine64leca at hotmail dot com Created attachment 8103 --> https://sourceware.org/bugzilla/attachment.cgi?id=8103&action=edit proposed patch While building cross-binutils on (not up-to-date and probably "obsolete") MingW/Msys installation, I got an error on binutils/dwarf.c gcc -DHAVE_CONFIG_H -I. -I$SRC/binutils -I. -I$SRC/binutils -I../bfd -I$SRC/binutils/../bfd -I$SRC/binutils/../include -D__USE_MINGW_FSEEK -DLOCALEDIR="\"$PREFIX/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format -Werror -g -O2 -D__USE_MINGW_ACCESS -MT dwarf.o -MD -MP -MF .deps/dwarf.Tpo -c -o dwarf.o $SRC/binutils/dwarf.c $SRC/binutils/dwarf.c: In function `dwarf_select_sections_by_letters': $SRC/binutils/dwarf.c:7381: error: `optarg' undeclared (first use in this function) $SRC/binutils/dwarf.c:7381: error: (Each undeclared identifier is reported only once $SRC/binutils/dwarf.c:7381: error: for each function it appears in.) make[3]: *** [dwarf.o] Error 1 I did have the same problem years ago (on Minix 2, another non-Posix.2 platform), and I determined it had to do with file "getopt.h" (detected by autoconf) not explicitly #included for this source file, while the optarg variable was used. I noticed many other source files from bintils/ directory do #include "getopt.h", so the proposed patch is likely to be innocuous for the vast majority; but it does fix my two cases of failure. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils