Discussion:
smtp.c build failures
(too old to reply)
jungle Boogie
2018-06-28 18:13:28 UTC
Permalink
Hi All,

I know it's still very early on to make use of the new smtp logic, but
I thought I'd report these issues. Is anyone else experiencing issues
with compiling?

FIG_H -D_HAVE_SQLITE_CONFIG_H -g -O2 -o bld/smtp.o -c bld/smtp_.c
./src/smtp.c:54:3: error: use of undeclared identifier 'ns_msg'
ns_msg h; /* DNS reply parser */
^
./src/smtp.c:62:8: warning: implicit declaration of function
'ns_initparse' is invalid in C99
[-Wimplicit-function-declaration]
rc = ns_initparse(aDns,nDns,&h);
^
./src/smtp.c:62:32: error: use of undeclared identifier 'h'
rc = ns_initparse(aDns,nDns,&h);
^
./src/smtp.c:64:10: warning: implicit declaration of function
'ns_msg_count' is invalid in C99
[-Wimplicit-function-declaration]
nRec = ns_msg_count(h, ns_s_an);
^
./src/smtp.c:64:23: error: use of undeclared identifier 'h'
nRec = ns_msg_count(h, ns_s_an);
^
./src/smtp.c:64:26: error: use of undeclared identifier 'ns_s_an'
nRec = ns_msg_count(h, ns_s_an);
^
./src/smtp.c:66:5: error: use of undeclared identifier 'ns_rr'
ns_rr x;
^
./src/smtp.c:69:10: warning: implicit declaration of function
'ns_parserr' is invalid in C99
[-Wimplicit-function-declaration]
rc = ns_parserr(&h, ns_s_an, i, &x);
^
./src/smtp.c:69:22: error: use of undeclared identifier 'h'
rc = ns_parserr(&h, ns_s_an, i, &x);
^
./src/smtp.c:69:25: error: use of undeclared identifier 'ns_s_an'
rc = ns_parserr(&h, ns_s_an, i, &x);
^
./src/smtp.c:69:38: error: use of undeclared identifier 'x'
rc = ns_parserr(&h, ns_s_an, i, &x);
^
./src/smtp.c:71:9: warning: implicit declaration of function
'ns_rr_rdata' is invalid in C99
[-Wimplicit-function-declaration]
p = ns_rr_rdata(x);
^
./src/smtp.c:71:21: error: use of undeclared identifier 'x'
p = ns_rr_rdata(x);
^
./src/smtp.c:72:10: warning: implicit declaration of function
'ns_rr_rdlen' is invalid in C99
[-Wimplicit-function-declaration]
sz = ns_rr_rdlen(x);
^
./src/smtp.c:72:22: error: use of undeclared identifier 'x'
sz = ns_rr_rdlen(x);
^
./src/smtp.c:82:5: warning: implicit declaration of function
'ns_name_uncompress' is invalid in
C99 [-Wimplicit-function-declaration]
ns_name_uncompress(aDns, aDns+nDns, pBest+2,
^
6 warnings and 10 errors generated.
*** Error 1 in /home/jungle/fossil-repos/smtp (./src/main.mk:1628 'bld/smtp.o')

OpenBSD clang version 6.0.0 (tags/RELEASE_600/final) (based on LLVM 6.0.0)
Target: amd64-unknown-openbsd6.3
Thread model: posix
InstalledDir: /usr/bin

Running openBSD -current

Thanks!
--
-------
inum: 883510009027723
sip: ***@sip2sip.info
Richard Hipp
2018-06-28 18:42:27 UTC
Permalink
Post by jungle Boogie
Hi All,
I know it's still very early on to make use of the new smtp logic, but
I thought I'd report these issues. Is anyone else experiencing issues
with compiling?
Did you rerun ./configure?

fossil clean -x
./configure
make

If you still get errors then, please let me know. But first, figure
out what library OpenBSD wants to link against in order to pick up the
DNS parsing routines.
--
D. Richard Hipp
***@sqlite.org
jungle Boogie
2018-06-28 18:58:55 UTC
Permalink
Post by Richard Hipp
Post by jungle Boogie
Hi All,
I know it's still very early on to make use of the new smtp logic, but
I thought I'd report these issues. Is anyone else experiencing issues
with compiling?
Did you rerun ./configure?
fossil clean -x
./configure
make
The build took place in a separate directory, outside my trunk version
of Fossil.
Post by Richard Hipp
If you still get errors then, please let me know. But first, figure
out what library OpenBSD wants to link against in order to pick up the
DNS parsing routines.
Does this help?
http://man.openbsd.org/man3/getrrsetbyname.3
Post by Richard Hipp
--
D. Richard Hipp
Richard Hipp
2018-06-28 19:07:31 UTC
Permalink
Post by jungle Boogie
Does this help?
http://man.openbsd.org/man3/getrrsetbyname.3
That seems to be an OpenBSD-only library function. So, no, it doesn't
really help.

Does OpenBSD have req_query() at least? I suppose I could write my
own DNS record parser. (sigh...)
--
D. Richard Hipp
***@sqlite.org
jungle Boogie
2018-06-28 19:12:53 UTC
Permalink
Post by Richard Hipp
Post by jungle Boogie
Does this help?
http://man.openbsd.org/man3/getrrsetbyname.3
That seems to be an OpenBSD-only library function. So, no, it doesn't
really help.
Does OpenBSD have req_query() at least? I suppose I could write my
own DNS record parser. (sigh...)
https://man.openbsd.org/resolver.3

res_query, res_search, res_mkquery, res_send, res_init, dn_comp, dn_expand —
resolver routines

The res_query() function provides an interface to the server query
mechanism. It constructs a query, sends it to the local server, awaits
a response, and makes preliminary checks on the reply. The query
requests information of the specified type and class for the specified
fully qualified domain name dname. The reply message is left in the
answer buffer with length anslen supplied by the caller. Values for
the class and type fields are defined in <arpa/nameser.h>.

I think that's what you want!
Post by Richard Hipp
--
D. Richard Hipp
-------
inum: 883510009027723
sip: ***@sip2sip.info
Richard Hipp
2018-06-28 19:17:03 UTC
Permalink
Post by jungle Boogie
The res_query() function provides an interface to the server query
mechanism. It constructs a query, sends it to the local server, awaits
a response, and makes preliminary checks on the reply. The query
requests information of the specified type and class for the specified
fully qualified domain name dname. The reply message is left in the
answer buffer with length anslen supplied by the caller. Values for
the class and type fields are defined in <arpa/nameser.h>.
I think that's what you want!
Indeed.

So can you write up a little subroutine to parse the binary DNS reply
and extract the name of the MX host for us?
--
D. Richard Hipp
***@sqlite.org
Martin Gagnon
2018-06-28 19:18:41 UTC
Permalink
Post by jungle Boogie
Post by Richard Hipp
Post by jungle Boogie
Hi All,
I know it's still very early on to make use of the new smtp logic, but
I thought I'd report these issues. Is anyone else experiencing issues
with compiling?
Did you rerun ./configure?
fossil clean -x
./configure
make
The build took place in a separate directory, outside my trunk version
of Fossil.
Post by Richard Hipp
If you still get errors then, please let me know. But first, figure
out what library OpenBSD wants to link against in order to pick up the
DNS parsing routines.
Does this help?
http://man.openbsd.org/man3/getrrsetbyname.3
To use the ns_* function, you needs to install libbind from packages:
pkg_add -r libbind.

Then, I guess we will needs to modify our autosetup script, so it detect
if libbind is installed. If it's the case, it needs to add:
- /usr/local/include/bind to include path
- /usr/local/lib/bind to lib path
- add -lbind to link agains libbind.

I got it to compile, I still have an issue with the linking
part.
--
Martin G.
Richard Hipp
2018-06-28 19:26:42 UTC
Permalink
Post by Martin Gagnon
pkg_add -r libbind.
I'm thinking I will probably end up having to write my own DNS query
response parser....
--
D. Richard Hipp
***@sqlite.org
Martin Gagnon
2018-06-28 19:38:14 UTC
Permalink
Post by Richard Hipp
Post by Martin Gagnon
pkg_add -r libbind.
I'm thinking I will probably end up having to write my own DNS query
response parser....
Ok, that's would be ideal I guess (for portability).

But still, FYI: I just manage to compile and link it successfully with
libbind on OpenBSD.

I don't know how to configure autosetup to detect it automatically, but
I just had to edit the Makefile manually after the "./configure" as
the following:

- addition to CFLAGS variable:
-I/usr/local/include/bind

- addition to LIB variable:
-L/usr/local/lib/libbind -lbind
--
Martin G.
Loading...