After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 397167 - build failure: error: expected initializer before '&' token
build failure: error: expected initializer before '&' token
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: build
unspecified
Other Linux
: Normal critical
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2007-01-16 08:20 UTC by Craig Keogh
Modified: 2007-01-26 20:49 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18



Description Craig Keogh 2007-01-16 08:20:53 UTC
gcc version 4.1.2 20070106 (prerelease) (Ubuntu 4.1.1-21ubuntu7)
--------------------------------


make  
make  all-recursive
make[1]: Entering directory `/home/oxyde/cvs/gnome2/glibmm'
Making all in tools
make[2]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/tools'
Making all in m4
make[3]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/tools/m4'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/tools/m4'
Making all in pm
make[3]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/tools/pm'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/tools/pm'
Making all in extra_defs_gen
make[3]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/tools/extra_defs_gen'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/tools/extra_defs_gen'
make[3]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/tools'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/tools'
make[2]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/tools'
Making all in glib
make[2]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/glib'
make  all-recursive
make[3]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/glib'
Making all in src
make[4]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/glib/src'
make[4]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/glib/src'
Making all in glibmm
make[4]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/glib/glibmm'
Making all in private
make[5]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/glib/glibmm/private'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/glib/glibmm/private'
make[5]: Entering directory `/home/oxyde/cvs/gnome2/glibmm/glib/glibmm'
if /bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"glibmm\"  -I../../glib -I../../glib -I/opt/gnome2/include/sigc++-2.0 -I/opt/gnome2/lib64/sigc++-2.0/include -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib64/glib-2.0/include -pthread -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib64/glib-2.0/include  -I/opt/gnome2/include/gnome-vfs-2.0/  -g -O0 -Wall -Wno-long-long -MT fileutils.lo -MD -MP -MF ".deps/fileutils.Tpo" -c -o fileutils.lo fileutils.cc; \
	then mv -f ".deps/fileutils.Tpo" ".deps/fileutils.Plo"; else rm -f ".deps/fileutils.Tpo"; exit 1; fi
 g++ -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"glibmm\" -I../../glib -I../../glib -I/opt/gnome2/include/sigc++-2.0 -I/opt/gnome2/lib64/sigc++-2.0/include -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib64/glib-2.0/include -pthread -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib64/glib-2.0/include -I/opt/gnome2/include/gnome-vfs-2.0/ -g -O0 -Wall -Wno-long-long -MT fileutils.lo -MD -MP -MF .deps/fileutils.Tpo -c fileutils.cc  -fPIC -DPIC -o .libs/fileutils.o
make[5]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/glib/glibmm'
make[4]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/glib/glibmm'
make[3]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/glib'
make[2]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm/glib'
make[1]: Leaving directory `/home/oxyde/cvs/gnome2/glibmm'
../../glib/glibmm/fileutils.h:437: error: expected initializer before '&' token
fileutils.cc:136: error: expected initializer before '&' token
make[5]: *** [fileutils.lo] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Comment 1 Murray Cumming 2007-01-17 19:12:31 UTC
"../../glib/glibmm/fileutils.h:437: error: expected initializer before '&' token" is this:

int mkstemp(std::string& filename_template);

and "fileutils.cc:136: error: expected initializer before '&' token" is this:

int mkstemp(std::string& filename_template)

So, I guess that maybe mkstemp is #defined as something. Could you check that by trying to rename that function, please?

However, I wonder why I don't have this problem. I'm using Ubuntu Edgy with this g++ version:
murrayc@ubuntumurrayc:~/svn/gnome218/glibmm$ g++ --version
g++ (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)


I guess you are using Ubuntu Feisty. Is that correct?
Comment 2 Daniel Elstner 2007-01-17 20:10:30 UTC
It should be safe to simply #undef mkstemp if necessary.  If I remember correctly, the C standard allows most of the library functions to be actually macros, but also requires that they still work if #undef'ined.  Well, at least I hope that this applies to mkstemp, too.
Comment 3 Craig Keogh 2007-01-18 11:23:12 UTC
- fileutils.h ------------------------------------------------------------------

/** Opens a temporary file.
 * @ingroup FileUtils
 * See the %mkstemp() documentation on most UNIX-like systems. This is a
 * portability wrapper, which simply calls %mkstemp() on systems that have
 * it, and implements it in GLib otherwise.
 * @param filename_template A string that should match the rules for
 *   %mkstemp(), i.e. end in <tt>"XXXXXX"</tt>. The <tt>X</tt> string
 *   will be modified to form the name of a file that didn't exist.
 * @return A file handle (as from open()) to the file opened for reading
 *   and writing. The file is opened in binary mode on platforms where there
 *   is a difference. The file handle should be closed with close(). In
 *   case of errors, <tt>-1</tt> is returned.
 */
int std::string& filename_templateNUN4pa;

-- fileutils.cc ----------------------------------------------------------------

int std::string& filename_templatenjCT11

--------------------------------------------------------------------------------

two return values, and no (), and jumbled function names.

I see the files are generated by gtkmmproc, so my gtkmmproc must be bugged. But I don't seem to have the program gtkmmproc on my computer.

Yes Murray, Ubuntu Feisty.
Comment 4 Murray Cumming 2007-01-22 15:21:00 UTC
Craig, I'm not sure what you are trying to tell us with that first chunk of (strange) code.

gtkmmproc is now called gmmproc, but you should never need to execute it directly. Just changing the .hg and .ccg files and running make again should regenerate the files. You might need to run autogen.sh.

Daniel wrote:
> It should be safe to simply #undef mkstemp if necessary

I'd rather not do that in a public header. I think we'll need to check for it in configure to #ifdef it out when necessary. And we'll have to add an alternative method.
Comment 5 Craig Keogh 2007-01-23 09:53:34 UTC
Sorry. The code is what gmmproc generated on my computer. The code is obviously wrong. gmmproc must have a bug that causes it to generate this bad code.
Comment 6 Dodji Seketeli 2007-01-25 22:34:30 UTC
Okay, I reproduced the problem on debian unstable, and thanks to Daniel Elstner, I have commited a fix in changeset #371 to svn trunk.

The problem is that m4 version 1.4.8 (the one in debian-unstable, maybe the same as in ubuntu Feisty) recognize mkstemp as a builtin macro. That is why the declaration int mkstemp(std::string& filename_template) gets expanded into int std::string& filename_templateNUN4pa;


So the fix was just to prefix the mkstemp macro by m4_ using the _PREFIX_BUILTIN macro, in tools/m4/base.m4.

I hope this does not break glibmm on pre 1.4.8 versions of m4.

Comment 7 Daniel Elstner 2007-01-25 22:52:39 UTC
Don't worry, it most surely won't.  Could you please apply the fix to the previous branches, too?  Hmm, let's say to 2.8 and 2.10.  Thanks heaps.
Comment 8 Dodji Seketeli 2007-01-25 23:01:59 UTC
Okay, will do. I'll update this bug when it's done.
Comment 9 Dodji Seketeli 2007-01-26 00:11:36 UTC
Okay, I have applied the patch to 2.8, 2.10 and 2.12.
Comment 10 Thomas Wood 2007-01-26 12:55:12 UTC
The current changes in trunk seem to have fixed the problem for me.
Comment 11 Murray Cumming 2007-01-26 20:49:20 UTC
Well done. Smart thinking.