[bug] Cannot find a usable libpg.dll ubuntu 16.04 i686 wine 1.6.2

goffyara's profile image goffyara posted 7 years ago in General Permalink

Cannot find a usable libpg.dll...

Not working in

HeidiSQL 9.4

HeidiSQL 9.4.0.5127 both 32+64bit installer and 32bit installer

But working in

HeidiSQL_9.3.0.5067-32_Setup.exe

ansgar's profile image ansgar posted 7 years ago Permalink

I updated numerous PostgreSQL libraries in r5068 (one after your working version), which probably causes your issue. Runs fine on any Windows version. Probably a privilege issue in your file system?

I also removed the file path string from the loaded libpq.dll in r5068, so that the code now looks like this:

LibPqHandle := LoadLibrary('libpq.dll');
if LibPqHandle = 0 then
  raise EDatabaseError.CreateFmt('Cannot find a usable ...');

... while in r5067 it looked like this:

LibWithPath := 'C:\Program files\HeidiSQL\libpq.dll';
if not FileExists(LibWithPath) then
  raise EDatabaseError.CreateFmt('Cannot find a usable ...');
LibPqHandle := LoadLibrary(LibWithPath);

I can probably make a check on the lib with path after the one without path failed.

goffyara's profile image goffyara posted 7 years ago Permalink

Ou, Sorry. My mistake. Text other:

"Невозможно найти пригодный для использования libpq.dll. Пожалуйста, запустите heidisql.exe из директории установки"

prnt.sc/czbwc7

Code modification/commit ce444cb from ansgarbecker, 7 years ago, revision 9.4.0.5132
Try to load libpq.dll with explicit file path if the path-less did not succeed. See http://www.heidisql.com/forum.php?t=22514
ansgar's profile image ansgar posted 7 years ago Permalink

r5132 gives the library a second attempt to load, with the full path then. Please check if that solves your PostgreSQL issue on Wine.

