Bug #45049 Cannot compile on newer gcc version 4.4.0
Submitted: 23 May 2009 17:53 Modified: 30 Jun 2009 8:52
Reporter: Ionut Biru Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.1.12 OS:Linux (Archlinux x86_64)
Assigned to: CPU Architecture:Any
Tags: Contribution, gcc

[23 May 2009 17:53] Ionut Biru
Description:
I've tried to compile 5.0.12 on newer toolchain:
autoconf 2.63-1
automake 1.10.2-1
bin86 0.16.17-4
bison 2.4.1-1
ed 1.2-1
fakeroot 1.12.2-2
flex 2.5.35-1
gcc 4.4.0-1
libtool 2.2.6a-1
m4 1.4.13-1
make 3.81-4
patch 2.5.9-2
pkgconfig 0.23-1

There are a bunch of errors like this one which i managed to fixed then making a patch.
mysql_art_resultset.cpp:57: error: ‘snprintf’ was not declared in this scope
mysql_art_resultset.cpp:63: error: ‘snprintf’ was not declared in this scope
mysql_art_resultset.cpp:69: error: ‘snprintf’ was not declared in this scope
mysql_art_resultset.cpp:75: error: ‘snprintf’ was not declared in this scope

Those was easy to fix but now i'm stuck and i can't manage to fix it.

In file included from ../../ext/boost/mpl/apply.hpp:23,
                 from ../../ext/boost/iterator/iterator_facade.hpp:34,
                 from ../../ext/boost/iterator/iterator_adaptor.hpp:15,
                 from ../../ext/boost/iterator/reverse_iterator.hpp:12,
                 from ../../ext/boost/range/reverse_iterator.hpp:20,
                 from ../../ext/boost/range/rend.hpp:19,
                 from ../../ext/boost/foreach.hpp:72,
                 from src/mysql_sql_inserts_loader.cpp:5:
../../ext/boost/mpl/apply_wrap.hpp:81:31: error: missing binary operator before token "("
../../ext/boost/mpl/apply_wrap.hpp:173:31: error: missing binary operator before token "("
In file included from ../../ext/boost/mpl/bind.hpp:27,
                 from ../../ext/boost/mpl/lambda.hpp:18,
                 from ../../ext/boost/mpl/apply.hpp:25,
                 from ../../ext/boost/iterator/iterator_facade.hpp:34,
                 from ../../ext/boost/iterator/iterator_adaptor.hpp:15,
                 from ../../ext/boost/iterator/reverse_iterator.hpp:12,
                 from ../../ext/boost/range/reverse_iterator.hpp:20,
                 from ../../ext/boost/range/rend.hpp:19,
                 from ../../ext/boost/foreach.hpp:72,
                 from src/mysql_sql_inserts_loader.cpp:5:
../../ext/boost/mpl/apply_wrap.hpp:81:31: error: missing binary operator before token "("
../../ext/boost/mpl/apply_wrap.hpp:173:31: error: missing binary operator before token "("
In file included from ../../ext/boost/mpl/lambda.hpp:18,
                 from ../../ext/boost/mpl/apply.hpp:25,
                 from ../../ext/boost/iterator/iterator_facade.hpp:34,
                 from ../../ext/boost/iterator/iterator_adaptor.hpp:15,
                 from ../../ext/boost/iterator/reverse_iterator.hpp:12,
                 from ../../ext/boost/range/reverse_iterator.hpp:20,
                 from ../../ext/boost/range/rend.hpp:19,
                 from ../../ext/boost/foreach.hpp:72,
                 from src/mysql_sql_inserts_loader.cpp:5:
../../ext/boost/mpl/bind.hpp:364:31: error: missing binary operator before token "("
../../ext/boost/mpl/bind.hpp:531:31: error: missing binary operator before token "("
In file included from ../../ext/boost/mpl/lambda.hpp:22,
                 from ../../ext/boost/mpl/apply.hpp:25,
                 from ../../ext/boost/iterator/iterator_facade.hpp:34,
                 from ../../ext/boost/iterator/iterator_adaptor.hpp:15,
                 from ../../ext/boost/iterator/reverse_iterator.hpp:12,
                 from ../../ext/boost/range/reverse_iterator.hpp:20,
                 from ../../ext/boost/range/rend.hpp:19,
                 from ../../ext/boost/foreach.hpp:72,
                 from src/mysql_sql_inserts_loader.cpp:5:
../../ext/boost/mpl/aux_/full_lambda.hpp:230:31: error: missing binary operator before token "("
In file included from ../../ext/boost/iterator/iterator_facade.hpp:34,
                 from ../../ext/boost/iterator/iterator_adaptor.hpp:15,
                 from ../../ext/boost/iterator/reverse_iterator.hpp:12,
                 from ../../ext/boost/range/reverse_iterator.hpp:20,
                 from ../../ext/boost/range/rend.hpp:19,
                 from ../../ext/boost/foreach.hpp:72,
                 from src/mysql_sql_inserts_loader.cpp:5:
