Bug #50360 invalid conversion from 'const char*' to 'char*
Submitted: 15 Jan 2010 11:02 Modified: 22 Jan 2010 11:36
Reporter: redhat redhat Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S1 (Critical)
Version:mysql-workbench-oss-5.2.11 OS:Linux (CentOS release 5.4 (Final))
Assigned to: CPU Architecture:Any
Tags: invalid conversion from 'const char*' to 'char*

[15 Jan 2010 11:02] redhat redhat
Description:
[redhatee2006@localhost mysql-workbench-oss-5.2.11]# make
make  all-recursive
make[1]: Entering directory `/home/install/mysql-workbench-oss-5.2.11'
Making all in ext
make[2]: Entering directory `/home/install/mysql-workbench-oss-5.2.11/ext'
Making all in ctemplate
make[3]: Entering directory `/home/install/mysql-workbench-oss-5.2.11/ext/ctemplate'
make -C ctemplate-src libctemplate_wb.la
...................................................
....................................................
python_context.cpp:388: error: invalid conversion from 'const char*' to 'char*'
python_context.cpp:388: error:   initializing argument 1 of 'PyObject* PyImport_ImportModule(char*)'
make[4]: *** [python_context.lo] Error 1
make[4]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11/library/grt/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11/library/grt'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11/library'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11'
make: *** [all] Error 2

How to repeat:
I don't now
[15 Jan 2010 11:25] redhat redhat
Linux version 2.6.18-164.10.1.el5
After install all dependences I have this errors
[19 Jan 2010 11:49] Susanne Ebrecht
Verified as described by source code analysis.
[19 Jan 2010 11:54] Hartmut Holzgraefe
The actual problem is the Python version, CentOS 5.4 comes with Python 2.4 which has

  ./python2.4/import.h:PyAPI_FUNC(PyObject *) PyImport_ImportModule(char *name);

while e.g. Ubuntu 9.10 comes with Python 2.6 which declares PyImport_ImportModule as

  ./python2.6/import.h:PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);

Assuming that PyImport_ImportModule doesn't actually change the "name" argument the solution would be to cast to (char *) when calling the function, as another call within the workbench code already does:

  ./library/grt/src/grtpp_module_python.cpp:    mod= PyImport_ImportModule((char*)name.c_str());
[19 Jan 2010 11:55] Hartmut Holzgraefe
... or to add a configure check for the right python version being available instead of just failing at compile time ...
[20 Jan 2010 10:32] Johannes Taxacher
starting with 5.2.13 we are providing binary and source packages for CentOS 5.4 which 
- due to older versions of dependency-packages for WB in centos5 - have some minor features disabled (like tooltips i.e.).
[22 Jan 2010 11:36] Tony Bedford
An entry has been added to the 5.2.13 changelog:

When building MySQL Workbench 5.2.11 from source on CentOS 5.4, the following error occurred:

python_context.cpp:388: error: invalid conversion from 'const char*' to 'char*'
python_context.cpp:388: error:   initializing argument 1 of 'PyObject*
PyImport_ImportModule(char*)'
make[4]: *** [python_context.lo] Error 1
make[4]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11/library/grt/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11/library/grt'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11/library'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11'
make: *** [all] Error 2

Note, from MySQL Workbench 5.2.13, binary and source packages for CentOS 5.4 will be available. Due to the dependence of MySQL Workbench on certain packages that are older in CentOS 5.4 than in other operating systems, MySQL Workbench has some minor features, such as tool tips, disabled.