Problems Building Bro

I can't build Bro on my Linux box.

[dom@tility bro-1.1]$ uname -a
Linux tility.canterburysoftware.com 2.4.22-10mdk #1 Thu Sep 18 12:30:58 CEST 2003 i686 unknown unknown GNU/Linux

Trying to build bro-1.1 I get this:

checking for library containing inet_aton... none required
checking for tgetnum in -ltermcap... no
checking for termcap in /usr/lib{64}/termcap/... no
configure: error: libtermcap not found in default paths nor /usr/lib{64}/termcap.

Trying to build bro-0.9a11 I get this

checking for long long... yes
checking size of long long... configure: error: cannot compute sizeof (long long), 77

I get different problems on my NetBSD box.

heisenberg: {14} uname -a
NetBSD heisenberg 3.0 NetBSD 3.0 (GENERIC) #0: Mon Dec 19 01:04:02 UTC 2005 builds@works.netbsd.org:/home/builds/ab/netbsd-3-0-RELEASE/i386/200512182024Z-obj/home/builds/ab/netbsd-3-0-RELEASE/src/sys/arch/i386/compile/GENERIC i386

source='bro_sem_sysv.c' object='bro_sem_sysv.lo' libtool=yes depfile='.deps/bro_sem_sysv.Plo' tmpdepfile='.deps/bro_sem_sysv.TPlo' depmode=gcc3 /bin/sh ../depcomp /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -W -Wall -Wno-unused -I../compat -g -O2 -c -o bro_sem_sysv.lo `test -f bro_sem_sysv.c || echo './'`bro_sem_sysv.c
rm -f .libs/bro_sem_sysv.lo
gcc -DHAVE_CONFIG_H -I. -I. -I.. -W -Wall -Wno-unused -I../compat -g -O2 -c bro_sem_sysv.c -MT bro_sem_sysv.lo -MD -MP -MF .deps/bro_sem_sysv.TPlo -fPIC -DPIC -o .libs/bro_sem_sysv.lo
bro_sem_sysv.c: In function `__bro_sem_init':
bro_sem_sysv.c:77: error: storage size of `arg' isn't known
*** Error code 1

Dominic.

Hi Dominic,

I can't build Bro on my Linux box.

[dom@tility bro-1.1]$ uname -a
Linux tility.canterburysoftware.com 2.4.22-10mdk #1 Thu Sep 18 12:30:58
CEST 2003 i686 unknown unknown GNU/Linux

Trying to build bro-1.1 I get this:

checking for library containing inet_aton... none required
checking for tgetnum in -ltermcap... no
checking for termcap in /usr/lib{64}/termcap/... no
configure: error: libtermcap not found in default paths nor
/usr/lib{64}/termcap.

well, do you have it installed, and if so, where? We're currently
checking for just -ltermcap and then specifically add /usr/lib/termcap
and /usr/lib64/termcap, if appropriate.

I'm getting annoyed with this termcap stuff. Its location is apparently
quite diverse, so it'd be nice if they either provided an m4 macro to
the autoconf guys, or at least shipped a termcap-config or the
pkg-config equivalent. If anyone on this list has pointers to reliable
termcap configure checks, please point them out.

Trying to build bro-0.9a11 I get this

checking for long long... yes
checking size of long long... configure: error: cannot compute sizeof
(long long), 77

That's odd, it means that AC_CHECK_SIZEOF(long long) fails. I can't make
an immediate suggestion for fixing this.

I get different problems on my NetBSD box.

Configure with --disable-broccoli for now. If you need Broccoli, go to
aux/broccoli after the Bro build and configure and build it separately.
Try --disable-posix-semaphores. If that doesn't help, feel free to email
me. I'll throw out all of the semaphores stuff once I have time for
Broccoli again, because it doesn't help instrumentation in enough
situations to warrant the build headaches it's been causing.

Cheers,
Christian.

Don't mind this one. This is most probably due to linking with
"-ltermcap" when doing the long-long test. So once the termcap issue
is solved, this should disappear too.

Robin

Ah right! In the older version the termcap check didn't abort on error.

Cheers,
Christian.

Christian Kreibich wrote:

