You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compiling bahamut fails on macOS 12.6.7 (and other versions) when linking ircd:
Undefined symbols for architecture x86_64:
"_res_mkquery", referenced from:
_query_name in res.o
ld: symbol(s) not found for architecture x86_64
This problem was previously reported to MacPorts for version 2.0.7 back in 2014 but the problem remains with version 2.2.2.
One problem is that the -lresolv flag has not been supplied to the linker due to #229. Working around that is necessary but not sufficient to fix this issue.
As explained in #229, the symbol name in libresolv on macOS is not _res_mkquery but _res_9_mkquery, and getting this to work requires that the resolv.h header be included.
res.c does include resolv.h, but includes the local copy of resolv.h in bahamut's include directory. The include directory contains some other local copies of system headers: inet.h, nameser.h, queue.h, and cdefs.h (which doesn't even appear to be used anywhere). Trying to use these local non-macOS-compatible versions of system headers is the problem; deleting them and fixing everything to use the real system headers solved the problem for me. To get it to build, I did the following:
In the include directory, delete cdefs.h, inet.h, nameser.h, queue.h, and resolv.h.
In src/Makefile.in, delete all occurrences of ../include/inet.h, ../include/nameser.h, ../include/queue.h, and ../include/resolv.h.
In src/*.c and include/*.h, change all #includes of the deleted local headers to use the system ones:
Change this...
...to this:
#include "inet.h"
#include <arpa/inet.h>
#include "nameser.h"
#include <arpa/nameser.h>
#include "queue.h"
#include <sys/queue.h>
#include "resolv.h"
#include <resolv.h>
Remove these conflicting externs in src/res.c:
--- src/res.c.orig+++ src/res.c@@ -58,15 +58,6 @@
#define RES_HOSTLEN 127 /* big enough to handle addresses in in6.arpa */
-extern int dn_expand(char *, char *, char *, char *, int);-extern int dn_skipname(char *, char *);-extern int-res_mkquery(int, char *, int, int, char *, int,- struct rrec *, char *, int);--#ifndef AIX-extern int errno, h_errno;-#endif
extern int highest_fd;
extern aClient *local[];
Add -DBIND_8_COMPAT to CPPFLAGS since otherwise the headers to not define old BIND 8 stuff like HEADER which bahamut uses.
I'm not sure why bahamut has local copies of system headers. They've been there ever since the initial import into this repository in 1999. I can speculate that back then, some operating systems may have had broken system headers and that bahamut was attempting to provide fixed versions. If you don't need to support those old systems anymore, I suggest deleting the bundled system headers and fixing things up as indicated. If you do still need to support old systems, is there a way that you could use the local system headers only on those old systems so that modern systems are not impacted?
The text was updated successfully, but these errors were encountered:
Compiling bahamut fails on macOS 12.6.7 (and other versions) when linking ircd:
This problem was previously reported to MacPorts for version 2.0.7 back in 2014 but the problem remains with version 2.2.2.
One problem is that the
-lresolv
flag has not been supplied to the linker due to #229. Working around that is necessary but not sufficient to fix this issue.As explained in #229, the symbol name in libresolv on macOS is not
_res_mkquery
but_res_9_mkquery
, and getting this to work requires that the resolv.h header be included.res.c does include resolv.h, but includes the local copy of resolv.h in bahamut's include directory. The include directory contains some other local copies of system headers: inet.h, nameser.h, queue.h, and cdefs.h (which doesn't even appear to be used anywhere). Trying to use these local non-macOS-compatible versions of system headers is the problem; deleting them and fixing everything to use the real system headers solved the problem for me. To get it to build, I did the following:
../include/inet.h
,../include/nameser.h
,../include/queue.h
, and../include/resolv.h
.#include
s of the deleted local headers to use the system ones:extern
s in src/res.c:-DBIND_8_COMPAT
to CPPFLAGS since otherwise the headers to not define old BIND 8 stuff likeHEADER
which bahamut uses.I'm not sure why bahamut has local copies of system headers. They've been there ever since the initial import into this repository in 1999. I can speculate that back then, some operating systems may have had broken system headers and that bahamut was attempting to provide fixed versions. If you don't need to support those old systems anymore, I suggest deleting the bundled system headers and fixing things up as indicated. If you do still need to support old systems, is there a way that you could use the local system headers only on those old systems so that modern systems are not impacted?
The text was updated successfully, but these errors were encountered: