qt-mysql driver conflits with Webkit on compilation

来源:互联网 发布:淘宝公司运营模式 编辑:程序博客网 时间:2024/04/28 20:10

When i compliing mysql driver for qt47 in mac os, an error is threw :

> bindings/js/JSPluginCustom.cpp:38: error: invalid use of incomplete type > ‘struct WebCore::Plugin’> generated/JSPlugin.h:30: error: forward declaration of ‘struct > WebCore::Plugin’> make[2]: *** [.obj/debug-shared/JSPluginCustom.o] Error 1> make[1]: *** [debug-all] Error 2> make: *** [sub-webkit-make_default-ordered] Error 2

read the source code, found the reason is there r two Plugin.h header file in the  g++ include path.

one is from qt source at $QTDIR/src/3rdparty/webkit/WebCore/plugins/Plugin.h and the other is come from the mysql header files.

in the file where the exception threw, the code

class Plugin;
is ambiguous.

I search the web for more infomation but there are only 2 way to solve this problem.

one is the macport provide an diff file for their own qt-mac package installer, so it is not general solution.

and the other way is remove the plugin.h. owned by mysql-source but only configure -release can make succ, the -debug or -release-and-debug mode remain wrongs.

it's terrible if i dev my project under an non-debug-tools-env.

after serveral hours i found a way to solve this boring problem, compiled the qt with mysql driver under the -release-and-debug mode in MacOs.

the solution is rough but it really Works correctly!

1.certainly u should backup your mysql header files first.

2.copy the content of the qt's Plugin.h and paste it into the mysql's plugin.h

(Notice : only one file is modified : the mysql plugin.h which is include by configure -Ixxxx )

3.copy the mysql header files into the qt directory. The the files structure in this directory would like this :

$QTDIR/src/3rdparty/webkit/WebCore/plugins/

                                                                                  Plugin.h

                                                                                  ....

                                                                                  mysql/

                                                                                             plugin.h

                                                                                             other mysql headers such as services.h

coz mysql plugin.h would #include "mysql/services.h" and some others, so solve it directly by `cp`.

4.qt configure & make & make install. waiting for the qt make result.



датоварищ, job done!