Thread: plpgsql compile error on win32
With the latest commits, plpgsql no longer compiles on win32, because of a link failure to pg_strcasecmp(). I fixed this locally by adding "-lpgport" to SHLIB_LINK in the makefile in pl/plpgsql/src, but I'm not sure if that is the correct long-term fix? //Magnus
"Magnus Hagander" <mha@sollentuna.net> writes: > With the latest commits, plpgsql no longer compiles on win32, because of > a link failure to pg_strcasecmp(). That doesn't make any sense. It should resolve it as a function in the backend. Why isn't that happening? regards, tom lane
>> With the latest commits, plpgsql no longer compiles on >win32, because of >> a link failure to pg_strcasecmp(). > >That doesn't make any sense. It should resolve it as a function in the >backend. Why isn't that happening? Dunno... Build output without my fix is: dlltool --export-all --output-def plpgsql.def pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o dllwrap -o libplpgsql.dll --dllname libplpgsql.dll --def plpgsql.def pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o -L../../../../src/port -L../../../../src/backend -lpostgres pl_exec.o(.text+0x2c33):pl_exec.c: undefined reference to `pg_strcasecmp' pl_exec.o(.text+0x2c78):pl_exec.c: undefined reference to `pg_strcasecmp' d:\mingw\bin\dllwrap.exe: d:\mingw\bin\gcc exited with status 1 make: *** [libplpgsql.a] Error 1 pg_strcasecmp is *not* included in libpostgres.a. It is in port/libpgport.a, though. (It's also in postgres.exe, but we don't link against that..) //Magnus
"Magnus Hagander" <mha@sollentuna.net> writes: > pg_strcasecmp is *not* included in libpostgres.a. It is in > port/libpgport.a, though. (It's also in postgres.exe, but we don't link > against that..) What do you mean we don't link against that? There must be hundreds of functions in the main backend that plpgsql.dll needs to call. How is it resolving the rest of them? regards, tom lane
>> pg_strcasecmp is *not* included in libpostgres.a. It is in >> port/libpgport.a, though. (It's also in postgres.exe, but we >don't link >> against that..) > >What do you mean we don't link against that? There must be hundreds of >functions in the main backend that plpgsql.dll needs to call. How is >it resolving the rest of them? > Isn't that what libpostgres.a is used for? (double-checks) Ok. Egg on face. libpostgres.a is just the import library for postgres.exe. I knew that. It just slipped my mind at a bad time. Ok. So the problem is that functions from libpgport aren't included in postgres.def, and thus not in libpostgres.a. It seems that can be fixed with the following patch, which is probably a whole lot close to being right than what I did before: *** Makefile 21 Jul 2004 20:34:44 -0000 1.103 --- Makefile 31 Jul 2004 20:03:08 -0000 *************** *** 66,72 **** rm -f $@.exp $@.base postgres.def: $(OBJS) ! $(DLLTOOL) --export-all --output-def $@ $^ libpostgres.a: postgres.def $(DLLTOOL) --dllname postgres.exe --defpostgres.def --output-lib $@ --- 66,72 ---- rm -f $@.exp $@.base postgres.def: $(OBJS) ! $(DLLTOOL) --export-all --output-def $@ $^ $(top_builddir)/src/port/libpgport.a libpostgres.a: postgres.def $(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@ //Magnus
"Magnus Hagander" <mha@sollentuna.net> writes: > Ok. So the problem is that functions from libpgport aren't included in > postgres.def, and thus not in libpostgres.a. It seems that can be fixed > with the following patch, which is probably a whole lot close to being > right than what I did before: That one feels right to me. Any objections out there? regards, tom lane > *** Makefile 21 Jul 2004 20:34:44 -0000 1.103 > --- Makefile 31 Jul 2004 20:03:08 -0000 > *************** > *** 66,72 **** > rm -f $@.exp $@.base > postgres.def: $(OBJS) > ! $(DLLTOOL) --export-all --output-def $@ $^ > libpostgres.a: postgres.def > $(DLLTOOL) --dllname postgres.exe --def postgres.def > --output-lib $@ > --- 66,72 ---- > rm -f $@.exp $@.base > postgres.def: $(OBJS) > ! $(DLLTOOL) --export-all --output-def $@ $^ > $(top_builddir)/src/port/libpgport.a > libpostgres.a: postgres.def > $(DLLTOOL) --dllname postgres.exe --def postgres.def > --output-lib $@