building on FreeBSD 4.8
through all the missing headers i managed to build all the necessary objects (.o) in src, but final linking fails horribly ;)
first of all, we configure
./configure --prefix=/usr/local/netmrg \
'LDFLAGS=-L/usr/local/lib -L/usr/local/lib/mysql' \
'CPPFLAGS=-I/usr/local/include/mysql -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include/ucd-snmp -I/ftp/build/snmp/ucd-snmp-4.2.2/snmplib'
the we make....we proceed successfully up until linking.
g++ -g -O2 -L/usr/local/lib -L/usr/local/lib/mysql -L/usr/lib/mysql -L/usr/lib -L/usr/local/lib -o netmrg-gatherer db.o devices.o events.o locks.o mappings.o monitors.o netmrg.o rrd.o settings.o snmp.o utils.o -lsnmp -lcrypto -lxml2 -lmysqlclient -lstdc++ -lz -pthread
this one spits out 174 lines of complaints.
one example line of output
db.o In function `db_query(st_mysql *, DeviceInfo *, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >)'
/ftp/build/netmrg-0.10pre1/src/db.cpp190 undefined reference to `debuglogger(int, int, DeviceInfo const *, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &)'
there are also undefined references to
strtoint(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >)
U_to_NULL(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > &)
please notice that utils.cpp was successfully compiled and utils.o exists.
i suspect that it might be that i've got g++ v 2.95.4
however, building newer gcc is undesirable. or is it absolutely necessary in this case?
marvin# nm -C utils.o | grep debuglogger
00000db0 T debuglogger(int, int, DeviceInfo const *, basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> > const &)
note the <false, 0>
as i was able to find out, this boolean variable passed to allocator controls thread-safety. the question, however, is how to make g++ build utils.cpp with thread support?
I just wanted to let you know that we are watching your thread and following along; the work you're doing on it is going to be a great help to us getting this working on FreeBSD.
We (Brady and I) have just gotten FreeBSD and Solaris installed on some development boxes so we can work on this more, so hopefully we can get to working on this more Real Soon (tm).
Thanks again for your hard work; we'll be sure to try to get this working as soon as possible. If you do end up to get it working, feel free to send a patch to either Brady or I.
finally i've got it up and running ;))
yep, successful build DOES require new version of gcc.
no matter how hard i tried, i failed to get it up with 2.95.4
so i downloaded and compiled gcc 3.2.2 as follows
./configure --prefix=/usr/local/gcc3 --enable-languages=c,c++,f77
excluded java to speed things up.
then make install'ed and here i got /usr/local/gcc3
2 symlinks need to be made
/usr/lib/libstdc++.so.5 -> /usr/local/gcc3/lib/libstdc++.so.5
/usr/lib/libgcc_s.so.1 -> /usr/local/gcc3/lib/libgcc_s.so.1
libstdc++.so and libgcc_s.so need not to be redirected and still point to old libraries.
okay, so far so good.
there's one more point. for successful compile of libnetsnmp, -ldes needs to be added as it contains some des functions that netsnmp needs (beside -lcrypto).
the final configure command i issued that "made it" was as follows
./configure --prefix=/usr/local/netmrg \
'LDFLAGS=-L/usr/local/gcc3/lib -L/usr/local/lib -L/usr/local/lib/mysql -ldes' \
'CPPFLAGS=-I/usr/local/gcc3/include -I/usr/local/include/mysql -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include/ucd-snmp' \
-L/usr/local/gcc3/lib should be the first in the list of library directories.
after that make goes like a charm as does make install ;))
right now i'm in the middle of editing httpd.conf to try to bring the thing up.
I'd like to thank you for doing all the investigation necessary to make compilation possible on FreeBSD. I've just set up a FreeBSD system and achieved success with your steps.
The next version (pre2 likely) will have better configure detection for the FreeBSD paths, but the requirement of gcc 3.x likely won't be going away.