Bug #61313 5.2.34 build fails with Fedora 15's gcc 4.6 due to missing stddef.h include
Submitted: 26 May 2011 19:47 Modified: 1 Jun 2011 1:15
Reporter: Mihai Limbășan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.34 OS:Linux (Fedora 15)
Assigned to: CPU Architecture:Any
Tags: Contribution

[26 May 2011 19:47] Mihai Limbășan
Description:
Building 5.2.34 on Fedora 15 fails in the bundled Google C++ Template lib - specifically in ext/ctemplate/ctemplate-src/src/ctemplate/template_dictionary.h - due to a missing include for the ptrdiff_t definition.

Cause: With Fedora's GCC 4.6 headers at least, stdlib.h and/or stdarg.h don't automatically pull in stddef.h anymore.

How to repeat:
rpmbuild -ba mysql-workbench.spec

---- < snip > ----
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./src -I./src -pthread -DNDEBUG -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -Wextra -Wall -Wno-unused -Wno-deprecated -DTIXML_USE_STL=1 -c src/template.cc  -fPIC -DPIC -o .libs/libctemplate_wb_la-template.o
In file included from ./src/ctemplate/template.h:48:0,
                 from src/template.cc:63:
./src/ctemplate/template_dictionary.h:73:11: error: 'ptrdiff_t' does not name a type
src/template.cc: In static member function 'static void ctemplate::Template::AssureGlobalsInitialized()':
src/template.cc:2368:100: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
src/template.cc: In member function 'void ctemplate::Template::Dump(const char*) const':
src/template.cc:2531:46: warning: ignoring return value of 'size_t fwrite(const void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
make[4]: *** [libctemplate_wb_la-template.lo] Error 1
make[4]: Leaving directory `/home/bld/rpmbuild/BUILD/mysql-workbench-gpl-5.2.34-src/ext/ctemplate/ctemplate-src'
make[3]: *** [all] Error 2
---- < snip > ----

Suggested fix:
The fix is to include stddef.h explicitely (patch attached).
[26 May 2011 19:48] Mihai Limbășan
Enable ctemplate to build with gcc 4.6

Attachment: ctemplate-gcc46.patch (application/octet-stream, text), 1.48 KiB.

[1 Jun 2011 1:15] Alexey Kishkin
Duplicate of bug#60603
[12 Jun 2011 15:41] Lee Clemens
The patch above solves this issue for me (gcc 4.6.0-9 on Fedora 15).

The patch provided on the bug this is said to be a duplicate of, did not resolve this specific issue.
[23 Oct 2011 22:33] Lee Clemens
This bug is NOT a duplicate. It requires the patch on this report - not the patches on the bug it is marked a duplicate of.

Also, this is still not resolved in 5.2.35.
[5 Nov 2011 6:27] Screen Cleaner
I confirm this bug for openSUSE 11.4 and 12.1 and MySQL Workbench 5.2.35 and 5.2.34
[5 Nov 2011 14:59] Alfredo Kojima
SuSE users must install package libctemplate
[5 Nov 2011 15:00] Alfredo Kojima
Fedora users must install package ctemplate.