Skip to content

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

@ryandesign

Description

@ryandesign

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions