Results 1 to 5 of 5

Thread: Error building MySQL pluggin on xp with mingw32-make

  1. #1
    Join Date
    Mar 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Error building MySQL pluggin on xp with mingw32-make

    I keep getting errors trying to build the MySQL pluggin on XP. I finally found this tutorial which I followed. This is my setup
    Windows XP home on compaq presario amd
    MinGW 5.1.3 with the utils including reimp
    mysql-5.1.23-rc-win32 installed in C:\MySQL\
    Qt 4.3.4 installed in C:\Qt\4.3.4\

    The instructions followed are at: http://wiki.qtcentre.org/index.php?t...ws_using_MinGW

    The error I am now getting after reinstalling both mysql and Qt:

    C:\Qt\4.3.4\src\plugins\sqldrivers\mysql>mingw32-make
    mingw32-make -f Makefile.Release
    mingw32-make[1]: Entering directory `C:/Qt/4.3.4/src/plugins/sqldrivers/mysql'
    g++ -c -O2 -Wall -fno-exceptions -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO
    _CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\
    include\QtCore" -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include\QtSql
    " -I"..\..\..\..\include" -I"c:\MySQL\include" -I"c:\Qt\4.3.4\include\ActiveQt" -I"release" -I"." -I"..\.
    .\..\..\mkspecs\default" -o release\main.o main.cpp
    g++ -c -O2 -Wall -fno-exceptions -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO
    _CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\
    include\QtCore" -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include\QtSql
    " -I"..\..\..\..\include" -I"c:\MySQL\include" -I"c:\Qt\4.3.4\include\ActiveQt" -I"release" -I"." -I"..\.
    .\..\..\mkspecs\default" -o release\qsql_mysql.o ..\..\..\sql\drivers\mysql\qsql_mysql.cpp
    C:/Qt/4.3.4/bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -D
    QT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"
    ..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\in
    clude" -I"c:\MySQL\include" -I"c:\Qt\4.3.4\include\ActiveQt" -I"release" -I"." -I"..\..\..\..\mkspecs\def
    ault" -D__GNUC__ -DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.h -o release\moc_qsql_mysql.cpp
    g++ -c -O2 -Wall -fno-exceptions -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO
    _CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\
    include\QtCore" -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include\QtSql
    " -I"..\..\..\..\include" -I"c:\MySQL\include" -I"c:\Qt\4.3.4\include\ActiveQt" -I"release" -I"." -I"..\.
    .\..\..\mkspecs\default" -o release\moc_qsql_mysql.o release\moc_qsql_mysql.cpp
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -o release\qsql
    mysql.lib release/main.o release/qsql_mysql.o release/moc_qsql_mysql.o -L"c:\Qt\4.3.4\lib" C:\MySQL\lib\
    opt\liblibmysql.a -lQtSql4 -lQtCore4
    /mingw/lib/libmingw32.a(main.o):main.c:(.text+0x104): undefined reference to `WinMain@16'
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [release\qsqlmysql.lib] Error 1
    mingw32-make[1]: Leaving directory `C:/Qt/4.3.4/src/plugins/sqldrivers/mysql'
    mingw32-make: *** [release] Error 2

    C:\Qt\4.3.4\src\plugins\sqldrivers\mysql>
    Can someone help ?
    Last edited by jpn; 24th March 2008 at 12:20. Reason: disabled smilies

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Error building MySQL pluggin on xp with mingw32-make

    Looks like it's attempting to build an application instead of a library. I suggest you restore the original mysql.pro from the source package.
    J-P Nurmi

  3. #3
    Join Date
    Mar 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error building MySQL pluggin on xp with mingw32-make

    Thanks for the reply Jpn. I have built driver several times and each time I did a brand new install of MySQL with the developer header files. This is the .pro files that comes with it:
    TARGET = qsqlmysql

    HEADERS = ../../../sql/drivers/mysql/qsql_mysql.h
    SOURCES = main.cpp \
    ../../../sql/drivers/mysql/qsql_mysql.cpp

    unix: {
    isEmpty(QT_LFLAGS_MYSQL) {
    !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) {
    use_libmysqlclient_r:LIBS *= -lmysqlclient_r
    else:LIBS *= -lmysqlclient
    }
    } else {
    LIBS *= $$QT_LFLAGS_MYSQL
    QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL
    }
    }

    win32:!contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*) {
    LIBS *= -llibmysql
    }

    include(../qsqldriverbase.pri)
    This is the main.cpp in the Qt directory
    #include <qsqldriverplugin.h>
    #include <qstringlist.h>
    #include "../../../sql/drivers/mysql/qsql_mysql.h"

    class QMYSQLDriverPlugin : public QSqlDriverPlugin
    {
    public:
    QMYSQLDriverPlugin();

    QSqlDriver* create(const QString &);
    QStringList keys() const;
    };

    QMYSQLDriverPlugin::QMYSQLDriverPlugin()
    : QSqlDriverPlugin()
    {
    }

    QSqlDriver* QMYSQLDriverPlugin::create(const QString &name)
    {
    if (name == QLatin1String("QMYSQL") || name == QLatin1String("QMYSQL3")) {
    QMYSQLDriver* driver = new QMYSQLDriver();
    return driver;
    }
    return 0;
    }

    QStringList QMYSQLDriverPlugin::keys() const
    {
    QStringList l;
    l << QLatin1String("QMYSQL3");
    l << QLatin1String("QMYSQL");
    return l;
    }

    Q_EXPORT_STATIC_PLUGIN(QMYSQLDriverPlugin)
    Q_EXPORT_PLUGIN2(qsqlmysql, QMYSQLDriverPlugin)
    I googled the error and none of the results seem to point to main.cpp rather to a linker error. I am not sure how to go on

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Error building MySQL pluggin on xp with mingw32-make

    Exactly what commands did you invoke before 'mingw32-make'?
    J-P Nurmi

  5. #5
    Join Date
    Mar 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error building MySQL pluggin on xp with mingw32-make

    Ok, first I went into the Qt directory and did "mingw32-make confclean".
    I then reinstalled the latest MySQL with the headers to C:\MysQL.
    Entered the C:\MySQL\lib\opt\ and ran the "reimp libmysql.lib" command to produce liblibmysql.a

    Just a note, when I use the -d flag, I only get a libmysql.a file not a liblibmysql.a file ? Anyway I kept both in there.

    Then I went into the C:Qt\4.3.4\src\plugins\sqldrivers\mysql and run the "qmake -o Makefile "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MySQL\lib\opt\liblibmysql.a" mysql.pro"

    Then I ran the mingw32-make to build the .dll file. This command stopped due to errors, however I came across the libMySQL.dll file which I copied into C:\Qt\4.3.4\bin which is on the systems path.

    I then went back into the Qt directory and did built Qt with mysql and even though building the driver failed I built Qt with the mysql configuration like this:

    configure -qt-sql-mysql
    mingw32-make

    This time when I tried to connect to mysql using the application in the demo it actually worked. I have not had a chance to test out my own program yet.

Similar Threads

  1. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.