Hi Dominic,

  
Trying to build bro-0.9a11 I get this

checking for long long... yes
checking size of long long... configure: error: cannot compute sizeof 
(long long), 77
    

That's odd, it means that AC_CHECK_SIZEOF(long long) fails. I can't make
an immediate suggestion for fixing this.

I think this is just the termcap problem again, I’d have to see the config.log to be sure, but
this is usually just a failure in linking. The configure was tightened up in 1.1 to point to the
termcap problem (and not give this misleading error)

Cheers,
jason

Christian Kreibich wrote:

Hi Dominic,

I can't build Bro on my Linux box.

[dom@tility bro-1.1]$ uname -a
Linux tility.canterburysoftware.com 2.4.22-10mdk #1 Thu Sep 18 12:30:58 CEST 2003 i686 unknown unknown GNU/Linux

Trying to build bro-1.1 I get this:

checking for library containing inet_aton... none required
checking for tgetnum in -ltermcap... no
checking for termcap in /usr/lib{64}/termcap/... no
configure: error: libtermcap not found in default paths nor /usr/lib{64}/termcap.

well, do you have it installed, and if so, where? We're currently
checking for just -ltermcap and then specifically add /usr/lib/termcap
and /usr/lib64/termcap, if appropriate.

Christian,

Thanks for your reply. I thought I had it installed:

[dom@tility dom]$ rpm -qil libtermcap2-2.0.8-35mdk
Name : libtermcap2 Relocations: (not relocateable)
Version : 2.0.8 Vendor: MandrakeSoft
Release : 35mdk Build Date: Mon 04 Aug 2003 08:35:44 BST
Install Date: Sat 03 Jul 2004 18:28:51 BST Build Host: hp6.mandrakesoft.com
Group : System/Libraries Source RPM: libtermcap-2.0.8-35mdk.src.rpm
Size : 19266 License: LGPL
Signature : DSA/SHA1, Mon 04 Aug 2003 09:00:17 BST, Key ID e7898ae070771ff3
Packager : Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
URL : ftp://metalab.unc.edu/pub/Linux/GCC/
Summary : Development tools for programs which will access the termcap database
Description :
The libtermcap package contains a basic system library needed to access
the termcap database. The termcap library supports easy access to the
termcap database, so that programs can output character-based displays in
a terminal-independent manner.
/lib/libtermcap.so.2
/lib/libtermcap.so.2.0.8
/usr/share/doc/libtermcap2-2.0.8
/usr/share/doc/libtermcap2-2.0.8/ChangeLog
/usr/share/doc/libtermcap2-2.0.8/README

I tried:

ln -s libtermcap.so.2 libtermcap
ln -s /lib/libtermcap.so.2 libtermcap

but to no avail.

I'm getting annoyed with this termcap stuff. Its location is apparently
quite diverse, so it'd be nice if they either provided an m4 macro to
the autoconf guys, or at least shipped a termcap-config or the
pkg-config equivalent. If anyone on this list has pointers to reliable
termcap configure checks, please point them out.

Trying to build bro-0.9a11 I get this

checking for long long... yes
checking size of long long... configure: error: cannot compute sizeof (long long), 77

That's odd, it means that AC_CHECK_SIZEOF(long long) fails. I can't make
an immediate suggestion for fixing this.

I get different problems on my NetBSD box.

Configure with --disable-broccoli for now. If you need Broccoli, go to
aux/broccoli after the Bro build and configure and build it separately.
Try --disable-posix-semaphores. If that doesn't help, feel free to email
me. I'll throw out all of the semaphores stuff once I have time for
Broccoli again, because it doesn't help instrumentation in enough
situations to warrant the build headaches it's been causing.

I did try that but ran into a different problem:

heisenberg: {34} ./configure --disable-broccoli
checking build system type... i386-unknown-netbsdelf3.0
checking host system type... i386-unknown-netbsdelf3.0
checking target system type... i386-unknown-netbsdelf3.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets ${MAKE}... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking dependency style of gcc... gcc3
checking for flex... flex
checking for flex... (cached) flex
checking for yywrap in -lfl... yes
checking lex output file root... lex.yy
checking whether yytext is a pointer... yes
checking for bison... no
checking for byacc... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets ${MAKE}... (cached) yes
checking for gzip... gzip
configure: error: unknown enable option: broccoli

