# compile problems on Mac OS X (with XCode 1.2 and BIND9)

**URL:** <https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525>\
**Category:** Zeek\
**Created:** [June 21, 2004, 8:30pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525 "2004-06-21T20:30:50Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ruoming\_Pang](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@Ruoming\_Pang](https://community.zeek.org/u/Ruoming_Pang)\
**Post date:** [June 21, 2004, 8:30pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/1 "2004-06-21T20:30:50Z")

</div>

Hi,

I don't if this is the right list to post this message, but in case someone has the same problem, she can resolve it manually before we fix in in the configure script. (Vern, I can't find project Bro on either Mantis or bugzilla.)

I am trying to compile Bro on a Mac OS X and encounter the following two problems, both related to nb\_dns.c:

The first is compile error. It is because the header file arpa/nameser.h does not define HEADER, which is defined in arpa/nameser\_compat.h. nameser\_compat.h will be included by nameser.h only if BIND\_8\_COMPAT is defined, but I don't know if we should define that. After including nameser\_compat.h in nb\_dns.c, it is able to compile correctly.

gcc -I. -Ilibedit -O -c nb\_dns.c  
nb\_dns.c: In function `\_nb\_dns\_mkquery':  
nb\_dns.c:255: error: syntax error before '\*' token  
nb\_dns.c:306: error: `hp' undeclared (first use in this function)  
nb\_dns.c:306: error: (Each undeclared identifier is reported only once  
nb\_dns.c:306: error: for each function it appears in.)  
nb\_dns.c:306: error: `HEADER' undeclared (first use in this function)  
nb\_dns.c:306: error: parse error before ')' token  
nb\_dns.c: In function `nb\_dns\_host\_request2':  
nb\_dns.c:340: error: `T\_A' undeclared (first use in this function)  
nb\_dns.c:345: error: `T\_AAAA' undeclared (first use in this function)  
nb\_dns.c: In function `nb\_dns\_addr\_request2':  
nb\_dns.c:412: error: `T\_PTR' undeclared (first use in this function)  
nb\_dns.c: In function `nb\_dns\_activity':  
nb\_dns.c:468: error: `HFIXEDSZ' undeclared (first use in this function)  
nb\_dns.c:576: error: `T\_A' undeclared (first use in this function)  
nb\_dns.c:577: error: `T\_AAAA' undeclared (first use in this function)  
nb\_dns.c:605: error: `T\_PTR' undeclared (first use in this function)  
make: \*\*\* [nb\_dns.o] Error 1

Next came the link error:

ld: Undefined symbols:  
\_res\_9\_dn\_expand  
\_res\_9\_init  
\_res\_9\_mkquery  
\_res\_9\_ns\_initparse  
\_res\_9\_ns\_msg\_getflag  
\_res\_9\_ns\_parserr

This is because libresolv is not linked. Looking at the configure script reveals that it looks for libresolv.a, but only libresolv.dylib is available. Just adding '-lresolv' to Makefile solves the problem.

Ruoming

---

<div class="post-metadata">

**Author:** ![Christian\_Kreibich3](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@Christian\_Kreibich3](https://community.zeek.org/u/Christian_Kreibich3)\
**Post date:** [June 21, 2004, 8:57pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/2 "2004-06-21T20:57:42Z")

</div>

Hi,

---

<div class="post-metadata">

**Author:** ![Ruoming\_Pang](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@Ruoming\_Pang](https://community.zeek.org/u/Ruoming_Pang)\
**Post date:** [June 21, 2004, 11:04pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/3 "2004-06-21T23:04:56Z")

</div>

> what version is this?

It's the latest version: 0.9a2. Let me download 0.8 and see if that compiles.

Ruoming

---

<div class="post-metadata">

**Author:** ![Christian\_Kreibich3](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@Christian\_Kreibich3](https://community.zeek.org/u/Christian_Kreibich3)\
**Post date:** [June 21, 2004, 11:29pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/4 "2004-06-21T23:29:17Z")

</div>

Somebody sponsor me a powerbook and I'll fix it in no time! \*grin\*

(Sorry I have no way to reproduce that ... good luck!)

Cheers,  
Christian.

---

<div class="post-metadata">

**Author:** ![Christian\_Kreibich3](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@Christian\_Kreibich3](https://community.zeek.org/u/Christian_Kreibich3)\
**Post date:** [June 22, 2004, 7:28pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/5 "2004-06-22T19:28:59Z")

</div>

FYI, I'm having the same problem. Just created an account and see no  
projects -- do those have to be assigned by the administrator?

Thanks,  
Christian.

---

<div class="post-metadata">

**Author:** ![Jason\_Lee](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@Jason\_Lee](https://community.zeek.org/u/Jason_Lee)\
**Post date:** [June 22, 2004, 8:33pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/6 "2004-06-22T20:33:53Z")

</div>

The mantis bro page is at:  
[http://crd.lbl.gov/mantis-bro/main\_page.php](http://crd.lbl.gov/mantis-bro/main_page.php)

Cheers,  
jason

Christian Kreibich wrote:

---

<div class="post-metadata">

**Author:** ![Christian\_Kreibich3](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@Christian\_Kreibich3](https://community.zeek.org/u/Christian_Kreibich3)\
**Post date:** [June 22, 2004, 8:49pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/7 "2004-06-22T20:49:19Z")

</div>

Hi!

---

<div class="post-metadata">

**Author:** ![Jose\_M\_Gonzalez](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@Jose\_M\_Gonzalez](https://community.zeek.org/u/Jose_M_Gonzalez)\
**Post date:** [June 22, 2004, 11:19pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/8 "2004-06-22T23:19:34Z")

</div>

I get a similar problem. I can see what looks like the main  
Bro Mantis page, but when I click on "Report Bug", I can  
only see "All Projects" as the "Choose Project" entry. If  
I try to click on "Select Project", my browser stays in that  
page.

-Chema

---

<div class="post-metadata">

**Author:** ![Christian\_Kreibich3](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@Christian\_Kreibich3](https://community.zeek.org/u/Christian_Kreibich3)\
**Post date:** [July 10, 2004, 1:31am UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/9 "2004-07-10T01:31:46Z")

</div>

Hi,

I looked into this today ... thank Brian for prodding me -- you owe me a  
beer because fixing this was painful and nobody has donated a powerbook  
so far 🙂

> I am trying to compile Bro on a Mac OS X and encounter the following  
> two problems, both related to nb\_dns.c:
> 
> The first is compile error. It is because the header file  
> arpa/nameser.h does not define HEADER, which is defined in  
> arpa/nameser\_compat.h. nameser\_compat.h will be included by nameser.h  
> only if BIND\_8\_COMPAT is defined, but I don't know if we should define  
> that. After including nameser\_compat.h in nb\_dns.c, it is able to  
> compile correctly.

[snip]

> Next came the link error:
> 
> ld: Undefined symbols:  
> \_res\_9\_dn\_expand  
> \_res\_9\_init  
> \_res\_9\_mkquery  
> \_res\_9\_ns\_initparse  
> \_res\_9\_ns\_msg\_getflag  
> \_res\_9\_ns\_parserr
> 
> This is because libresolv is not linked. Looking at the configure  
> script reveals that it looks for libresolv.a, but only libresolv.dylib  
> is available. Just adding '-lresolv' to Makefile solves the problem.

Okay ... well what I see here is that if BIND\_8\_COMPAT is defined,  
nameser8\_compat.h is included (note the "8"), and that causes  
nonblocking lookups to be disabled because nameser8\_compat does not  
define ns\_msg.

What I'm doing in the attached patch is

1. check whether you're running Darwin  
2. if so, test whether just including arpa/nameser.h gives you HEADER  
3. if 2 fails, include arpa/nameser\_compat.h and use -lresolv instead of  
/usr/lib/libresolv.a

Just using -lresolv in general bombs on at least Linux. \*sigh\*.

Build tested on Darwin, Linux, FreeBSD. Apply with -p1. The patch also  
contains a few comments for configure.ac, and removes duplicated ones  
for OpenSSL checks.

Fingers crossed,  
Christian.

[bro-resolver-darwin.diff](https://community.zeek.org/uploads/short-url/5l2OaLhs1nj38WX7fX9eAIzuaco.diff) (3.55 KB)

---

<div class="post-metadata">

**Author:** ![Ruoming\_Pang](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@Ruoming\_Pang](https://community.zeek.org/u/Ruoming_Pang)\
**Post date:** [July 10, 2004, 4:14am UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/10 "2004-07-10T04:14:55Z")

</div>

Christian,

Thanks for looking into it.

> you owe me a beer because ....

Sure. 🙂

> Okay ... well what I see here is that if BIND\_8\_COMPAT is defined,  
> nameser8\_compat.h is included (note the "8"), and that causes  
> nonblocking lookups to be disabled because nameser8\_compat does not  
> define ns\_msg.
> 
> What I'm doing in the attached patch is
> 
> 1. check whether you're running Darwin  
> 2. if so, test whether just including arpa/nameser.h gives you HEADER  
> 3. if 2 fails, include arpa/nameser\_compat.h and use -lresolv instead of  
> /usr/lib/libresolv.a
> 
> Just using -lresolv in general bombs on at least Linux. \*sigh\*.
> 
> Build tested on Darwin, Linux, FreeBSD. Apply with -p1. The patch also  
> contains a few comments for configure.ac, and removes duplicated ones  
> for OpenSSL checks.

I'm wondering if the problem is due to BIND 9 rather than Darwin. Just a random, unverified thought, as I haven't tried it on any other system that has BIND 9. But the FreeBSD on jaguar doesn't have BIND 9.

Ruoming

---

<div class="post-metadata">

**Author:** ![Christian\_Kreibich3](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@Christian\_Kreibich3](https://community.zeek.org/u/Christian_Kreibich3)\
**Post date:** [July 10, 2004, 8:28am UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/11 "2004-07-10T08:28:59Z")

</div>

Hi!

> I'm wondering if the problem is due to BIND 9 rather than Darwin. Just  
> a random, unverified thought, as I haven't tried it on any other system  
> that has BIND 9. But the FreeBSD on jaguar doesn't have BIND 9.

Yeah it might very well just be a bind issue -- in that case the check  
should simply be moved from being darwin-specific to general. Frankly I  
don't understand this stuff. I found a good deal of hits on google but  
they all just suggest defining BIND\_8\_COMPAT which doesn't help us.

How can I realiably figure out what bind version a given resolver is  
using?

Cheers,  
Christian.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:37pm UTC](https://community.zeek.org/t/compile-problems-on-mac-os-x-with-xcode-1-2-and-bind9/525/12 "2022-05-06T15:37:03Z")

</div>

Closed on May 6, 2022, 3:37pm UTC