../../ext/boost/mpl/apply.hpp:138:31: error: missing binary operator before token "("
make[3]: *** [mysql_sql_inserts_loader.lo] Error 1
make[3]: Leaving directory `/home/ioni/builds/community/network/mysql-workbench/src/mysql-workbench-oss-5.1.12/modules/db.mysql.sqlparser'

How to repeat:
install newer toolchain and use gcc 4.4.0 to compile it.

Suggested fix:
this is my current patch. I'm not sure if i add them in the right place but is compiling fine until the submited error.

diff -urN mysql-workbench-oss-5.1.12.orig/ext/cppconn/driver/mysql_art_resultset.cpp mysql-workbench-oss-5.1.12/ext/cppconn/driver/mysql_art_resultset.cpp
--- mysql-workbench-oss-5.1.12.orig/ext/cppconn/driver/mysql_art_resultset.cpp	2009-04-23 19:00:53.000000000 +0300
+++ mysql-workbench-oss-5.1.12/ext/cppconn/driver/mysql_art_resultset.cpp	2009-05-23 19:20:47.468870434 +0300
@@ -16,6 +16,7 @@
 
 #include <cppconn/exception.h>
 #include <sstream>
+#include <cstdio>
 #include <math.h>
 
 
diff -urN mysql-workbench-oss-5.1.12.orig/ext/cppconn/driver/mysql_resultbind.cpp mysql-workbench-oss-5.1.12/ext/cppconn/driver/mysql_resultbind.cpp
--- mysql-workbench-oss-5.1.12.orig/ext/cppconn/driver/mysql_resultbind.cpp	2009-04-23 19:00:53.000000000 +0300
+++ mysql-workbench-oss-5.1.12/ext/cppconn/driver/mysql_resultbind.cpp	2009-05-23 19:26:03.928807729 +0300
@@ -14,6 +14,7 @@
 #include "mysql_resultbind.h"
 
 #include <string.h>
+#include <cstdio>
 
 namespace sql
 {
diff -urN mysql-workbench-oss-5.1.12.orig/library/canvas/src/mdc_common.h mysql-workbench-oss-5.1.12/library/canvas/src/mdc_common.h
--- mysql-workbench-oss-5.1.12.orig/library/canvas/src/mdc_common.h	2009-04-23 19:00:55.000000000 +0300
+++ mysql-workbench-oss-5.1.12/library/canvas/src/mdc_common.h	2009-05-23 19:34:07.056259058 +0300
@@ -27,6 +27,7 @@
 #endif
 #endif
 
+#include <cstdio>
 
 #include "mdc_canvas_public.h"
 
diff -urN mysql-workbench-oss-5.1.12.orig/library/forms/filechooser.cpp mysql-workbench-oss-5.1.12/library/forms/filechooser.cpp
--- mysql-workbench-oss-5.1.12.orig/library/forms/filechooser.cpp	2009-04-23 19:00:55.000000000 +0300
+++ mysql-workbench-oss-5.1.12/library/forms/filechooser.cpp	2009-05-23 19:46:19.568710012 +0300
@@ -1,6 +1,8 @@
 
 #include "stdafx.h"
 
+#include <cstdio>
+
 #include <mforms/mforms.h>
 
 
diff -urN mysql-workbench-oss-5.1.12.orig/library/forms/mforms.cpp mysql-workbench-oss-5.1.12/library/forms/mforms.cpp
--- mysql-workbench-oss-5.1.12.orig/library/forms/mforms.cpp	2009-04-23 19:00:55.000000000 +0300
+++ mysql-workbench-oss-5.1.12/library/forms/mforms.cpp	2009-05-23 19:54:19.822012953 +0300
@@ -3,7 +3,7 @@
 #include <string.h>
 #include "mforms/mforms.h"
 #include "mforms/simpleform.h"
-
+#include <cstdio>
 using namespace mforms;
 
 ControlFactory *ControlFactory::get_instance()
[23 May 2009 18:00] Ionut Biru
didn't know that i can upload files. added patch to files.
[23 May 2009 18:01] Ionut Biru
suggested fix for some errors

Attachment: gcc44.patch (application/octet-stream, text), 2.27 KiB.

[24 May 2009 9:25] Ionut Biru
usefull links
http://udrepper.livejournal.com/20948.html
http://gcc.gnu.org/gcc-4.4/porting_to.html
[26 May 2009 8:52] Susanne Ebrecht
Many thanks for writing a bug report.

The version numbers are confusing here. We don't have Workbench 5.0 for Linux. Do you meant Workbench 5.1 instead?
[26 May 2009 9:56] Ionut Biru
yes. i've modified the version. where should i add the alpha version? with comma separated?
[26 May 2009 11:31] Susanne Ebrecht
We should know by ourself that 5.1.12 is our beta version.

It is a bug that the version itself means it is alpha. It is our beta version.

Anyway, unfortunately I forgot to ask you another question:

Linux distribution is not equal to Linux distribution. So I need to know here which Linux distribution, which kernel and which architecture you are using.

For example: Ubuntu 8.10, AMD 64
[26 May 2009 11:42] Ionut Biru
distribution and arhitecture are not important because the bug is that the sources are incompatible with the newest gcc and glibc and need to be fixed.

additonal information: glibc 2.10.1
when i've used gcc 4.3.x and  glibc 2.9 the beta version was compiling fine. 
i've submited the bug because just because it should be fixed before beta or alpha will became stable.
[26 May 2009 11:43] Ionut Biru
additonal:
kernel-headers 2.6.29.3-1
kernel26 2.6.28.10-1
[4 Jun 2009 20:22] Ionut Biru
working patch

Attachment: gcc44final.patch (application/octet-stream, text), 5.63 KiB.

[4 Jun 2009 20:24] Ionut Biru
i've uploaded a working patch. here are my link references:

http://archives.free.net.ph/message/20080712.132505.0f784d6e.html
https://svn.boost.org/trac/boost/attachment/ticket/2069/0001-boost.mpl-gcc-4.4-fixes.patch
[30 Jun 2009 8:52] Susanne Ebrecht
This is a duplicate of bug #45798