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

Cygwin compatibility #197

Open FGasper opened 1 year ago

FGasper commented 1 year ago

The test suite fails under Cygwin:

--------------- Start Output: 04-run-normal ------------------
!! FAILED !!     !! FAILED !!
DateRunEnd: 0
BaseName: 04-run-normal
Description: run drill and don't do anything fancy
DateRunStart: 0
--------------- Test Output ------------------
Error: @server ip could not be converted
exit code: 1
--------------- End Output: 04-run-normal ------------------
--------------- Start Output: 12-unit-tests-dnssec ------------------
!! FAILED !!     !! FAILED !!
DateRunEnd: 0
BaseName: 12-unit-tests-dnssec
Description: Run unit tests on dnssec.c
DateRunStart: 0
--------------- Test Output ------------------
--------- Start Pre Output -------------------
autoconf: /usr/bin/autoconf
autoheader: /usr/bin/autoheader
make: /cygdrive/c/Strawberry/c/bin/gmake
options:
config.status: creating 12-unit-tests-dnssec.Makefile
gmake[1]: Entering directory 'C:/cygwin64/home/cpanel/ldns/test/12-unit-tests-dnssec.o6zLo2'
gcc -I../.. -fno-strict-aliasing -Wunused-function -Wstrict-prototypes -Wwrite-strings -W -Wall -g -O2 -c ./12-unit-tests-dnssec.c
gcc -fno-strict-aliasing -Wunused-function -Wstrict-prototypes -Wwrite-strings -W -Wall -g -O2 -L../../.libs -o 12-unit-tests-dnssec 12-unit-tests-dnssec.o -lssl  -lcrypto -lldns
gmake[1]: Leaving directory 'C:/cygwin64/home/cpanel/ldns/test/12-unit-tests-dnssec.o6zLo2'
----------- End Pre Output -------------------
C:/cygwin64/home/cpanel/ldns/test/12-unit-tests-dnssec.o6zLo2/12-unit-tests-dnssec.exe: error while loading shared libraries: cygldns-3.dll: cannot open shared object file: No such file or directory
exit code: 127
--------------- End Output: 12-unit-tests-dnssec ------------------

All of the failures track with the above: either a) a failure to find cygldns-3.dll, or b) @server ip could not be converted.

A. cygldns-3.dll

This can be fixed by symlinking to the .libs directory from within the test directory. Alternatively, it could be fixed by making the test link to the static libldns.a rather than the dynamic library.

(NB: Cygwin lacks “rpath”, so it’s not possible to hard-code the path to cygldns-3.dll in the compiled executable.)

B. @server ip could not be converted

This comes from drill.c, which is calling ldns_resolver_new_frm_file but getting a failure. The failure isn’t reported very well, but that is its own problem.

The filename argument given to ldns_resolver_new_frm_file is NULL, which causes that function to look in /etc/resolv.conf—which doesn’t exist in Cygwin.

Assumedly, then, LDNS’s resolver just doesn’t work in Cygwin … ?