[Trilinos-Users] Workaround for odd bug involving /usr/include/c++/4.0.0/cstdlib:110: error: '::malloc' has not been declared on OS X.4 Mac Pro

Aron Ahmadia aja2111 at columbia.edu
Fri Nov 17 21:26:09 MST 2006

Hi Doug,

Thanks for the tip!  Fortunately this was a bug on my side, just a bit hard
to detect.

I had an improper expat lib installation (it's not installed by default in
OS X), and this was causing the malloc test to crash mysteriously, resulting
in configure deciding to replace malloc with rpl_malloc.  Later on, when
cstdlib tried to include malloc, this of course crashed because malloc was

Lesson?  I should be more careful proceeding through configuration of
scientific libraries... I will reiterate my suggestion that configure should
do a 'sanity-check' on all the configure and library options, trying to
compile them in its various ways before running its tests.  configure
blindly continuing when the malloc test failed is the absolutely the last
thing it should have done, and it deciding to replace malloc with rpl_malloc
was buried down in a configure log in triutils.


On 11/17/06, Doug Reeder < dlr at rain.org> wrote:
> Aron,
> Generally on a mac malloc.h won't get included because it is in /usr/
> include/malloc instead of /usr/include. You may have to add a -DOSX
> to the CFLAGS and add an #ifdef OSX with an #include <malloc/malloc.h>
> Doug Reeder
> On Nov 17, 2006, at 6:02 PM, Aron Ahmadia wrote:
> > Dear all,
> >
> > I've encountered a strange bug in building the Trilinos packages on
> > my machine.  I have not yet tracked down the source of the bug, I
> > am as likely to blame it on a compiler misconfiguration or a broken
> > set of system includes as the Trilinos package, which is why I have
> > not yet submitted it as a bug report.
> >
> > Regardless, the error is preventing a build of the triutils
> > package, and shows up as this:
> >
> > /usr/include/c++/4.0.0/cstdlib:110: error: '::malloc' has not been
> > declared
> >
> > The only thing in my knowledge that could cause this is if the
> > function malloc is not in global scope.  This would mean that the
> > previous definition of malloc in stdlib.h did not occur for one
> > reason or another.
> >
> > A quick workaround for this problem is to add the following
> > directive to Tri_configs.h
> >
> > #include <memory>
> >
> > Prior to
> >
> > #include <cstdlib>
> >
> > More later.
> >
> > Thanks,
> > ~A
> > _______________________________________________
> > Trilinos-Users mailing list
> > Trilinos-Users at software.sandia.gov
> > http://software.sandia.gov/mailman/listinfo/trilinos-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://software.sandia.gov/mailman/private/trilinos-users/attachments/20061117/38065680/attachment.html

More information about the Trilinos-Users mailing list