Build failure: undeclared identifier 'g_malloc0_n'
Submitted by Daniel Macks
Assigned to poppler-bugs
Description
Building poppler-0.26.2 on OS X 10.8 fails in the glib subdir:
CXX poppler-annot.lo poppler-annot.cc:274:62: error: use of undeclared identifier 'g_malloc0_n'; did you mean 'gmallocn'? quads_array = (AnnotQuadrilaterals::AnnotQuadrilateral **) g_malloc0_n ( ^~~~~~~~~~~ gmallocn ../goo/gmem.h:57:14: note: 'gmallocn' declared here extern void *gmallocn(int nObjs, int objSize); ^ 1 error generated. make[2]: *** [poppler-annot.lo] Error 1
I have glib-2.22.4, but g_malloc0_n() was only added as of 2.24. Either configure needs to check for this newer version (it currently has GLIB_REQUIRED=2.18) or poppler-annot.cc needs to switch (or have a way to fall back) to using a less modern function. By documentation, it sounds like gmem.h does have some viable replacements, gmallocn() or maybe gmallocn_checkoverflow()