Re: [HACKERS] pgxs/windows

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <mha(at)sollentuna(dot)net>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] pgxs/windows
Date: 2006-01-19 20:15:06
Message-ID: 200601192015.k0JKF6C08785@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


OK, I found the cause. Using tests from Magnus and Andrew, I could
reproduce Magnus's success and Andrew's failure in an 8.1.2 pginstaller
install using MinGW. The difference between Magnus's and Andrew's is
that Magnus used MODULE_big (which means create a shared library), while
Andrew used MODULES. So, Magnus's only worked because he was creating a
DLL and that brought in the -L from MODULE_big.

I have applied the following patch to change /bin to /lib for Cygwin and
Win32. Looking at Darwin and AIX, both those are pointing to the
postgres binary, so they should be using /bin, so we are OK on those.

I patched CVS HEAD, and 8.1.X and 8.0.X. Earlier releases didn't
support pgxs.

---------------------------------------------------------------------------

Andrew Dunstan wrote:
>
>
> Bruce Momjian wrote:
>
> >>
> >>OK, thanks. Next question --- are the installed file locations the same
> >>for a MinGW install and a pginstaller install? I don't think
> >>pginstaller does a MinGW install because it doesn't have the build
> >>environment in the tarball.
> >>
> >>However, the big difference seems to be that Magnus has -Llib and -Lbin,
> >>while you have only the -Lbin. I have MinGW and pginstaller installed
> >>here. How can I set things up to test this?
> >>
> >>
> >
> >Now looking at the Makefile.global in the 8.1.2 pginstaller install, in
> >Makefile.global, $libdir is set in a pgxs-specific block:
> >
> > libdir := $(shell pg_config --libdir)
> >
> >and that seems to work:
> >
> > C:\Program Files\PostgreSQL\8.1\bin>pg_config --libdir
> > C:/PROGRA~1/POSTGR~1/8.1/lib
> >
> >and that is set to LDFLAGS, which is later propogated to SHLIB_LINK,
> >though SHLIB_LINK moves all the -L flags to the front, so what you see
> >on the link line is not the ordering used to create the value.
> >
> >Andrew, can you try echoing $libdir and $SHLIB_LINK in the Makefile to
> >find those values?
> >
> >
> >
>
> here is a test case log (including a test makefile). I ran the tests as
> you can see with both installer 8.1 and mingw installed CVS tip, with
> the same results.
>
>
> cheers
>
> andrew
>
> $ touch foo.c
> $ cat Makefile
>
> MODULES = foo
> SRCS += foo.c
> OBJS = $(SRCS:.c=.o)
> PGXS := $(shell pg_config --pgxs)
> include $(PGXS)
> override CFLAGS := $(filter-out -Wendif-labels
> -Wdeclaration-after-statement, $(shell pg_config --cflags))
> showme:
> @echo libdir = $(libdir)
> @echo SHLIB_LINK = $(SHLIB_LINK)
> $ which pg_config
> /c/Program Files/PostgreSQL/8.1/bin/pg_config
> $ rm -f foo.dll
> $ make
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
> -fno-strict-aliasing -I. -Ic:/PROGRA~1/POSTGR~1/8.1/include/server
> -Ic:/PROGRA~1/POSTGR~1/8.1/include/internal -I./src/include/port/win32
> -DEXEC_BACKEND -I/mingw/include/krb5
> "-Ic:/PROGRA~1/POSTGR~1/8.1/lib/pgxs/src/MAKEFI~1/../../src/include/port/win32"
> -Ic:/PROGRA~1/POSTGR~1/8.1/include/server/port/win32 -c -o foo.o foo.c
> dlltool --export-all --output-def foo.def foo.o
> dllwrap -o foo.dll --def foo.def foo.o
> c:/PROGRA~1/POSTGR~1/8.1/lib/pgxs/src/MAKEFI~1/../../src/utils/dllinit.o
> -Lc:/PROGRA~1/POSTGR~1/8.1/bin -lpostgres
> c:\mingw\bin\..\lib\gcc-lib\mingw32\3.2.3\..\..\..\..\mingw32\bin\ld.exe:
> cannot find -lpostgres
> c:\mingw\bin\dllwrap.exe: c:\mingw\bin\gcc exited with status 1
> make: *** [foo.dll] Error 1
> rm foo.o
> $ make showme
> libdir = c:/PROGRA~1/POSTGR~1/8.1/lib
> SHLIB_LINK = -Lc:/PROGRA~1/POSTGR~1/8.1/bin -lpostgres
> $ export PATH=/usr/local/pgsql/bin:$PATH
> $ which pg_config
> /usr/local/pgsql/bin/pg_config
> $ rm -f foo.dll
> $ make
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
> -fno-strict-aliasing -I. -IC:/msys/1.0/local/pgsql/include/server
> -IC:/msys/1.0/local/pgsql/include/internal -I./src/include/port/win32
> -DEXEC_BACKEND
> "-IC:/msys/1.0/local/pgsql/lib/pgxs/src/MAKEFI~1/../../src/include/port/win32"
> -IC:/msys/1.0/local/pgsql/include/server/port/win32 -c -o foo.o foo.c
> dlltool --export-all --output-def foo.def foo.o
> dllwrap -o foo.dll --def foo.def foo.o
> C:/msys/1.0/local/pgsql/lib/pgxs/src/MAKEFI~1/../../src/utils/dllinit.o
> -LC:/msys/1.0/local/pgsql/bin -lpostgres
> c:\mingw\bin\..\lib\gcc-lib\mingw32\3.2.3\..\..\..\..\mingw32\bin\ld.exe:
> cannot find -lpostgres
> c:\mingw\bin\dllwrap.exe: c:\mingw\bin\gcc exited with status 1
> make: *** [foo.dll] Error 1
> rm foo.o
> $ make showme
> libdir = C:/msys/1.0/local/pgsql/lib
> SHLIB_LINK = -LC:/msys/1.0/local/pgsql/bin -lpostgres
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-01-19 20:30:41 Re: Indexes vs. cache flushes
Previous Message Michael Paesold 2006-01-19 20:14:23 Re: 8.0.5 Bug in unique indexes?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-01-19 20:33:25 Re: [HACKERS] pgxs/windows
Previous Message David Fetter 2006-01-19 19:48:54 Re: Uninstall scripts for contrib