Thanks, Dominic.

heisenberg: {34} ./configure --disable-broccoli
configure: error: unknown enable option: broccoli

This seems to be caused by a missing "broccoli" in:

AC_LBL_ENABLE_CHECK(brov6 int64 activemapping expire-dfa-states debug select-loop openssl shippedpcap mpatrol perl gtk-doc)

Please to try adding it and see if it fixes the problem.

Ruoming

Hi Dominic -- do you have the devel RPM installed? The libtermcap.so is
likely the crucial bit, as will be the header:

christian@strangepork:/usr/lib > rpm -ql libtermcap-devel
/usr/include/termcap.h
/usr/lib/libtermcap.a
/usr/lib/libtermcap.so
/usr/share/info/termcap.info.gz

Regarding the other issue, please du as Jason + Vern suggest.

Cheers,
Christian.

Debian (for example), doesn't ship a termcap. Their equivalent is ncurses.

Termcap is required by libedit, but I don't see any place in the build
process that actually uses libedit. I've compiled (but not yet actually
run) the tree without libedit (or libtermcap) successfully. Am I missing
something?

(working from bro-1.1 sources)

Christian Kreibich wrote:

Now configure completes without error but I get the following error when I try
to make. Any suggestions?

Thanks, Dominic.

g++ -g -O2 -o bro dce_rpc_pac.o ncp_pac.o smb_pac.o main.o net_util.o
util.o parse.o scan.o re-parse.o re-scan.o rule-parse.o rule-scan.o Active.o
Anon.o ARP.o Attr.o BackDoor.o Base64.o BPF_Program.o BroString.o CCL.o
ChunkedIO.o CompHash.o Conn.o ConnCompressor.o DCE_RPC.o DFA.o DNS.o
DNS_Mgr.o DbgBreakpoint.o DbgHelp.o DbgWatch.o Debug.o DebugCmds.o
DebugLogger.o Desc.o Dict.o Discard.o EquivClass.o Event.o EventHandler.o
EventRegistry.o Expr.o FTP.o File.o Finger.o Frag.o Frame.o Func.o Gnutella.o
HTTP.o Hash.o ICMP.o ID.o Ident.o IntSet.o InterConn.o IOSource.o IRC.o
List.o Logger.o Login.o MIME.o NCP.o NFA.o NFS.o NTP.o NVT.o Net.o NetVar.o
NetbiosSSN.o Obj.o OSFinger.o PacketFilter.o PacketSort.o
PersistenceSerializer.o PktDagSrc.o PktSrc.o PolicyFile.o POP3.o Portmap.o
PrefixTable.o PriorityQueue.o Queue.o RE.o RPC.o Reassem.o RemoteSerializer.o
Rlogin.o RSH.o Rule.o RuleAction.o RuleCondition.o RuleMatcher.o
ScriptAnaly.o SmithWaterman.o SMB.o SMTP.o SSH.o Scope.o
SerializationFormat.o SerialObj.o Serializer.o Sessions.o StateAccess.o
Stats.o SteppingStone.o Stmt.o TCP.o TCP_Contents.o TCP_Endpoint.o
TCP_Rewriter.o Telnet.o Timer.o Traverse.o Trigger.o TwoWise.o Type.o UDP.o
Val.o Var.o XDR.o bsd-getopt-long.o cq.o md5.o patricia.o setsignal.o
version.o strsep.o X509.o SSLCiphers.o SSLInterpreter.o SSLProxy.o SSLv2.o
SSLv3.o SSLv3Automaton.o -Llibedit -ledit -lpcap -lpcap
-L/home/dom/Desktop/libpcap-0.9.4 -lpcap -lssl -lcrypto -ltermcap -lm
DNS_Mgr.o(.text+0x2e61): In function `DNS_Mgr::GetFds(int*, int*, int*)':
/home/dom/Desktop/bro-1.1/src/DNS_Mgr.cc:933: undefined reference to
`nb_dns_fd'
DNS_Mgr.o(.text+0x2ec7): In function `DNS_Mgr::AnswerAvailable(int)':
/home/dom/Desktop/bro-1.1/src/DNS_Mgr.cc:1007: undefined reference to
`nb_dns_fd'
collect2: ld returned 1 exit status
make[4]: *** [bro] Error 1
make[4]: Leaving directory `/home/dom/Desktop/bro-1.1/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/dom/Desktop/bro-1.1/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/dom/Desktop/bro-1.1/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dom/Desktop/bro-1.1'
make: *** [all] Error 2

No worries, glad it gets a little further now. :slight_smile: Your case suggests
though that we should be testing for the header file first, because that
would make it more immediately clear that it's the devel setup that's
lacking.

Cheers,
Christian.

Could you please post the full configure run output?

Cheers,
Christian.

I've resent this as a reply without the attachment otherwise the mailing list
blocks it as being too big. If anyone wants a copy of the various config
files, please let me know. Dominic.

> > > Now configure completes without error but I get the following error
> > > when I try to make. Any suggestions?
> >
> > Could you please post the full configure run output?
> >
> > Cheers,
> > Christian.
>
> Christian,
>
> I'm not sure which outputs you want. Is it just configure.log (which I've
> attached) or do you need other things as well?
>
> I've dug around a bit and I think I've got as far as seeing that in
> src/Makefile, dns_srcs is null.
>
> # this is better
> #dns_srcs = nb_dns.c
>
> So this means no nb_dns.o gets built resulting in the error message. I'm
> not clear what creates src/Makefile. I also see that
>
> NBDNS =
>
> Presumably this means that NBDNS is undefined so that nb_dns.c should be
> built.
>
> I'll try building compiling nb_dns.c by hand and then see if make will
> complete.

nd_dns.c compiled ok but the final link still fails but with different errors.
Given that it compiles ok but doesn't link, I'm guessing it's looking for a
library somewhere. I'll see if I can figure out which library and then point
it in the right direction.

nb_dns.o(.text+0x2e0): In function `_nb_dns_mkquery':
/home/dom/Desktop/bro-1.1/src/nb_dns.c:293: undefined reference to
`__res_mkquery'
nb_dns.o(.text+0x5f1): In function `nb_dns_activity':
/home/dom/Desktop/bro-1.1/src/nb_dns.c:476: undefined reference to
`__ns_initparse'
nb_dns.o(.text+0x67c):/home/dom/Desktop/bro-1.1/src/nb_dns.c:519: undefined
reference to `_ns_flagdata'
nb_dns.o(.text+0x684):/home/dom/Desktop/bro-1.1/src/nb_dns.c:519: undefined
reference to `_ns_flagdata'
nb_dns.o(.text+0x866):/home/dom/Desktop/bro-1.1/src/nb_dns.c:561: undefined
reference to `__ns_parserr'
nb_dns.o(.text+0x959):/home/dom/Desktop/bro-1.1/src/nb_dns.c:610: undefined
reference to `__dn_expand'

Hi Dominic,

Christian,

I'm not sure which outputs you want. Is it just configure.log (which I've
attached) or do you need other things as well?

I actually only meant what you get to see at the console, but the .log
is even better. Thanks. This is what I was after:

configure:7934: checking for ns_msg
configure:7981: result: yes
configure:8007: checking for ns_inittab/res_mkquery with resolver 'none'
configure:8128: result: no
configure:8007: checking for ns_inittab/res_mkquery with resolver '-lresolv'
configure:8128: result: no
configure:8007: checking for ns_inittab/res_mkquery with resolver '/usr/lib/libresolv.a'
configure:8128: result: no
configure:8134: Nonblocking DNS disabled.

Given this, you should not have seen the link error. I think the problem
is that DNS_Mgr.cc's DNS_Mgr::AnswerAvailable() isn't correctly
protected by #ifdef HAVE_NB_DNS. The attached diff might fix it but is
untested.

I've dug around a bit and I think I've got as far as seeing that in
src/Makefile, dns_srcs is null.

Yes, this is in line with the above, since configure has determined that
it can't build with nbdns support.

Cheers,
Christian.

nbdns.diff (907 Bytes)

Adding -lresolv gets rid of one of the unresolved references (res_mkquery)
but I'm still left with the others. They are all defined in <arpa/nameser.h>
but it's not clear which library needs to be linked in.

Dominic.

nb_dns.o(.text+0x5f1): In function `nb_dns_activity':
/home/dom/Desktop/bro-1.1/src/nb_dns.c:476: undefined reference to
`__ns_initparse'
nb_dns.o(.text+0x67c):/home/dom/Desktop/bro-1.1/src/nb_dns.c:519: undefined
reference to `_ns_flagdata'
nb_dns.o(.text+0x684):/home/dom/Desktop/bro-1.1/src/nb_dns.c:519: undefined
reference to `_ns_flagdata'
nb_dns.o(.text+0x866):/home/dom/Desktop/bro-1.1/src/nb_dns.c:561: undefined
reference to `__ns_parserr'

