NLnetLabs / ldns

LDNS is a DNS library that facilitates DNS tool programming
https://nlnetlabs.nl/ldns
BSD 3-Clause "New" or "Revised" License
285 stars 94 forks source link

Makefile.in: build config.h before any object #192

Closed trofi closed 5 days ago

trofi commented 1 year ago

Object files lack dependency on config.h symlink (and usually depend only on ldns/config.h). As a result build occasionally fails in make --shuffe mode:

$ make --shuffle
...
./libtool --tag=CC --quiet --mode=compile gcc -I. -I.  \
  -DHAVE_CONFIG_H -DLDNS_TRUST_ANCHOR_FILE="\"...-dns-root-data-2019-01-11/root.key\"" \
  -DOPENSSL_API_COMPAT=10100 -fno-strict-aliasing -Wunused-function -Wstrict-prototypes \
  -Wwrite-strings -W -Wall -g -O2 -I...-openssl-3.0.7-dev/include -c examples/ldns-rrsig.c \
  -o examples/ldns-rrsig.o
examples/ldns-rrsig.c:10:10: fatal error: config.h: No such file or directory
   10 | #include "config.h"
      |          ^~~~~~~~~~

The change moves config.h symlink creation in setup-builddir from a dependency on final binary to dependency on all individual objects.

While at it regenerated dependencies with make depend.

before the change make --shuffle build was failing in about 50% cases. After the change: make --shuffle succeeded 80 times in a row.

trofi commented 4 days ago

Oh, I just noticed you have reverted the change. I still see the build failures on the current masterdevelop:

ldns> ./examples/ldns-keyfetcher.c:10:10: fatal error: config.h: No such file or directory
ldns>    10 | #include "config.h"
ldns>       |          ^~~~~~~~~~
ldns> compilation terminated.
ldns> examples/ldns-keyfetcher.c:10:10: fatal error: config.h: No such file or directory
ldns>    10 | #include "config.h"
ldns>       |          ^~~~~~~~~~
ldns> compilation terminated.
wtoorop commented 3 days ago

Yes, I did reverse it and I was a bit in a hurry, so failed to tell you about it. The problem basically was that setup-builddir doesn't have a target file to check if it is done. So if you make all object files depend on it, all object files will be built every time you run make. Even if they are already built. If we can come up with a workaround, we can still include it for the release coming Friday.