Thread: Libpq.dll: File not recognized
Hi all, I downloaded the "one-click" installer for PostgreSQL 9.0 beta2 for Windows= x64 (postgresql-9.0.0-beta2-windows-x64.exe) and installed it on my Window= s 7 64 bit system. Installation seemed to go off without a hitch, but when = I tried to link to libpq in my project I received the following error. C:\Program Files\PostgreSQL\lib/libpq.dll: file not recognized: File fo= rmat not recognized collect2: ld returned 1 exit status I originally thought that this might have something to do with the use of d= ifferent compilers/linkers (compiler/linker that I am using compared to the= one used with to build libpq), but now Im not so sure. Some system info..... OS: Windows 7 64-bit MSYS ver: 1.0.14 MinGW ver: 4.5.0 Make ver: GNU make 3.81 If it matters ..... My IDE is Eclipse Galileo and I am compiling my project= using the MinGW toolchain. Regards Bidski
On 06/30/10 3:23 PM, Bidski wrote: > Hi all, > I downloaded the "one-click" installer for PostgreSQL 9.0 beta2 for > Windows x64 (postgresql-9.0.0-beta2-windows-x64.exe) and installed it > on my Windows 7 64 bit system. Installation seemed to go off without a > hitch, but when I tried to link to libpq in my project I received the > following error. > > C:\Program Files\PostgreSQL\lib/libpq.dll: file not recognized: > File format not recognized > > collect2: ld returned 1 exit status > > I originally thought that this might have something to do with the use > of different compilers/linkers (compiler/linker that I am using > compared to the one used with to build libpq), but now Im not so sure. > > Some system info..... > > OS: Windows 7 64-bit > > MSYS ver: 1.0.14 > > MinGW ver: 4.5.0 > > Make ver: GNU make 3.81 > > If it matters ..... My IDE is Eclipse Galileo and I am compiling my > project using the MinGW toolchain. > > wild guess says your project is 64 bit, but libpq.dll is 32 bit.
John R Pierce <pierce@hogranch.com> writes: > wild guess says your project is 64 bit, but libpq.dll is 32 bit. Why would there be a 32bit dll in the 64bit pre-built package? Regards Bidski -------------------------------------------------- From: "John R Pierce" <pierce@hogranch.com> Sent: Thursday, July 01, 2010 8:34 AM To: <pgsql-bugs@postgresql.org> Subject: Re: [BUGS] Libpq.dll: File not recognized > On 06/30/10 3:23 PM, Bidski wrote: >> Hi all, >> I downloaded the "one-click" installer for PostgreSQL 9.0 beta2 for >> Windows x64 (postgresql-9.0.0-beta2-windows-x64.exe) and installed it >> on my Windows 7 64 bit system. Installation seemed to go off without a >> hitch, but when I tried to link to libpq in my project I received the >> following error. >> >> C:\Program Files\PostgreSQL\lib/libpq.dll: file not recognized: >> File format not recognized >> >> collect2: ld returned 1 exit status >> >> I originally thought that this might have something to do with the use >> of different compilers/linkers (compiler/linker that I am using >> compared to the one used with to build libpq), but now Im not so sure. >> >> Some system info..... >> >> OS: Windows 7 64-bit >> >> MSYS ver: 1.0.14 >> >> MinGW ver: 4.5.0 >> >> Make ver: GNU make 3.81 >> >> If it matters ..... My IDE is Eclipse Galileo and I am compiling my >> project using the MinGW toolchain. >> >> > > wild guess says your project is 64 bit, but libpq.dll is 32 bit. > > > > > > -- > Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-bugs >
On 06/30/10 3:40 PM, Bidski wrote: > John R Pierce <pierce@hogranch.com> writes: >> wild guess says your project is 64 bit, but libpq.dll is 32 bit. > > Why would there be a 32bit dll in the 64bit pre-built package? look and see if there's another /lib64/ or similar directory ? I didn't notice earlier that you are running the postgres 9 beta.
John R Pierce <pierce@hogranch.com> writes: > look and see if there's another /lib64/ or similar directory ? Nope, no lib64 directory or anything like that, just lib directory. > I didn't notice earlier that you are running the postgres 9 beta. Yep, Im running PostgreSQL 9.0 beta2 Regards Bidski
On Wed, Jun 30, 2010 at 11:23 PM, Bidski <bidski@bigpond.net.au> wrote: > Hi all, > > I downloaded the "one-click" installer for PostgreSQL 9.0 beta2 for Windo= ws > x64 (postgresql-9.0.0-beta2-windows-x64.exe) and installed it on my Windo= ws > 7 64 bit system. Installation seemed to go off without a hitch, but when I > tried to link to libpq in my project I received the following error. > > > =A0=A0=A0=A0C:\Program Files\PostgreSQL\lib/libpq.dll: file not recognize= d: File > format not recognized Don't link against the DLL, link against the .lib. > Some system info..... > > OS: Windows 7 64-bit > > MSYS ver: 1.0.14 > > MinGW ver: 4.5.0 > > Make ver: GNU make 3.81 > > If it matters ..... My IDE is Eclipse Galileo and I am compiling my proje= ct > using the MinGW toolchain. The server is built with VC++ 2008 - I have no idea if Mingw can use 64bit VC++ libraries. --=20 Dave Page EnterpriseDB UK: http://www.enterprisedb.com The Enterprise Postgres Company
"Dave Page" <dpage@pgadmin.org> writes: > Don't link against the DLL, link against the .lib. Isnt the .lib the static library and the dll the shared library? And Im not linking against the dll specifically, that is the library that g++ is wanting to link to. My link command is g++ -Wl,--enable-auto-import -o"MRP.exe" ./src/DB.o ./src/catlist.o ./src/inventory.o ./src/mrp_app.o ./src/mrp_frame.o ./res/resources.rc.o -lpq -L"C:\MinGW\lib" -L"C:\Program Files\PostgreSQL\lib" -mwindows `wx-config --libs base,core,adv,xrc` > The server is built with VC++ 2008 - I have no idea if Mingw can use > 64bit VC++ libraries. I also have no idea for certain, but I should think so. My understanding of the whole thing is that a DLL made for windows should be linkable to any windows application regardless of compiler/linker, if its not then what is the point? Regards Bidski
On Thu, Jul 1, 2010 at 9:00 AM, Bidski <bidski@bigpond.net.au> wrote: > "Dave Page" <dpage@pgadmin.org> writes: >> >> Don't link against the DLL, link against the .lib. > > Isnt the .lib the static library and the dll the shared library? No, it should be the import library for the DLL. > And Im not > linking against the dll specifically, that is the library that g++ is > wanting to link to. My link command is > > =A0 g++ -Wl,--enable-auto-import -o"MRP.exe" =A0./src/DB.o ./src/catlist.o > ./src/inventory.o ./src/mrp_app.o ./src/mrp_frame.o ./res/resources.rc.o > -lpq -L"C:\MinGW\lib" -L"C:\Program Files\PostgreSQL\lib" -mwindows > `wx-config --libs base,core,adv,xrc` That looks right - and should be looking for the .lib (or a .a) as you just have -lpq. Should there be a -m64 in there though? Try compiling a test program and verify that you actually are getting 64 bit output. >> The server is built with VC++ 2008 - I have no idea if Mingw can use >> 64bit VC++ libraries. > > I also have no idea for certain, but I should think so. My understanding = of > the whole thing is that a DLL made for windows should be linkable to any > windows application regardless of compiler/linker, if its not then what is > the point? The DLLs should be portable, but the import library might not be. I vaguely recall that VC++ cannot use a Mingw import library - though you can fairly easily create a compatible library from the incompatible one. I don't recall the details though - Google is your friend. --=20 Dave Page EnterpriseDB UK: http://www.enterprisedb.com The Enterprise Postgres Company