DALnet / bahamut

The Bahamut IRC Daemon
http://www.dal.net/?page=Bahamut
Other
57 stars 42 forks source link

configure script can't identify location of res_mkquery on macOS #229

Open ryandesign opened 1 year ago

ryandesign commented 1 year ago

On macOS 12.6.7 (and other versions), bahamut fails to determine that res_mkquery is in fact located in libresolv:

checking for res_mkquery... no
checking for res_mkquery in -lresolv... no
checking for __res_mkquery... no
checking for __res_mkquery in -lresolv... no

As a result of this failure, the required -lresolv flag is not added when linking.

It can be worked around by adding ac_cv_lib_resolv_res_mkquery=yes as an argument when running ./configure.

This problem was previously reported to MacPorts for version 2.0.7 back in 2014 but the problem remains with version 2.2.2.

The problem seems to be that the configure test compiles and links this program:

char res_mkquery ();
int
main (void)
{
return res_mkquery ();
  ;
  return 0;
}

The config.log shows that the configure test failed because:

Undefined symbols for architecture x86_64:
  "_res_mkquery", referenced from:
      _main in conftest-ddc300.o
ld: symbol(s) not found for architecture x86_64

And this is true: There is no symbol _res_mkquery in libresolv on macOS; the symbol is actually called _res_9_mkquery. You're expected to #include <resolv.h> which contains the #defines that make this work:

#define res_mkquery     res_9_mkquery

It seems like the fix would be for the configure test to #include <resolv.h> rather than declaring a fake res_mkquery function, but I'm not sufficiently well versed in autoconf to make that change myself.

This is not the only fix needed to compile this code on macOS; I'll file additional tickets for the rest.

ryandesign commented 9 months ago

It can be worked around by adding ac_cv_lib_resolv_res_mkquery=yes as an argument when running ./configure.

This workaround no longer works in bahamut 2.2.3 due to 42b67ff7218877934abed2a738e164c0dea171b0. Instead, I now use ac_cv_search_res_mkquery=-lresolv.