Thread: Re: AWL: PostgreSQL ODBC.
> YES! That's exactly the problem! Relinked with -Bsymbolic (which > necessitates -lc -lm, as well) and all's fine. Thanks. > > In testing on my machine the linking works correctly... > Yup. It doesn't use -Bsymbolic by default. Darn. It was apparently broken when the main Postgres distribution went to this new separate Makefile.shlib. Will look at it, and it should be fixed up in time for the v6.4 release. In the meantime your workaround is the right thing to do, including the "-lc -lm" flags. Sorry for the pain, but it took me two weeks of poking to figure out this "misdirected linking problem", so I'm just spreading the joy around a little bit ;) - Thomas Tom, I'm thinking of putting a "LDFLAGS_ODBC" into the port-specific Makefile, to keep this goofy set of flags separate from other shared libraries. They are necessary because the iodbc driver has _exactly_ the same entry point names as the psqlodbc driver, and the linker preferentially chooses the iodbc ones when resolving links (the setup is that the iodbc generic driver dynamically links in the psqlodbc db-specific one when connecting to a database). So you need to force them beforehand with this flags, at least on Linux.
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu> writes: > Tom, I'm thinking of putting a "LDFLAGS_ODBC" into the port-specific > Makefile, to keep this goofy set of flags separate from other shared > libraries. They are necessary because the iodbc driver has _exactly_ the > same entry point names as the psqlodbc driver, Yipes. I suppose it's far too late to suggest that that convention is guaranteed to create porting problems? > and the linker > preferentially chooses the iodbc ones when resolving links (the setup is > that the iodbc generic driver dynamically links in the psqlodbc > db-specific one when connecting to a database). So you need to force > them beforehand with this flags, at least on Linux. I suspect that some such hackery will be necessary on almost every platform. Maybe you should put LDFLAGS_ODBC into the template files instead of the port makefiles? I've never been real clear on why we have both sets of mechanism... Anyway, I'd suggest making all of the LDFLAGS_SL assignments in Makefile.shlib be += rather than :=, and then the Makefile for the ODBC driver can add on the LDFLAGS_ODBC from wherever we decide to get them. Are there any other hacks besides setting more flags that we are likely to need? regards, tom lane
> > Tom, I'm thinking of putting a "LDFLAGS_ODBC" into the port-specific > > Makefile, > I suspect that some such hackery will be necessary on almost every > platform. Maybe you should put LDFLAGS_ODBC into the template files > instead of the port makefiles? Yes, that's what I meant... > Anyway, I'd suggest making all of the LDFLAGS_SL assignments in > Makefile.shlib be += rather than :=, and then the Makefile for the > ODBC driver can add on the LDFLAGS_ODBC from wherever we decide to > get them. Are there any other hacks besides setting more flags that > we are likely to need? Actually, I don't know why the Makefile.shlib needs anything platform-specific other than perhaps helping with the naming conventions for libraries. If the LDFLAGS_SL was in the platform template then Makefile.shlib wouldn't need anything in that regard, right? > Are there any other hacks besides setting more flags that > we are likely to need? Don't know. That's why they are hacks :)
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu> writes: > Actually, I don't know why the Makefile.shlib needs anything > platform-specific other than perhaps helping with the naming conventions > for libraries. If the LDFLAGS_SL was in the platform template then > Makefile.shlib wouldn't need anything in that regard, right? You're right, much of that stuff could be shoved out into the Makefile.port files. Maybe all of it --- does anyone know GNU Make's substitution rules well enough to know whether shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) can appear *before* NAME and so forth get defined? If so, the library naming rule could be defined by Makefile.port too. I was being conservative when I wrote Makefile.shlib, but I'm not sure that the order of declarations it recommends is really essential. regards, tom lane