"Aaron W. Swenson" <aaron(dot)w(dot)swenson(at)gmail(dot)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
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
regards, tom lane
In response to
pgsql-hackers by date
|Next:||From: Robert Haas||Date: 2010-06-28 00:42:43|
|Subject: Re: pg_dump's checkSeek() seems inadequate|
|Previous:||From: Aaron W. Swenson||Date: 2010-06-27 22:38:09|
|Subject: Re: Why are these modules built without respecting my LDFLAGS?|