# Build Fail on OS X Lion

**URL:** <https://community.zeek.org/t/build-fail-on-os-x-lion/2118>\
**Category:** Zeek\
**Created:** [November 23, 2011, 1:00am UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118 "2011-11-23T01:00:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chuck\_L](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@Chuck\_L](https://community.zeek.org/u/Chuck_L)\
**Post date:** [November 23, 2011, 1:00am UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/1 "2011-11-23T01:00:13Z")

</div>

I'm having some difficulties building the latest Bro 2.0beta on OS X Lion.

Bro = v 2.0-beta-47  
OS = OS X 10.7.2  
Gcc = v i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)  
Cmake = 2.8.6

It fails when building netflow\_pac.cc.o . Log snippet below. I can provide the full screen output/log if necessary.

Any ideas/recommendations are welcome. 🙂

#### Log ####  
\<SNIP\>  
====================| Bro Build Summary |=====================

Install prefix: /usr/local/bro.git  
Bro Script Path: /usr/local/bro.git/share/bro  
Debug mode: false

CFLAGS: -Wall -Wno-unused -O2 -g  
CXX: /usr/bin/c++  
CXXFLAGS: -Wall -Wno-unused -O2 -g  
CPP: /usr/bin/c++

Broccoli: true  
Broctl: true  
Aux. Tools: true

GeoIP: false  
Google perftools: false

---

<div class="post-metadata">

