Results 1 to 5 of 5

Thread: Problem using the QPSQL plugin on Windows x64 in Debug mode

  1. #1
    Join Date
    Apr 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Question Problem using the QPSQL plugin on Windows x64 in Debug mode

    I installed PostgreSQL, then downloaded and installed libpq64. Afterwards, I downloaded the Qt 4.6.2 source code and compiled it successfully with Visual Studio 2008. After providing the path to the libs in libpq64, I compiled the QPSQL sucessfully too.

    My sql plugin folder contains the following files:
    Qt Code:
    1. V:\windows\x64\QT-4.6.2_VC9.0_Bin\plugins\sqldrivers>dir *.dll
    2. Datenträger in Laufwerk V: ist Data
    3. Verzeichnis von V:\windows\x64\QT-4.6.2_VC9.0_Bin\plugins\sqldrivers
    4. qsqlite4.dll
    5. qsqlited4.dll
    6. qsqlpsql4.dll
    7. qsqlpsqld4.dll
    To copy to clipboard, switch view to plain text mode 

    I use a simple test program:

    Qt Code:
    1. main(int argc , char* argv[])
    2. {
    3. QApplication app(argc,argv); // load plugins
    4. std::cout << "QSqlDatabase::drivers() output: " << QSqlDatabase::drivers().join(QString("; ")).toLatin1().data() << "\n"; //
    5. output of all loaded sql plugins
    6.  
    7. return 0;
    8. }
    To copy to clipboard, switch view to plain text mode 

    The output in Release Mode:
    QSqlDatabase::drivers(): QSQLITE; QPSQL7; QPSQL

    The output in Debug Mode:
    QSqlDatabase::drivers(): QSQLITE

    As you can see, the QPSQL plugin is not loaded in debug mode.


    I debugged into the qt code, the problem is in
    qlibrary_win.cpp Line 70:
    Qt Code:
    1. pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(attempt).utf16());
    To copy to clipboard, switch view to plain text mode 
    returns 0x00000000 for qsqlpsqld4.dll


    My PATH variable contains
    Qt Code:
    1. PATH=V:\windows\x64\QT-4.6.2_VC9.0_Bin\bin;V:\windows\x64\libpq64;"V:\toolkits\windows\x64\PostgreSQL\bin";[...]
    To copy to clipboard, switch view to plain text mode 
    These paths contain the following DLLs:
    Qt Code:
    1. libeay32.dll
    2. libpq.dll
    3. ssleay32.dll
    4.  
    5. comerr32.dll
    6. gssapi32.dll
    7. iconv.dll
    8. k5sprt32.dll
    9. krb5_32.dll
    10. libeay32.dll
    11. libiconv-2.dll
    12. libintl-8.dll
    13. libpq.dll
    14. libxml2.dll
    15. libxslt.dll
    16. msvcr71.dll
    17. ssleay32.dll
    18. zlib1.dll
    To copy to clipboard, switch view to plain text mode 

    What am I missing? How can I use the QPSQL plugin in debug mode?

    Thank you for your help.

  2. #2
    Join Date
    Apr 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem using the QPSQL plugin on Windows x64 in Debug mode

    I tried to SET QT_DEBUG_PLUGINS=1 to get more debug information

    Qt Code:
    1. QFactoryLoader::QFactoryLoader() looking at "V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlite4.dll"
    2. In V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlite4.dll:
    3. Plugin uses incompatible Qt library
    4. expected build key "Windows x64 msvc debug full-config", got "Windows x64 msvc release full-config"
    5. "The plugin 'V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlite4.dll' uses incompatible Qt library. Expected b
    6. uild key "Windows x64 msvc debug full-config", got "Windows x64 msvc release full-config""
    7. not a plugin
    8. QFactoryLoader::QFactoryLoader() looking at "V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlited4.dll"
    9. keys ("QSQLITE")
    10. QFactoryLoader::QFactoryLoader() looking at "V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlpsql4.dll"
    11. In V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlpsql4.dll:
    12. Plugin uses incompatible Qt library
    13. expected build key "Windows x64 msvc debug full-config", got "Windows x64 msvc release full-config"
    14. "The plugin 'V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlpsql4.dll' uses incompatible Qt library. Expected
    15. build key "Windows x64 msvc debug full-config", got "Windows x64 msvc release full-config""
    16. not a plugin
    17. QFactoryLoader::QFactoryLoader() looking at "V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlpsqld4.dll"
    18. "Cannot load library V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlpsqld4.dll: "
    19. could not load
    To copy to clipboard, switch view to plain text mode 


    <-- it just can not load qsqlpsqld4.dll

    In release mode, the output is as expected:

    Qt Code:
    1. QFactoryLoader::QFactoryLoader() looking at "V:/windows/x64/QT-4.6.2_VC9.0_Bin/plugins/sqldrivers/qsqlpsql4.dll"
    2. keys ("QPSQL7", "QPSQL")[/QUOTE]
    To copy to clipboard, switch view to plain text mode 

    using the dependency walker, I get an error "MSVCR90D.DLL can not be found". Adding the folder "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\Debug_NonRedist\amd64\Microsoft.VC90 .DebugCRT" that contains the dll to the path did not make the plugin load (but the dependency walker error message disapeared).
    The next error message from dependency walker is "Error: Modules with different CPU types were found."
    Browsing the module list, I found that MSVCR90.DLL for x86 (!) seems to be a required module for qsqlpsql4.dll.

    Could this be the cause for the failed plugin loading? How can I fix this?

  3. #3
    Join Date
    Apr 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem using the QPSQL plugin on Windows x64 in Debug mode

    Okay, I did some more experimentation:
    adding
    Qt Code:
    1. @SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\redist\Debug_NonRedist\amd64\Microsoft.VC90.DebugCRT;%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\redist\amd64\Microsoft.VC90.CRT;%PATH%
    To copy to clipboard, switch view to plain text mode 
    to the front of my path made sure that the correct x64 DLLs are found first. Now, Dependency Walker does not complain anymore. Running my test program raises an error message:
    Qt Code:
    1. ---------------------------
    2. Microsoft Visual C++ Runtime Library
    3. ---------------------------
    4. Runtime Error!
    5. Program: d:\...
    6. R6034
    7. An application has made an attempt to load the C runtime library incorrectly.
    8. Please contact the application's support team for more information.
    To copy to clipboard, switch view to plain text mode 

    Of course, the QPSQL driver is not loaded...

    R6034 hints at a missing manifest file. But my visual studio project settings are set to embed the manifest into my .exe.

    I'm lost, I have no idea how to get this working

  4. #4
    Join Date
    Apr 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem using the QPSQL plugin on Windows x64 in Debug mode

    Now it is getting strange:

    I removed the QApplication app(argc,argv) line which should be responsible for loading the plugins, startet in release mode and the plugin was still loaded:
    Qt Code:
    1. //QApplication app(argc,argv);
    2. MITK_INFO << "QSqlDatabase::drivers(): " << QSqlDatabase::drivers().join(QString("; ")).toLatin1().data() << "\n";
    To copy to clipboard, switch view to plain text mode 
    Output:
    Qt Code:
    1. QSqlDatabase::drivers(): QSQLITE; QPSQL7; QPSQL
    To copy to clipboard, switch view to plain text mode 

    I'm confused, I thought that the plugins are loaded during instantiation of QApplication?

  5. #5
    Join Date
    Aug 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem using the QPSQL plugin on Windows x64 in Debug mode

    I have been experiencing the same problem on Windows XP 32 bit edition.

    I just want to comment on QApplication loading the plug-ins. It shouldn't do that and as you verified it doesn't. Plugins are only to be loaded when necessary.

    I am checking whether there is a bug report on this issue.

Similar Threads

  1. Replies: 1
    Last Post: 18th November 2009, 21:51
  2. Replies: 1
    Last Post: 2nd November 2009, 12:02
  3. Problem in building QT webkit in debug mode
    By sm38098 in forum Newbie
    Replies: 0
    Last Post: 31st March 2009, 05:23
  4. QPSQL plugin problem
    By tuxi in forum Qt Programming
    Replies: 0
    Last Post: 12th March 2007, 20:44
  5. Problem with Debug mode in KDevelop
    By zlatko in forum KDE Forum
    Replies: 1
    Last Post: 16th June 2006, 09:10

Tags for this Thread

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.