Re: Why are these modules built without respecting my LDFLAGS?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why are these modules built without respecting my LDFLAGS?
Дата
Msg-id 3903.1277682066@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Why are these modules built without respecting my LDFLAGS?  ("Aaron W. Swenson" <aaron.w.swenson@gmail.com>)
Ответы Re: Why are these modules built without respecting my LDFLAGS?  (Peter Eisentraut <peter_e@gmx.net>)
Re: Why are these modules built without respecting my LDFLAGS?  (Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>)
Список pgsql-hackers
"Aaron W. Swenson" <aaron.w.swenson@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, vizLDFLAGS = switches for linking both executables and shlibsLDFLAGS_EX = extra switches for linking executables
onlyLDFLAGS_SL= extra switches for linking shlibs only
 
Then we could get rid of that untrustworthy hack for extracting -L
switches ...
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Aaron W. Swenson"
Дата:
Сообщение: Re: Why are these modules built without respecting my LDFLAGS?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: pg_dump's checkSeek() seems inadequate