Jump to content
Registration disabled at the moment Read more... ×
unitsistemas

libpq.dll found, but not loaded

Recommended Posts

I'm asking for help. When I try to compile a 32-bit executable, in my 32-bit Delphi as well, in my 64-bit operating system, Windows 10 Home Single Language, Version 22H2, an error appears about libpq.dll, saying that it was found, but not loaded. I use Postgres 15.3

Share this post


Link to post

According to a google search that dll can have dependencies. In order to load successfully any dll you have to make sure that all the dependencies can be loaded.  (You can try to find out all the dependencies using the proccess monitor).

 

Dependencies:

  • libpq.dll often depends on other DLLs, such as ssleay32.dll and libeay32.dll (for SSL/TLS encryption), and potentially others like libintl-9.dll (for internationalization).
     
    Open ssl can be also compiled to be dependent on Microsoft Visual C++ Redistributable runtime libraries.
  • Like 1

Share this post


Link to post

I saw that only libintl-9.dll is missing, would that be the problem? And sorry if I didn't understand correctly, but how would I find and download this dll?

Share this post


Link to post

Not actively using PostgreSQL currently but for past use:

 

The PostgreSQL ODBC driver comes in 32-bit and 64-bit versions and uses libpq.dll to connect. It places all the needed files in it's install directories including those it needs form the Microsoft C Runtime Library. 

 

Get the ODBC drivers from https://www.postgresql.org/ftp/odbc/ 

 

For version 15 32-bit only that looks like it would be psqlodbc_15_00_0000-x86.zip from https://www.postgresql.org/ftp/odbc/versions.old/msi/

 

What I would normally do is download the ODBC installer, open a Windows Sandbox, copy and run the installer there. Then look in the appropriate Program Files directory and grab all the needed DLLs from where the ODBC driver was installed. 

Edited by Brian Evans
  • Like 1

Share this post


Link to post
Há 11 minutos, Brian Evans disse:

O driver ODBC do PostgreSQL está disponível nas versões de 32 e 64 bits e usa libpq.dll para se conectar. Ele armazena todos os arquivos necessários em seus diretórios de instalação, incluindo aqueles da Biblioteca de Tempo de Execução C da Microsoft. 

 

Obtenha os drivers ODBC em https://www.postgresql.org/ftp/odbc/ 

 

Somente para a versão 15 de 32 bits, seria psqlodbc_15_00_0000-x86.zip de  https://www.postgresql.org/ftp/odbc/versions.old/msi/

 

I use Windows 10 Home Single Language, it doesn't have Windows Sandbox, should I download something like VirtualBox?

Edited by unitsistemas
I didn't see your edition

Share this post


Link to post

Windows 10 Home version 1903 or later have the Windows Sandbox as an feature that can be enabled.

 

https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/windows-sandbox-install?source=recommendations

 

Not familiar with Windows 10 Home Single Language and if Sandbox is available as a feature. Worth checking using the above instructions.

 

Could also try an archive utility like 7Zip to extract files from the MSI installer. The Postgres ODBC installer just puts all files in one directory for each version (32-bit or 64-bit). 

Edited by Brian Evans

Share this post


Link to post
2 hours ago, unitsistemas said:

I'm asking for help. When I try to compile a 32-bit executable, in my 32-bit Delphi as well, in my 64-bit operating system, Windows 10 Home Single Language, Version 22H2, an error appears about libpq.dll, saying that it was found, but not loaded. I use Postgres 15.3

 

You need the PostgreSQL 32-bit library files and that means you should install PostgreSQL 10.23. You can still get it here:

 

https://get.enterprisedb.com/postgresql/postgresql-10.23-1-windows.exe

 

These are the files you will need to copy from C:\Program Files (x86)\PostgreSQL\10\bin to the same directory as your exe:

 

libssl-1_1.dll
libcrypto-1_1.dll
libiconv-2.dll
libintl-8.dll
libpq.dll

 

And you also need correct version of Microsoft Visual Studio 2013 (VC++ 12.0) C++ Redistributable run-time library. You can download it here:

 

https://aka.ms/highdpimfc2013x86enu

  • Like 1

Share this post


Link to post

Had time to test it and using 32-bit client binaries from a newer PostgreSQL 32-bit ODBC driver version still works. 

 

Tested in a Windows Sandbox with a Delphi test app + binaries from the psqlodbc_15_00_0000-x86 32-bit ODBC driver with postgresql-15.13-3-windows-x64 installed. Test app is just a button that opens a connection and pulls results into a grid.

 

Note clients / client libraries are backwards compatible except for some really old versions. You can use the client binaries from the latest release ODBC driver. Tested this with client binaries from the REL-17_00_0006 32-bit ODBC client and connecting to the 15.13-3 server mentioned above. 

Edited by Brian Evans
  • Like 1

Share this post


Link to post
4 hours ago, Brian Evans said:

Had time to test it and using 32-bit client binaries from a newer PostgreSQL 32-bit ODBC driver version still works. 

For sure. If there are 32-bit binaries from newer versions they will work. I will look into updating the ones I have been using too.

Share this post


Link to post

I managed to solve it now, it was just a connection error in one of the components of my Delphi, I just deleted it and put it back in 😭

but thank you all very much for your help

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×