Ethereal-dev: Re: [Ethereal-dev] assert() in DOCSIS plugin causes __eprintf undefined symbol
On Fri, Jul 04, 2003 at 11:33:00AM -0700, Michael Lum wrote:
> I am building 0.9.13 on Sparc/Solaris 2.8.
> Using gcc.
>
> The file packet-vendor.c has an assert() that
> causes a runtime load problem. The symbol __eprintf
> is not found. I understand that the missing symbol
> problem occurs when some objects are built with cc and
> some with gcc.
Yes, and that's probably what you're seeing - on my Solaris 7 partition,
at least Sun's <assert.h> makes the "assert()" macro call "_assert()",
whilst the GCC header file refers to "__eprintf" or something such as
that, noting that it appears in libgcc.a.
It may be that the plugin is somehow not being linked against libgcc.a,
or this might be some issue of a shared vs. static libgcc.
> What's the difference between g_assert() and assert()?
"assert()" is the ANSI C assertion macro, which, for whatever reason,
differs between the header supplied with Solaris and the header that GCC
uses; they call different routines.
"g_assert()" is the GLib version; it calls "g_log()".
Why those differences exist, and in what way those differences are
interesting, is another matter; I have not bothered to look into that.
In any case, the problem could probably be solved either by
1) using "g_assert()", as we do elsewhere in Ethereal, rather
than "assert()"
or
2) just getting rid of the "assert()" and relying on null
pointer dereferences causing crashes (which they do on most,
if not all, of the platforms on which Ethereal runs).