Christian,

That's improved things but I'm still getting one unresolved reference.

Dominic.

DNS_Mgr.o(.text+0x2e61): In function `DNS_Mgr::GetFds(int*, int*, int*)':
/home/dom/Desktop/bro-1.1/src/DNS_Mgr.cc:933: undefined reference to
`nb_dns_fd'
collect2: ld returned 1 exit status

I don't have more time to look into this, but I'm sure someone else
will.

I'm much more interested to find out how nbdns can be made to work on
your system, so if you could find out whether there's really no resolver
library that defines ns_inittab/res_mkquery, that'd help...

Cheers,
Christian.

> Christian,
>
> That's improved things but I'm still getting one unresolved reference.
>
> Dominic.
>
> DNS_Mgr.o(.text+0x2e61): In function `DNS_Mgr::GetFds(int*, int*, int*)':
> /home/dom/Desktop/bro-1.1/src/DNS_Mgr.cc:933: undefined reference to
> `nb_dns_fd'
> collect2: ld returned 1 exit status

I don't have more time to look into this, but I'm sure someone else
will.

I hope so :frowning:

I'm much more interested to find out how nbdns can be made to work on
your system, so if you could find out whether there's really no resolver
library that defines ns_inittab/res_mkquery, that'd help...

My resolver library (-lresolv) contains the strings mkquery and ns_initparse