**Author:** ![Siwek\_Jon](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Siwek\_Jon](https://community.zeek.org/u/Siwek_Jon)\
**Post date:** [November 23, 2011, 12:00pm UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/2 "2011-11-23T12:00:13Z")

</div>

> I'm having some difficulties building the latest Bro 2.0beta on OS X Lion.

What are your versions of "flex" and "bison" ?

I've built frequently on a similar setup and my versions are flex 2.5.35 and bison (GNU Bison) 2.3. Both are Apple-provided.

> It fails when building netflow\_pac.cc.o . Log snippet below. I can provide the full screen output/log if necessary.

That's a file generated by BinPAC which depends on flex and bison, maybe there's a clue in those netflow\_pac.cc and netflow\_pac.h files if you could send them.

Also, was this working from a git repository or a source distribution? If the former, the output of `git submodule` may help.

+Jon

---

<div class="post-metadata">

**Author:** ![Chuck\_L](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@Chuck\_L](https://community.zeek.org/u/Chuck_L)\
**Post date:** [November 23, 2011, 5:05pm UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/3 "2011-11-23T17:05:28Z")

</div>

Responses in-line:

> > I'm having some difficulties building the latest Bro 2.0beta on OS X Lion.
> 
> What are your versions of "flex" and "bison" ?
> 
> I've built frequently on a similar setup and my versions are flex 2.5.35 and bison (GNU Bison) 2.3. Both are Apple-provided.

I am using the apple provided flex and bison as well. Flex=v2.5.25, Bison=v2.3.

> > It fails when building netflow\_pac.cc.o . Log snippet below. I can provide the full screen output/log if necessary.
> 
> That's a file generated by BinPAC which depends on flex and bison, maybe there's a clue in those netflow\_pac.cc and netflow\_pac.h files if you could send them.

Attached.

> Also, was this working from a git repository or a source distribution? If the former, the output of `git submodule` may help.

I am working from the git repo (ver/build 2.0-beta-47)

> +Jon

Thanks again!

-Chuck

[netflow\_pac.cc](https://community.zeek.org/uploads/short-url/hkHfuyGlJD5uoEUkQ6OhWpPEomA.cc) (20.3 KB)

[netflow\_pac.h](https://community.zeek.org/uploads/short-url/fISBuGEPNyVeyfKGmMx9KG15kg1.h) (8.49 KB)

---

<div class="post-metadata">

**Author:** ![Siwek\_Jon](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Siwek\_Jon](https://community.zeek.org/u/Siwek_Jon)\
**Post date:** [November 23, 2011, 10:18pm UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/4 "2011-11-23T22:18:05Z")

</div>

> [29%] Building CXX object src/CMakeFiles/bro.dir/netflow\_pac.cc.o  
> In file included from /DG/BUILD/bro/build/src/netflow\_pac.cc:3:  
> /DG/BUILD/bro/build/src/netflow\_pac.h:13: error: expected initializer before ‘\*’ token  
> /DG/BUILD/bro/build/src/netflow\_pac.cc: In member function ‘bool binpac::NetFlow::NetFlow\_Flow::deliver\_v5\_header(binpac::uint16, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint8, binpac::uint8, binpac::uint16)’:  
> /DG/BUILD/bro/build/src/netflow\_pac.cc:158: error: ‘mgr’ was not declared in this scope  
> /DG/BUILD/bro/build/src/netflow\_pac.cc: In member function ‘bool binpac::NetFlow::NetFlow\_Flow::deliver\_v5\_record(binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint16, binpac::uint16, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint16, binpac::uint16, binpac::uint8, binpac::uint8, binpac::uint8, binpac::uint16, binpac::uint16, binpac::uint8, binpac::uint8)’:  
> /DG/BUILD/bro/build/src/netflow\_pac.cc:225: error: ‘mgr’ was not declared in this scope

So I didn't notice anything different about your netflow\_pac.cc/netflow\_pac.h from mine that seemed suspect, but now I'm thinking the errors might be legit (not sure what differs in your environment, though). What happens if you edit your src/netflow.pac to have an %extern block that looks like:

%extern{  
#include "net\_util.h"  
#include "Event.h"  
#include "Type.h"  
extern EventMgr mgr;  
extern RecordType\* conn\_id;  
%}

+Jon

---

<div class="post-metadata">

**Author:** ![Chuck\_L](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@Chuck\_L](https://community.zeek.org/u/Chuck_L)\
**Post date:** [November 23, 2011, 11:05pm UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/5 "2011-11-23T23:05:07Z")

</div>

Here's the build log snippet after adding the code you suggested:

[29%] Building CXX object src/CMakeFiles/bro.dir/netflow\_pac.cc.o  
In file included from /DG/BUILD/bro/build/src/netflow\_pac.cc:3:  
/DG/BUILD/bro/build/src/netflow\_pac.h:13: error: expected initializer before ‘\*’ token  
In file included from /DG/BUILD/bro/build/src/netflow\_pac.cc:3:  
/DG/BUILD/bro/build/src/netflow\_pac.h:19: error: ‘EventMgr’ does not name a type  
/DG/BUILD/bro/build/src/netflow\_pac.cc: In member function ‘bool binpac::NetFlow::NetFlow\_Flow::deliver\_v5\_header(binpac::uint16, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint8, binpac::uint8, binpac::uint16)’:  
/DG/BUILD/bro/build/src/netflow\_pac.cc:158: error: ‘mgr’ was not declared in this scope  
/DG/BUILD/bro/build/src/netflow\_pac.cc: In member function ‘bool binpac::NetFlow::NetFlow\_Flow::deliver\_v5\_record(binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint16, binpac::uint16, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint16, binpac::uint16, binpac::uint8, binpac::uint8, binpac::uint8, binpac::uint16, binpac::uint16, binpac::uint8, binpac::uint8)’:  
/DG/BUILD/bro/build/src/netflow\_pac.cc:225: error: ‘mgr’ was not declared in this scope  
make[3]: \*\*\* [src/CMakeFiles/bro.dir/netflow\_pac.cc.o] Error 1  
make[2]: \*\*\* [src/CMakeFiles/bro.dir/all] Error 2  
make[1]: \*\*\* [all] Error 2  
make: \*\*\* [all] Error 2

---

<div class="post-metadata">

**Author:** ![Siwek\_Jon](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Siwek\_Jon](https://community.zeek.org/u/Siwek_Jon)\
**Post date:** [November 24, 2011, 12:00am UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/6 "2011-11-24T00:00:57Z")

</div>

> Here's the build log snippet after adding the code you suggested:

The errors look even funkier now -- when you added code to net\_flow.pac, was it just the two new lines in the %extern block or did you add a whole other block? I meant the former (a single %extern block that looks like what I showed).

Also, can you send your build/CMakeCache.txt so I can check the environment?

+Jon

---

<div class="post-metadata">

**Author:** ![Chuck\_L](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@Chuck\_L](https://community.zeek.org/u/Chuck_L)\
**Post date:** [November 24, 2011, 2:31am UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/7 "2011-11-24T02:31:20Z")

</div>

My bad. I had created another Extern struct. I changed it to your recommendations. Log snippet follows:

Scanning dependencies of target bro  
[25%] Building C object src/CMakeFiles/bro.dir/version.c.o  
[26%] Building CXX object src/CMakeFiles/bro.dir/binpac-lib\_pac.cc.o  
[26%] Building CXX object src/CMakeFiles/bro.dir/binpac\_bro-lib\_pac.cc.o  
[26%] Building CXX object src/CMakeFiles/bro.dir/bittorrent\_pac.cc.o  
[26%] Building CXX object src/CMakeFiles/bro.dir/dce\_rpc\_pac.cc.o  
[27%] Building CXX object src/CMakeFiles/bro.dir/dce\_rpc\_simple\_pac.cc.o  
[27%] Building CXX object src/CMakeFiles/bro.dir/dhcp\_pac.cc.o  
[27%] Building CXX object src/CMakeFiles/bro.dir/dns\_pac.cc.o  
[27%] Building CXX object src/CMakeFiles/bro.dir/dns\_tcp\_pac.cc.o  
[27%] Building CXX object src/CMakeFiles/bro.dir/http\_pac.cc.o  
[29%] Building CXX object src/CMakeFiles/bro.dir/ncp\_pac.cc.o  
[29%] Building CXX object src/CMakeFiles/bro.dir/netflow\_pac.cc.o  
In file included from /DG/BUILD/bro/build/src/netflow\_pac.cc:3:  
/DG/BUILD/bro/build/src/netflow\_pac.h:14: error: ‘EventMgr’ does not name a type  
/DG/BUILD/bro/build/src/netflow\_pac.cc: In member function ‘bool binpac::NetFlow::NetFlow\_Flow::deliver\_v5\_header(binpac::uint16, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint8, binpac::uint8, binpac::uint16)’:  
/DG/BUILD/bro/build/src/netflow\_pac.cc:158: error: ‘mgr’ was not declared in this scope  
/DG/BUILD/bro/build/src/netflow\_pac.cc: In member function ‘bool binpac::NetFlow::NetFlow\_Flow::deliver\_v5\_record(binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint16, binpac::uint16, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint32, binpac::uint16, binpac::uint16, binpac::uint8, binpac::uint8, binpac::uint8, binpac::uint16, binpac::uint16, binpac::uint8, binpac::uint8)’:  
/DG/BUILD/bro/build/src/netflow\_pac.cc:225: error: ‘mgr’ was not declared in this scope  
make[3]: \*\*\* [src/CMakeFiles/bro.dir/netflow\_pac.cc.o] Error 1  
make[2]: \*\*\* [src/CMakeFiles/bro.dir/all] Error 2  
make[1]: \*\*\* [all] Error 2  
make: \*\*\* [all] Error 2

---

<div class="post-metadata">

**Author:** ![Siwek\_Jon](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Siwek\_Jon](https://community.zeek.org/u/Siwek_Jon)\
**Post date:** [November 24, 2011, 11:36am UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/8 "2011-11-24T11:36:10Z")

</div>

> /DG/BUILD/bro/build/src/netflow\_pac.h:14: error: ‘EventMgr’ does not name a type

Ok, I think header files are getting overshadowed somewhere (if you do `make VERBOSE=1`, you can see the order of -I options given to the compiler and look in those directories for Event.h, Type.h, etc.). I'd like to try another change; at the top of src/CMakeLists.txt there's:

include\_directories(\{CMAKE\_CURRENT\_SOURCE\_DIR\} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{CMAKE\_CURRENT\_BINARY\_DIR}  
)

Change it to be the following ("BEFORE" is the only difference):

include\_directories(BEFORE  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{CMAKE\_CURRENT\_SOURCE\_DIR\} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{CMAKE\_CURRENT\_BINARY\_DIR}  
)

+Jon

---

<div class="post-metadata">

**Author:** ![Chuck\_L](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@Chuck\_L](https://community.zeek.org/u/Chuck_L)\
**Post date:** [November 24, 2011, 8:11pm UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/9 "2011-11-24T20:11:59Z")

</div>

That change (BEFORE in src/CMakeLists.txt) did the trick. The build completed successfully.

To be sure, I made a fresh clone of the bro git repo, tried to build without changing src/CMakeLists.txt, and the build failed. Then I made the change to src/CMakeLists.txt, and the build succeeded. No mod to netflow.pac in either build attempt.

I still wonder what is out of the ordinary on my system. I'll check into it further when I get the chance.

Thanks for your help Jon!

---

<div class="post-metadata">

**Author:** ![Siwek\_Jon](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Siwek\_Jon](https://community.zeek.org/u/Siwek_Jon)\
**Post date:** [November 24, 2011, 10:40pm UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/10 "2011-11-24T22:40:37Z")

</div>

> To be sure, I made a fresh clone of the bro git repo, tried to build without changing src/CMakeLists.txt, and the build failed. Then I made the change to src/CMakeLists.txt, and the build succeeded. No mod to netflow.pac in either build attempt.

Thanks for confirming that. I'm going to get that change into the git repo since that's a "righter" way to order the include directories anyway.

> I still wonder what is out of the ordinary on my system. I'll check into it further when I get the chance.

I'm guessing you had built/installed some software locally (/usr/local, /opt/local, or /sw) that provided headers of the same name as what Bro needed (Event.h, Type.h) and so the compiler picked up those. Not that it's "wrong", just different.

+Jon

---

<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:40pm UTC](https://community.zeek.org/t/build-fail-on-os-x-lion/2118/11 "2022-05-06T15:40:00Z")

</div>


