Bug 12891

Summary: implicit declaration of function ‘_doprnt’ in libiberty/vfprintf.c
Product: gdb Reporter: Kamaraju Kusumanchi <kamaraju>
Component: buildAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal CC: tromey, tromey
Priority: P2    
Version: 7.2   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Attachments: libiberty/config.log is attached

Description Kamaraju Kusumanchi 2011-06-15 04:58:28 UTC
when compiling gdb with -Werror option, the compilation stops with the following error.

if [ x"" != x ]; then \
          i486-linux-gnu-gcc -c -DHAVE_CONFIG_H -g -Werror   -I. -I/home/gdb/gdb-7.2/gdb-7.2/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic   /home/gdb/gdb-7.2/gdb-7.2/libiberty/vfprintf.c -o pic/vfprintf.o; \
        else true; fi
i486-linux-gnu-gcc -c -DHAVE_CONFIG_H -g -Werror   -I. -I/home/gdb/gdb-7.2/gdb-7.2/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  /home/gdb/gdb-7.2/gdb-7.2/libiberty/vfprintf.c -o vfprintf.o
/home/gdb/gdb-7.2/gdb-7.2/libiberty/vfprintf.c: In function ‘vfprintf’:
/home/gdb/gdb-7.2/gdb-7.2/libiberty/vfprintf.c:14:3: error: implicit declaration of function ‘_doprnt’ [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors

make[3]: *** [vfprintf.o] Error 1
make[3]: Leaving directory `/home/gdb/gdb-7.2/gdb-7.2/build/objdir/libiberty'
make[2]: *** [all-libiberty] Error 2
make[2]: Leaving directory `/home/gdb/gdb-7.2/gdb-7.2/build/objdir'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/gdb/gdb-7.2/gdb-7.2/build/objdir'
make: *** [debian/stamp-makefile-build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2


debian_chroot:sid:kusumanchi:/home/gdb/gdb-7.2# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/i386-linux-gnu/gcc/i486-linux-gnu/4.6.1/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.0-13' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-multiarch --with-multiarch-defaults=i386-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/i386-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib/i386-linux-gnu --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.6.1 20110611 (prerelease) (Debian 4.6.0-13)
Comment 1 Tom Tromey 2011-06-15 21:01:03 UTC
It seems to me that vfprintf.c should not be compiled on a Debian box.
I suspect the error occurs elsewhere.  Maybe libiberty/config.log
would be helpful.
Comment 2 Kamaraju Kusumanchi 2011-06-15 22:56:05 UTC
Created attachment 5794 [details]
libiberty/config.log is attached

As per the request, I am attaching the libiberty/config.log
Comment 3 Tom Tromey 2011-06-16 13:32:18 UTC
I think the problem is in autoconf.
libiberty uses AC_REPLACE_FUNCS and apparently this is not
-Werror safe.  From the log:


configure:5913: checking for vfprintf
configure:5913: i486-linux-gnu-gcc -o conftest -g -Werror     conftest.c  >&5
conftest.c:86:6: error: conflicting types for built-in function 'vfprintf' [-Werror]
cc1: all warnings being treated as errors


You could report this to the autoconf maintainers.
Meanwhile, don't configure with -Werror.
Comment 4 Tom Tromey 2022-04-08 01:45:10 UTC
Not really a gdb bug, more of an autoconf thing and/or don't pass
-Werror to configure.