[expired user #10325]'s profile image [expired user #10325] posted 7 years ago Permalink

With r5132 and r5133 the error still occurs.

1 attachment(s):
  • heidisql_pgsql_wine_error
ansgar's profile image ansgar posted 7 years ago Permalink

Can you please turn on "Information messages" in HeidiSQL's preferences (tab "Logging"). Then, connect to some server which is working if you have one, then to the one which does not work. So the main window and the lower SQL log panel is visible at the time you are connecting to the pg server. That should give out some message in the log panel, saying

Trying to load library with full path: ...

That full path is of interest here. Perhaps it is wrongly concatenated.

[expired user #10325]'s profile image [expired user #10325] posted 7 years ago Permalink

MySQL is working but no log message for loading of a dll is created. Also for Version 9.3 which is working no log entry is created.

For postgres the log entries are

/* 2016-11-25 09:00:30 [] */ /* Schreibe ab jetzt in Sitzungs Logdatei: Z:\data\programs\heidisql_9.4\logs\000002.log */
/* 2016-11-25 09:00:31 [local_pgsql] */ /* Trying to load library with full path: Z:\data\programs\heidisql_9.4\libpq.dll */

The path seems correct, perhaps the dll cannot be loaded with wine.

[expired user #10325]'s profile image [expired user #10325] posted 7 years ago Permalink

I logged the wine output, and it looks like some more dlls are missing.

fixme:msg:ChangeWindowMessageFilter 400 00000001
fixme:wtsapi:WTSRegisterSessionNotification Stub 0x10094 0x00000000
fixme:win:LockWindowUpdate (0x20032), partial stub!
fixme:win:LockWindowUpdate ((nil)), partial stub!
fixme:win:LockWindowUpdate (0x20032), partial stub!
fixme:win:LockWindowUpdate ((nil)), partial stub!
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
err:module:import_dll Library MSVCR120.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\LIBEAY32.dll") not found
err:module:import_dll Library LIBEAY32.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\SSLEAY32.dll") not found
err:module:import_dll Library MSVCR120.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\SSLEAY32.dll") not found
err:module:import_dll Library SSLEAY32.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\libpq.dll") not found
err:module:import_dll Library MSVCR120.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\LIBEAY32.dll") not found
err:module:import_dll Library LIBEAY32.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\libpq.dll") not found
err:module:import_dll Library MSVCR120.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\libpq.dll") not found
err:module:import_dll Library MSVCR120.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\LIBEAY32.dll") not found
err:module:import_dll Library LIBEAY32.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\SSLEAY32.dll") not found
err:module:import_dll Library MSVCR120.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\SSLEAY32.dll") not found
err:module:import_dll Library SSLEAY32.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\libpq.dll") not found
err:module:import_dll Library MSVCR120.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\LIBEAY32.dll") not found
err:module:import_dll Library LIBEAY32.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\libpq.dll") not found
err:module:import_dll Library MSVCR120.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\libpq.dll") not found
fixme:win:WINNLSEnableIME hwnd 0x10144 enable -1: stub!
fixme:win:WINNLSEnableIME hwnd 0x10170 enable -1: stub!
fixme:win:WINNLSEnableIME hwnd 0x10144 enable -1: stub!
fixme:win:WINNLSEnableIME hwnd 0x10146 enable -1: stub!
fixme:wtsapi:WTSUnRegisterSessionNotification Stub 0x10094

I tried to download these files from www.dlldownloader.com without success.

err:module:import_dll Loading library LIBEAY32.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\SSLEAY32.dll") failed (error c000007b).
err:module:import_dll Loading library MSVCR120.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\SSLEAY32.dll") failed (error c000007b).
err:module:import_dll Library SSLEAY32.dll (which is needed by L"Z:\\data\\programs\\heidisql_9.4\\libpq.dll") not found
[expired user #10325]'s profile image [expired user #10325] posted 7 years ago Permalink

Sorry for the double posts.

After updating to wine1.8 and installing vcrun2013 via winetricks - it is just the LIBEAY32.dll which is missing.

Then I downloaded an openssl package from [https]indy.fulgan[com]/SSL/ and extracted both ssleay32.dll and libeay32.dll into the heidisql folder.

Finally the error was gone.

ansgar's profile image ansgar posted 7 years ago Permalink

These both are also in the installer. Probably they also have path issues.

goffyara's profile image goffyara posted 7 years ago Permalink

Sorry for the double posts.

After updating to wine1.8 and installing vcrun2013 via winetricks - it is just the LIBEAY32.dll which is missing.

Then I downloaded an openssl package from [https]indy.fulgan[com]/SSL/ and extracted both ssleay32.dll and libeay32.dll into the heidisql folder.

Finally the error was gone.

thx. It helped

[expired user #10477]'s profile image [expired user #10477] posted 7 years ago Permalink

Hi, all. This is my first post in the forum!

I have tried running HeidiSQL under the same setup as goffyara, but with 64-bit Ubuntu instead. Initially, I got the same "cannot find a usable libpq.dll" error. Then I tried running Heidi from the terminal by issuing:

wine heidisql.exe

Then when I tried to connect to the database I actually got the real error message:

err:module:import_dll Library MSVCR120.dll (which is needed by L"C:\\Program Files\\HeidiSQL\\libpq.dll") not found

I found the .dll in question, put it next to the executable file and I was finally able to connect.

That being said, ansgar, is it possible to make the error message more informative? LIBPQ library could not be loaded indeed, but it was because another dependent library was missing. It should be very easy to reproduce the situation under Windows, too.

Code modification/commit b6e1f80 from ansgarbecker, 7 years ago, revision 9.4.0.5146
Attempt to add an error string which Windows provides after a failed call to LoadLibrary. See http://www.heidisql.com/forum.php?t=22514
ansgar's profile image ansgar posted 7 years ago Permalink

So msvcr120.dll is used by libpq.dll? Didn't know that, but well, there are many dependencies from some Windows DLL.

r5146 tries to add the error message which Windows provides after failing to load libpq.dll (and/or libmysql.dll). Probably there is some useful information inside that message. I could however not reproduce the same here.

[expired user #10477]'s profile image [expired user #10477] posted 7 years ago Permalink

It's not only libpq.dll, libeay32.dll and ssleay32.dll also need it. I just didn't copy all the error messages, but I you can see them in Mairu's post above.

Actually, the error I am seeing is actually specific to wine and it is just printing it in the terminal, it is not throwing an exception or something like that.

I have tried r5146, but I still get the generic "missing libpq.dll" message. Bad luck, I guess there would be no way to figure out the real error unless you actually check if msvcr120.dll is missing before loading the rest of the libraries.

Anyway, hopefully all this can be of help to someone else.

Code modification/commit 2a91a13 from Ansgar Becker <anse@heidisql.com>, 5 years ago, revision 10.2.0.5615
Issue #677:
* drop workaround for application crash on WinXP, when loading newer libmariadb (see #79)
* raise TDbLib's own exception instead of baking an own one with less details. Probably helps in debugging: https://www.heidisql.com/forum.php?t=34044
* rename EDatabaseError to EDbError, to overcome naming conflict in DB unit
* load libpq.dll always with path, which should anyway work better than without it. See http://www.heidisql.com/forum.php?t=22514

Please login to leave a reply, or register at first.