On 10/01/2018 11:24 AM, Ken Moffat via blfs-dev wrote:
On Mon, Oct 01, 2018 at 06:16:46AM +0200, Thomas Trepl via blfs-dev wrote:
Am Sonntag, den 30.09.2018, 23:06 -0400 schrieb Clayton Johnson via blfs-dev:
DHCP 4.4.1 broken in guide as of GCC 8 update.

Attached patch will fix this issue.

What do you mean by "broken"? What is the issue which gets fixed by that patch?

dhcp compiles fine here with gcc-8.2.0.


Very odd.  I built it (in chroot), and installed the client, last
week on a build from svn with no problem.

But after seeing Clayton's response I tried it on 8.3 and sure
enough it failed because of -Werror:

gcc -DHAVE_CONFIG_H -I. -I../includes  -I.. -DLOCALSTATEDIR='"/var"'   -g -O2  
-Wall -Werror -fno-strict-aliasing -I../includes -I/tmp/dhcp-4.4.1/bind/include -MT 
discover.o -MD -MP -MF .deps/discover.Tpo -c -o discover.o discover.c
discover.c: In function ‘discover_interfaces’:
discover.c:646:4: error: ‘strncpy’ output may be truncated copying 15 bytes 
from a string of length 15 [-Werror=stringop-truncation]
     strncpy(tmp->name, info.name, sizeof(tmp->name) - 1);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:500: discover.o] Error 1

Even more odd, I had done the same thing on this machine when
building/testing 8.3 and the log for that only shows:

gcc -DHAVE_CONFIG_H -I. -I../includes  -I.. -DLOCALSTATEDIR='"/var"'   -O2 -march=native        
-D_PATH_DHCLIENT_SCRIPT='"/sbin/dhclient-script"'                 
-D_PATH_DHCPD_CONF='"/etc/dhcp/dhcpd.conf"'                       
-D_PATH_DHCLIENT_CONF='"/etc/dhcp/dhclient.conf"'  -I../includes -I/building/dhcp-4.4.1/bind/include -MT 
discover.o -MD -MP -MF .deps/discover.Tpo -c -o discover.o discover.c
mv -f .deps/discover.Tpo .deps/discover.Po

Retrying with my own CFLAGS (-O2 -march=native) at the start
of the CFLAGS works fine.  Ah ha!  When I build normally, I use

  CFLAG="$CFLAGS -D_PATH...

and that is causing -Wall -Werror -fno-strict-aliasing to be
omitted, but what is in the book merely adds defines to those existing
CFLAGS.

The configure script in bind causes the problem:

# If we have gcc, and AC_PROG_CC changed the flags, then we know the
# user did not specify any flags. Add warnings in this case.
if test "$GCC" = "yes"; then
   if test "$CFLAGS" != "$SAVE_CFLAGS"; then
      STD_CWARNINGS="$STD_CWARNINGS -Wall -Werror -fno-strict-aliasing"
   fi
fi

If the Werror is remove from the above, the build completes.

Actually I'm quite disappointed in a package as important as dhcp has as many warnings as they do (18 total by my count). These are the different warnings:

-Wformat-overflow )1)
-Wformat-truncation (6)
-Wimplicit-fallthrough (9)
-Wstringop-truncation (2)

  -- Bruce
--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to