"Aaron W. Swenson" <aaron.w.swen...@gmail.com> writes: > LDFLAGS and LDFLAGS_SL are exported as environment variables that ./configure > does pick up, and pg_config confirms this. (pg_config also reveals that '--as- > needed' is tacked onto LDFLAGS, which isn't a problem.)
OK, so after some digging I find that, while most of the .so's in our build are made using Makefile.shlib, pgxs's "MODULES" build rules don't use that. Instead they rely on the "%.so: %.o" (and platform-specific variants of that) rules found in src/makefiles/Makefile*. And on most platforms we've neglected to include LDFLAGS_SL in those rules. This seems like an oversight, especially since the one platform that has nonempty LDFLAGS_SL by default (AIX) does include LDFLAGS_SL. This seems like a clear bug. I'm hesitant to back-patch a change like that, but not hesitant to fix it in HEAD. Another thing that I notice is that it's unclear whether a shared-library link should include LDFLAGS too, or only LDFLAGS_SL. On AIX we seem to include both of those flag sets (according to both Makefile.aix and Makefile.shlib) but most other platforms are not including LDFLAGS in shlib link commands. But Makefile.hpux is off in left field, as it includes LDFLAGS but not LDFLAGS_SL. Just to confuse matters even more, Makefile.shlib goes out of its way to pull -L switches (only) out of LDFLAGS and include those into shlib links. Should we try to make that a bit more consistent, and if so how? The shenanigans in Makefile.shlib would get a lot simpler if we said that shlib links always include LDFLAGS *plus* LDFLAGS_SL, but I would think that that would carry substantial risk of breakage. Surely there are cases where linker switches are appropriate for making executables but not shlibs. Perhaps we should set up three variables instead of two, viz LDFLAGS = switches for linking both executables and shlibs LDFLAGS_EX = extra switches for linking executables only LDFLAGS_SL = extra switches for linking shlibs only Then we could get rid of that untrustworthy hack for extracting -L switches ... regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers