[AGENT++] Re: Getting agent++ to build under Mac OS X
Xochitl Lunde
Xochitl_Lunde at tripplite.com
Fri Feb 6 18:25:38 CET 2009
> The config_snmp_pp.h assumes that if a gcc is used, the _r functions are
> available. You can change this in the header. You will then get warnings
> if you compile snmp++ with threads enabled: Although snmp++ uses a mutex
> around the gethostbyname() and gethostbyaddr() functions, if the
> application uses its own threads and uses these functions at the same
> time, a crash can occur. Luckily these functions are only used in the
> Address classes and not called by snmp++ itself. Only if the application
> passes host names or requests to get a host name from IP, the address
> class uses these functions.
>
> > The strangest error I get (I'll let you know if this is fixed by your
new
> > snapshot) is when building agent++:
> >
> > ld: duplicate symbol Agentpp::Array<Agentpp::Thread>::size() constin
> > threads_sh.o and mib_sh.o
>
> You're not alone: :-(
> http://lists.apple.com/archives/xcode-users/2008/jan/msg00554.html
> Some other search results state that is has something to do with inline,
> but I will have to read some more, to find a solution.
>
An update on this. I started over with a fresh download this morning using
the modified snapshots of snmp++ and agent++.
1. I am building snmp++ and agent++ with _NO_THREADS defined. I have
undefined HAVE_GETHOSTBYADDR_R and HAVE_GETHOSTBYNAME_R. I think there
might be some hope here, as now I think the error message has changed to
'Agentpp::OidList<Agentpp::MibGroup>size() constin threads_sh.o and
mib_sh.o'. (Unless I earlier copied the wrong error message from XCode
instead of the terminal.)
2. AgentX++ will not build when _NO_THREADS is defined.
#error AGENTPP_USE_THREAD_POOL must be defined in agent++.h of AGENT++ >=
v3.5c
#error "To use AgentX++ threads must be enabled in AGENT++".
3. It might be a shot in the dark, but I can't help but wonder if Mac OS
two-level namespace could be making an issue?
http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_7.html
"For example, suppose one library, call it libfoo, uses another library,
libbar, for its implementation of the function barIt. Now suppose an
application wants to override the use of libbar with a compressed version,
called libzbar. Since libfoo was linked against libbar at compile time,
this is not possible without recompiling libfoo."
I tried to add the -flat_namespace to the makefile, but I am not very sure
that it is really being added because I haven't seen it show as terminal
output. I tried undefining the namespaces in Agent++, but that just
removes the prefixing 'Agentpp::' from the error message.
I tried changing to a different compiler version (gcc4.4) and creating my
own autogen.sh/configure.ac/makefile.am files for the libraries.
Being more familiar with the Agent++ and related libraries than I, would
there be reason to think that the two-level namespace environment could be
a problem for Agent++ on Mac OS?
Xochitl
More information about the AGENTPP
mailing list