Skip to contentSkip to conversation

Build fixes

PATCH In review Jeremy Sowden 3 participants 10 messages Sep 25, 2021 – Sep 27, 2021 netfilter

lore
Share & tools
lore
#0 lore raw

cover Build fixes

The first three patches contain changes suggested by autoupdate. Four and five bring the handling of the yacc- and lex-generated sources more in line with the automake doc's. The last one fixes a race in parallel builds.

Jeremy Sowden (6):
build: remove commented-out macros from configure.ac
build: quote AC_INIT arguments
build: replace AM_PROG_LIBTOOL and AC_DISABLE_STATIC with

    `LT_INIT`

build: remove yacc-generated header from EXTRA_DIST
build: clean yacc- and lex-generated files with maintainer-clean
build: fix dependency-tracking of yacc-generated header

 configure.ac    | 30 ++----------------------------
 src/Makefile.am |  5 ++---
 2 files changed, 4 insertions(+), 31 deletions(-)
Signature · 1 line
2.33.0
#1 lore raw

PATCH 1/6 build: remove commented-out macros from configure.ac

This code has been commented out since at least 2007.

---
 configure.ac | 25 -------------------------
 1 file changed, 25 deletions(-)
configure.ac +0 -25
index d0565bed3532..5ff8921b6fc8 100644
@@ -75,37 +75,12 @@ AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$enable_systemd" = "xyes"])
 
 AC_CHECK_HEADERS([linux/capability.h],, [AC_MSG_ERROR([Cannot find linux/capabibility.h])])
 
-# Checks for libraries.
-# FIXME: Replace `main' with a function in `-lc':
-dnl AC_CHECK_LIB([c], [main])
-# FIXME: Replace `main' with a function in `-ldl':
-
 AC_CHECK_HEADERS(arpa/inet.h)
-dnl check for inet_pton
 AC_CHECK_FUNCS(inet_pton)
 
-# Checks for header files.
-dnl AC_HEADER_STDC
-dnl AC_CHECK_HEADERS([netinet/in.h stdlib.h])
-
-# Checks for typedefs, structures, and compiler characteristics.
-dnl AC_C_CONST
-dnl AC_C_INLINE
-
 # Let nfct use dlopen() on helper libraries without resolving all symbols.
 AX_CHECK_LINK_FLAG([-Wl,-z,lazy], [AC_SUBST([LAZY_LDFLAGS], [-Wl,-z,lazy])])
 
-# Checks for library functions.
-dnl AC_FUNC_MALLOC
-dnl AC_FUNC_VPRINTF
-dnl AC_CHECK_FUNCS([memset])
-
-dnl AC_CONFIG_FILES([Makefile
-dnl                  debug/Makefile
-dnl                  debug/src/Makefile
-dnl                  extensions/Makefile
-dnl                  src/Makefile])
-
 if test ! -z "$libdir"; then
 	MODULE_DIR="\\\"$libdir/conntrack-tools/\\\""
 	CFLAGS="$CFLAGS -DCONNTRACKD_LIB_DIR=$MODULE_DIR"
Signature · 1 line
2.33.0
#3 lore raw

PATCH 3/6 build: replace `AM_PROG_LIBTOOL` and `AC_DISABLE_STATIC` with `LT_INIT`

In reply to Jeremy Sowden

AM_PROG_LIBTOOL is superseded by LT_INIT, which also accepts options to control the defaults for creating shared or static libraries.

---
 configure.ac | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
configure.ac +1 -2
index c690a92be5fd..3a3af4549162 100644
@@ -13,9 +13,8 @@ AC_SEARCH_LIBS([dlopen], [dl], [libdl_LIBS="$LIBS"; LIBS=""])
 AC_SUBST([libdl_LIBS])
 
 AC_PROG_CC
-AC_DISABLE_STATIC
 AM_PROG_AR
-AM_PROG_LIBTOOL
+LT_INIT([disable-static])
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AM_PROG_LEX
Signature · 1 line
2.33.0
#4 lore raw

PATCH 4/6 build: remove yacc-generated header from EXTRA_DIST

In reply to Jeremy Sowden

Automake generates yacc and lex output files and includes them in distributions as a matter of course.

---
 src/Makefile.am | 2 --
 1 file changed, 2 deletions(-)
src/Makefile.am +0 -2
index 2e66ee96b709..75b16a7b6f35 100644
@@ -77,5 +77,3 @@ conntrackd_LDADD += ${LIBSYSTEMD_LIBS}
 endif
 
 conntrackd_LDFLAGS = -export-dynamic
-
-EXTRA_DIST = read_config_yy.h
Signature · 1 line
2.33.0
#5 lore raw

PATCH 5/6 build: clean yacc- and lex-generated files with maintainer-clean

In reply to Jeremy Sowden