[dom@tility lib]$ strings /lib/libresolv.so.2 | grep mkquery
__res_mkquery
__res_nmkquery

[dom@tility lib]$ strings /lib/libresolv.so.2 | grep parse
;; ns_initparse: %s
;; ns_parserr: %s

However, configure fails to find ns_initparse despite having -lresolv on the
compile command. Indeed, trying it standalone confirms this.

[dom@tility bind-9.3.2]$ cat test.c
#include <arpa/nameser.h>

int
main ()
{
  ns_initparse(0,0,0);
  ;
  return 0;
}
[dom@tility bind-9.3.2]$ gcc -o test test.c -lresolv
/home/dom/tmp/ccm4khEq.o(.text+0x1a): In function `main':
: undefined reference to `__ns_initparse'
collect2: ld returned 1 exit status

Googling didn't turn up an obvious place to get a resolver library that
contains ns_initparse so I'm a bit stumped.

Dominic.

configure:8007: checking for ns_inittab/res_mkquery with resolver '-lresolv'
configure:8045: gcc -o conftest -g -O2 -I/include -I/usr/include
-I/home/dom/Desktop/libpcap-0.9.4 -I${top_s
rcdir}/linux-include conftest.c -lpcap -lpcap
-L/home/dom/Desktop/libpcap-0.9.4 -lpcap -lssl -lcrypto -lreso
lv >&5
/home/dom/tmp/ccgYny2w.o(.text+0x10): In function `main':
/home/dom/Desktop/bro-1.1/configure:8037: undefined reference to
`__ns_initparse'
collect2: ld returned 1 exit status
configure:8048: $? = 1
configure: failed program was:
#line 8026 "configure"
#include "confdefs.h"
#include <arpa/nameser.h>
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
     extern "C"
# endif
   int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
ns_initparse(0,0,0);
  ;
  return 0;
}

Dominic.