NLnetLabs / ldns

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

Solaris and implicit declaration of function 'b64_pton' #155

Open noloader opened 2 years ago

noloader commented 2 years ago

Hi Everyone,

Continuing on the Solaris 11.4 i86 OpenSSH build. I added -lresolv -lsocket -lnsl to my LDFLAGS, and then encountered this issue:

./libtool --tag=CC --quiet --mode=compile /bin/gcc -I. -I. -I/opt/ssh/include -DNDEBUG -
DHAVE_CONFIG_H -DLDNS_TRUST_ANCHOR_FILE="\"/opt/ssh/etc/unbound/dnsrootkey.pem\"" -fno-s
trict-aliasing -Wunused-function -Wstrict-prototypes -Wwrite-strings -W -Wall -g2 -O2 -m
64 -march=native -fPIC -pthread -I/opt/ssh/include -c ./util.c -o util.lo
./util.c:481:1: error: expected identifier or '(' before '{' token
 {
 ^
./util.c: In function 'ldns_b64_pton':
./util.c:492:2: warning: implicit declaration of function 'b64_pton' [-Wimplicit-functio
n-declaration]
  return b64_pton(src, target, targsize);
  ^
gmake: *** [util.lo] Error 1

Note that I am using -m64 for a 64-bit build. I'm not using the Autotools default of a i386 build. From When to Use 64-bit for Applications in the Solaris docs: "All new applications must be developed as 64-bit applications and many of the existing 32-bit applications might require conversion to 64-bit." (Autotools should fix their default config).

I suspect it has to do with Autotools passing some configure tests that previously failed. Now we are in a different configuration/code paths.

I tried the ac_cv_func_b64_pton=no trick, but it resulted in:

./libtool --tag=CC --quiet --mode=compile /bin/gcc -I. -I. -I/opt/ssh/include -DNDEBUG -
DHAVE_CONFIG_H -DLDNS_TRUST_ANCHOR_FILE="\"/opt/ssh/etc/unbound/dnsrootkey.pem\"" -fno-s
trict-aliasing -Wunused-function -Wstrict-prototypes -Wwrite-strings -W -Wall -g2 -O2 -m
64 -march=native -fPIC -pthread -I/opt/ssh/include -c ./util.c -o util.lo
./util.c:481:1: error: expected identifier or '(' before '{' token
 {
 ^
gmake: *** [util.lo] Error 1

Also see GH #153 and GH #154.

noloader commented 2 years ago

It looks like these configure options clear the compile error:

ac_cv_func_b64_ntop=no
ac_cv_func_b64_pton=no