Results 1 to 10 of 10

Thread: DLLs not found when testing in other PC

  1. #1
    Join Date
    Sep 2012
    Posts
    34
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default DLLs not found when testing in other PC

    Hi,

    My application is somewhat ready to be tested wider so I have build it with release target, and it seem to work fine in the PC I've used for developing it. However I'm not able to get it working in another PC.

    I'm getting errors that not all DLLs are found. To be specific, SQL DLLs are not found. At first it did not find any SQL drivers (even though they were located under /sqldrivers folder in the app directory). Then I found out that it was trying to search then from plugins directory, which is C:\QtSDK\Desktop\Qt\4.8.0\mingw\plugins by default, hence it created that directory and placed the sqldrivers there - just like in the development PC.

    Unfortunately even this did not work. All the other drivers were found but not the PSQL driver which is needed. Currently I've got all the DLLs (yes, the same DLLs in every folder) in the mentioned plugins directory, App directory and App/sqldrivers directory. The first problem is that it does not find any of those sql drivers if not located at the plugins directory, why? The second problem is that even if the plugins directory is created, still QPSQL driver is not working - any idea why is that? I would think I have all the DLLs created because it's working on the development PC.

    Cheers!

    UPDATE:
    I tried to run dependency walker on target PC and it gives following:

    LoadLibraryW("C:\QtSDK\Desktop\Qt\4.8.0\mingw\plug ins\sqldrivers\qsqlpsql.dll") returned NULL. Error: %1 is not a valid Win32 application (193).

    Both PCs (one used for developing and this target PC) are running 64 bit Windows7, but during the process I have used 32bit tools. Cannot understand the error message...
    Last edited by Mobility; 20th March 2013 at 08:23.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: DLLs not found when testing in other PC

    <app-dir>/sqldrivers/qsqlpsql.dll
    Make sure the dll exists in this path on the target PC. Where <app-dir> is the directory which contains the application executable (.exe) file.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Sep 2012
    Posts
    34
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: DLLs not found when testing in other PC

    Thanks, but as I said I've already got all the DLLs (including qsqlpsql.dll) in three different folder, just to be sure.

    <app-dir>\
    <app-dir>\sqldrivers\
    C:\QtSDK\Desktop\Qt\4.8.0\mingw\plugins\sqldrivers \

    Still it's not working. To get it working even from the plugin path, I would need to understand why following error is seen in DependencyWalker:

    LoadLibraryW("C:\QtSDK\Desktop\Qt\4.8.0\mingw\plug ins\sqldrivers\qsqlpsql.dll") returned NULL. Error: %1 is not a valid Win32 application (193).

    UPDATE:

    To my understanding the error means that it can be executed only in x86 machine. Why on earth it's working on the other PC which has also Win7 64bit? And as I said, every tool I have used has been 32bit version (QtSdk, QtCreator, OpenSSL, PSQL ...). Why this error pops up now with one DLL and just in another PC?
    Last edited by Mobility; 20th March 2013 at 10:47.

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: DLLs not found when testing in other PC

    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  5. #5
    Join Date
    Sep 2012
    Posts
    34
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: DLLs not found when testing in other PC

    Thanks. Not sure if I got it right but isn't that thread talking about Visual Studio, which I'm not using? I'm using Qt Creator and Mingw, so I understand that the thread is not applicable for my case? To be noticed also that my .exe file is working, but the earlier mentioned PSQL dll is giving the error.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: DLLs not found when testing in other PC

    Did you deploy a 32bit PostgreSql run time library? Thq Qt PSQL plugin depends on that being present. Load the Qt plugin into Dependcy Walker to check.

  7. #7
    Join Date
    Sep 2012
    Posts
    34
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: DLLs not found when testing in other PC

    Hmm... I'm sorry but I have to admit that I don't fully understand what do you mean. By PSQL run time library you mean qsqlpsql.dll? That is giving the error:

    LoadLibraryW("C:\QtSDK\Desktop\Qt\4.8.0\mingw\plug ins\sqldrivers\qsqlpsql.dll") returned NULL. Error: %1 is not a valid Win32 application (193).

    So far I have just checked my .exe file in Dependency Walker. Which file (= referred Qt plugin) do you suggest to check?

    Thanks for you time!

    UPDATE:

    I checked the qsqlpsql.dll with dependency walker and found out that openssl related dlls were x64. Also after debugging a while I found out that one postgresql dll (libintl.dll) was missing too. Anyway now the driver is found and the connection succeeds. Thank you very much!

    So one problem solved and one to go. The remaining problem is that DLLs are just found from the plugin directory and if located only in my application directory, the app wont work.
    Last edited by Mobility; 24th March 2013 at 17:36.

  8. #8
    Join Date
    Sep 2012
    Posts
    34
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: DLLs not found when testing in other PC

    I still got the problem not finding the sql libs from the plugin directory. I tried tracing the plugin and library paths with following results:

    plugin path: C:\QtSDK\Desktop\Qt\4.8.0\mingw\plugins
    lib paths: C:/Program Files (x86)/App/plugins, C:/QtSDK/Desktop/Qt/4.8.0/mingw/plugins, C:/Program Files (x86)/App

    So it seems that the application folder ("App") is listed in lib paths as well as the plugins path. For some reason that is not enough and the actual plugin path refers to a folder in the develop-PC. How can I get the sql plugins work somewhere under the application path?

    It seems to find all the drivers and I'm able to trace them:

    QSQLITE, QODBC3, QODBC, QPSQL7, QPSQL

    but when trying to open a DB it gives error: Driver not loaded

    Edit.
    In addition it does not make it easier that dependency walker always jams if the App is profiled from installation directory - it only works when profiled from "release" directory.

    FINAL EDIT - SOLVED

    I added plugins path as follows and got it working:

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4. a.addLibraryPath(QCoreApplication::applicationDirPath()+"/plugins");
    5. MainWindow w;
    6. w.show();
    7.  
    8. return a.exec();
    9. }
    To copy to clipboard, switch view to plain text mode 

    Also my problem with SQL driver was that I initialized it in global are, which was wrong. See thread: http://www.qtcentre.org/threads/4392...ot-loaded-quot
    Last edited by Mobility; 8th April 2013 at 17:55.

  9. #9
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: DLLs not found when testing in other PC

    If you had deployed the Qt plugins into the expected location then you would not have needed to do this. Santosh Reddy told you where that was for the SQL drivers, you told us you had put them there, but clearly you had not.

  10. #10
    Join Date
    Aug 2015
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Smile Re: DLLs not found when testing in other PC

    SOLVED
    I developed an app wich enviroment looks like you said: Win x64 but tools x32 and I had the same problem, however the solution was to add msvcr120.dll to the app_dir/

    I hope it helps

Similar Threads

  1. Testing Qt-Software with a GUI Testing Tool
    By nightghost in forum Qt Programming
    Replies: 8
    Last Post: 22nd February 2012, 07:43
  2. Linking to VB6 dlls
    By drmath in forum Qt Programming
    Replies: 0
    Last Post: 17th September 2010, 16:00
  3. Error using dlls
    By HelderC in forum Newbie
    Replies: 1
    Last Post: 15th March 2010, 22:58
  4. suffix for qt dlls
    By jobrandt in forum Installation and Deployment
    Replies: 6
    Last Post: 11th April 2008, 09:59
  5. Qt and dlls ?
    By probine in forum Qt Programming
    Replies: 4
    Last Post: 15th December 2006, 14:12

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.