Automake expects to distribute yacc- and lex-generated sources, so that the user doesn't need to regenerate them. Therefore, the appropriate target to clean them is maintainer-clean.

---
 src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/Makefile.am +1 -1
index 75b16a7b6f35..85ea18888e97 100644
@@ -6,7 +6,7 @@ endif
 
 AM_YFLAGS = -d
 
-CLEANFILES = read_config_yy.c read_config_lex.c
+MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.c
 
 sbin_PROGRAMS = conntrack conntrackd nfct
 
Signature · 1 line
2.33.0
#6 lore raw

PATCH 6/6 build: fix dependency-tracking of yacc-generated header

In reply to Jeremy Sowden

List it as a built source in order to force make to create it before compilation. Otherwise, a parallel make can end up attempting to compile the output of lex before yacc has finished generating its own output:

  $ make -j17
  [...]
  YACC     read_config_yy.c
  LEX      read_config_lex.c
  CC       stack.o
  CC       resync.o
  CC       cthelper.o
  CC       helpers.o
  CC       utils.o
  CC       expect.o
  CC       systemd.o
  CC       nfct.o
  CC       nfct-extensions/helper.o
  CC       nfct-extensions/timeout.o
  CC       read_config_lex.o
  read_config_lex.l:25:10: fatal error: read_config_yy.h: No such file or directory
  25 | #include "read_config_yy.h"
  |          ^~~~~~~~~~~~~~~~~~
  compilation terminated.
  make[2]: *** [Makefile:701: read_config_lex.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  updating read_config_yy.h
  make[2]: Leaving directory '/space/azazel/work/git/netfilter/conntrack-tools/src'
  make[1]: *** [Makefile:743: all-recursive] Error 1
  make[1]: Leaving directory '/space/azazel/work/git/netfilter/conntrack-tools/src'
  make: *** [Makefile:541: all-recursive] Error 1
---
 src/Makefile.am | 1 +
 1 file changed, 1 insertion(+)
src/Makefile.am +1 -0
index 85ea18888e97..1f234749d35d 100644
@@ -6,6 +6,7 @@ endif
 
 AM_YFLAGS = -d
 
+BUILT_SOURCES = read_config_yy.h
 MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.c
 
 sbin_PROGRAMS = conntrack conntrackd nfct
Signature · 1 line
2.33.0
#7 lore raw

Re: [conntrack-tools 6/6] build: fix dependency-tracking of yacc-generated header

Quoted 11 lines · Jeremy Sowden

List it as a built source in order to force make to create it before compilation. Otherwise, a parallel make can end up attempting to compile the output of lex before yacc has finished generating its own output:

src/Makefile.am +0 -0
@@ -6,6 +6,7 @@ endif
 

AM_YFLAGS = -d

Quoted 2 lines

+BUILT_SOURCES = read_config_yy.h
MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.c

I have a strong reason to believe that you could just write

read_config_yy.h: read_config_yy.y

(detail https://lists.gnu.org/archive/html/automake/2021-09/msg00011.html )

#8 lore raw

Re: [conntrack-tools 6/6] build: fix dependency-tracking of yacc-generated header

Quoted 12 lines · Jan Engelhardt
Quoted 11 lines · Jeremy Sowden

List it as a built source in order to force make to create it before compilation. Otherwise, a parallel make can end up attempting to compile the output of lex before yacc has finished generating its own output:

src/Makefile.am +0 -0
@@ -6,6 +6,7 @@ endif
 
 AM_YFLAGS = -d
 
Quoted 8 lines

src/Makefile.am endif · line 10

Quoted 2 lines
src/Makefile.am +1 -0
+BUILT_SOURCES = read_config_yy.h
 MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.c

I have a strong reason to believe that you could just write

read_config_yy.h: read_config_yy.y

(detail https://lists.gnu.org/archive/html/automake/2021-09/msg00011.html )

Automake complains:

src/Makefile.am:65: warning: user target 'read_config_yy.h' defined here ...
automake: ... overrides Automake target 'read_config_yy.h' defined here

From the documentation (https://www.gnu.org/software/automake/manual/automake.html#Extending):

Note that Automake does not make any distinction between rules with commands and rules that only specify dependencies. So it is not possible to append new dependencies to an automake-defined target without redefining the entire rule.

In this case, adding the rule you suggest to Makefile.am suppresses the rule that automake would normally generate:

  read_config_yy.h: read_config_yy.c
          @if test ! -f $@; then rm -f read_config_yy.c; else :; fi
          @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) read_config_yy.c; else :; fi

J.

#9 lore raw
In reply to Jeremy Sowden
Quoted 4 lines · Jeremy Sowden

The first three patches contain changes suggested by autoupdate. Four and five bring the handling of the yacc- and lex-generated sources more in line with the automake doc's. The last one fixes a race in parallel builds.

Series applied, thanks.