Thread: Compiling under MSYS and Windows 7
C:\Program Files\PostgreSQL\bin/libpq.dll: file not recognized: File format not recognized
collect2: ld returned 1 exit status
I thought this might have something to do with different compiler/linker versions (compiler/linker that Im using compared to the compiler/linker used to build libpq). So naturally I set off on the task of building my own version of PostgreSQL from source. However this just opened up a whole new can of worms and I am quickly running out of pesticide.
I downloaded a copy of the source, unpacked it into a directory and had a quick look at the possible configure options (./configure --help) just to see if anything specific caught my eye. The only thing I saw was --with-gnu-ld. So I ran configure in the postgresql src root directory as ./configure --with-gnu-ld --prefix=/mingw. I got as far as the zlib checks when configure told me that I didnt have zlib installed (a quick look at my files confirmed this), so I went to www.zlib.net and downloaded version 1.2.5 (this appears to be the latest), I then built and installed this. Running configure again (with the same options) gave me a wonderful error.
configure: error: zlib version is too old
Use --without-zlib to disable zlib support.
How can the latest version be too old????? Seeing this, I uninstalled that version and went in search of other versions. The versions I found may not have been newer (may have been older) but I tried them anyways, all with the same results, apparently all versions were too old. The other versions I found were on the MinGW/MSYS download site, I tried the most recent versions listed on there.
Faced with that, I then changed my configure line to be ./configure --prefix=/mingw --with-gnu-ld --without-zlib (who needs zlib anyways, right?). Now I was thinking that surely this would be the end of it and I would soon have a fully built version of PostgreSQL ........ sadly not. I now get this error.
checking for atexit... yes
checking test program... failed
configure: error:
Could not execute a simple test program. This may be a problem
related to locating shared libraries. Check the file 'config.log'
for the exact reason.
And now I have no idea. I had a look at config.log and to find this.
configure:21835: checking for atexit
configure:21891: gcc -qlanglvl=extc89 -o conftest.exe -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -I./src/include/port/win32 -DEXEC_BACKEND -Wl,--allow-multiple-definition conftest.c >&5
gcc.exe: unrecognized option '-qlanglvl=extc89'
configure:21898: $? = 0
configure:21920: result: yes
configure:23234: checking test program
configure:23254: gcc -qlanglvl=extc89 -o conftest.exe -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -I./src/include/port/win32 -DEXEC_BACKEND -Wl,--allow-multiple-definition conftest.c >&5
gcc.exe: unrecognized option '-qlanglvl=extc89'
configure:23258: $? = 0
configure:23264: ./conftest.exe
./configure: line 23266: ./conftest.exe: Invalid argument
configure:23268: $? = 126
configure: program exited with status 126
configure: failed program was:
Having a look at line 23266 of configure and Im lost (never could understand those things).
Can anyone tell me what is going on here?
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.
If you need any more info just let me know.
Regards
Bidski
"Bidski" <bidski@bigpond.net.au> writes: > Can anyone tell me what is going on here? It seems like you have a pretty nonfunctional build environment :-( I'm not sure that mingw can be expected to work in 64-bit windows. The bit with the original libpq.dll not being recognizable might be worth reporting as a bug. PG's support for 64-bit windows is itself pretty wet behind the ears, so maybe there's a real problem there. The other stuff looks like problems with your toolchain to me. regards, tom lane
"Tom Lane" <tgl@sss.pgh.pa.us> writes: > It seems like you have a pretty nonfunctional build environment :-( > I'm not sure that mingw can be expected to work in 64-bit windows. I have successfully built other libraries/packages (wxWidgets, xerces-c, boost) using this toolchain, so I believe that it is working but maybe PostgreSQL wants something that the others didnt? Can you suggest anything to try, short of making a new toolchain? Ill post the original libpq.dll problem to the bugs list now. Regards Bidski -------------------------------------------------- From: "Tom Lane" <tgl@sss.pgh.pa.us> Sent: Thursday, July 01, 2010 2:55 AM To: "Bidski" <bidski@bigpond.net.au> Cc: <pgsql-novice@postgresql.org> Subject: Re: [NOVICE] Compiling under MSYS and Windows 7 > "Bidski" <bidski@bigpond.net.au> writes: >> Can anyone tell me what is going on here? > > > The bit with the original libpq.dll not being recognizable might be > worth reporting as a bug. PG's support for 64-bit windows is itself > pretty wet behind the ears, so maybe there's a real problem there. > The other stuff looks like problems with your toolchain to me. > > regards, tom lane >
"Bidski" <bidski@bigpond.net.au> writes: > "Tom Lane" <tgl@sss.pgh.pa.us> writes: >> It seems like you have a pretty nonfunctional build environment :-( >> I'm not sure that mingw can be expected to work in 64-bit windows. > I have successfully built other libraries/packages (wxWidgets, xerces-c, > boost) using this toolchain, so I believe that it is working but maybe > PostgreSQL wants something that the others didnt? Sorry, no idea, I don't do Windows. The folks who might be able to comment on that probably aren't reading -novice --- you might try asking on pgsql-general. It occurs to me that this might not be entirely independent of the fact that you can't make the prebuilt .dll work for you, either. But I'd just be guessing about that. regards, tom lane