Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite9d1560

Browse files
committed
Suppress macOS warnings about duplicate libraries in link commands.
As of Xcode 15 (macOS Sonoma), the linker complains about duplicatereferences to the same library. We see warnings about libpgport andlibpgcommon being duplicated in many client executables. This is aconsequence of the hack introduced in commit6b7ef07 to listlibpgport before libpq while not removing it from $(LIBS).(Commit8396447 later applied the same rule to libpgcommon.)The concern in6b7ef07 was to ensure that the client executablewouldn't unintentionally depend on pgport functions from libpq.That concern is obsolete on any platform for which we can do symbolexport control, because if we can then the pgport functions in libpqwon't be exposed anyway. Hence, we can fix this problem by justremoving libpgport and libpgcommon from $(libpq_pgport), and lettingclients depend on the occurrences in $(LIBS).In the back branches, do that only on macOS (which we know hassymbol export control). In HEAD, let's be more aggressive andremove the extra libraries everywhere. The only still-supportedplatforms that lack export control are MinGW/Cygwin, and itdoesn't seem worth sweating over ABI stability details for those(or if somebody does care, it'd probably be possible to performsymbol export control for those too). As well as being simpler,this might give some microscopic improvement in build time.The meson build system is not changed here, as it doesn't havethis particular disease, though it does have some related issuesthat we'll fix separately.Discussion:https://postgr.es/m/467042.1695766998@sss.pgh.pa.us
1 parente8ccae5 commite9d1560

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

‎src/Makefile.global.in

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,19 +580,32 @@ endif
580580
libpq = -L$(libpq_builddir) -lpq
581581

582582
# libpq_pgport is for use by client executables (not libraries) that use libpq.
583-
# Weforce clients to pull symbols from the non-shared libraries libpgport
583+
# Wewant clients to pull symbols from the non-shared libraries libpgport
584584
# and libpgcommon rather than pulling some libpgport symbols from libpq just
585585
# because libpq uses those functions too. This makes applications less
586-
# dependent on changes in libpq's usage of pgport (on platforms where we
587-
# don't have symbol export control for libpq). To do this we link to
586+
# dependent on changes in libpq's usage of pgport. To do this we link to
588587
# pgport before libpq. This does cause duplicate -lpgport's to appear
589-
# on client link lines, since that also appears in $(LIBS).
588+
# on client link lines, since that also appears in $(LIBS). On platforms
589+
# where we have symbol export control for libpq, the whole exercise is
590+
# unnecessary because libpq won't expose any of these symbols. Currently,
591+
# only macOS warns about duplicate library references, so we only suppress
592+
# the duplicates on macOS.
593+
ifeq ($(PORTNAME),darwin)
594+
libpq_pgport =$(libpq)
595+
else ifdef PGXS
596+
libpq_pgport = -L$(libdir) -lpgcommon -lpgport$(libpq)
597+
else
598+
libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport$(libpq)
599+
endif
600+
590601
# libpq_pgport_shlib is the same idea, but for use in client shared libraries.
602+
# We need those clients to use the shlib variants. (Ideally, users of this
603+
# macro would strip libpgport and libpgcommon from $(LIBS), but no harm is
604+
# done if they don't, since they will have satisfied all their references
605+
# from these libraries.)
591606
ifdefPGXS
592-
libpq_pgport = -L$(libdir) -lpgcommon -lpgport$(libpq)
593607
libpq_pgport_shlib = -L$(libdir) -lpgcommon_shlib -lpgport_shlib$(libpq)
594608
else
595-
libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport$(libpq)
596609
libpq_pgport_shlib = -L$(top_builddir)/src/common -lpgcommon_shlib -L$(top_builddir)/src/port -lpgport_shlib$(libpq)
597610
endif
598611

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp