]> granicus.if.org Git - gc/commit
Fix 'duplicate symbol' error for tests using multiple static libs (OS X)
authorIvan Maidanski <ivmai@mail.ru>
Tue, 26 Feb 2019 21:48:12 +0000 (00:48 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 27 Feb 2019 08:43:53 +0000 (11:43 +0300)
commit7c5992de50ffb1f805b9b62c2176a9e9d8c8286d
tree5b4a74ad95d5d902804323f700c1cd56c9b13e8e
parente6a30a35c6db454268e40ce94ddd1dff6c23ffd6
Fix 'duplicate symbol' error for tests using multiple static libs (OS X)

Issue #263 (bdwgc).

If configured with --enable-static, libtool passes libgc.a to gcc
twice (with a relative path and with an absolute one) when linking
tests that depend on libcord.a, libgccpp.a or libstaticrootslib_test.a
which, in turn, depends on libgc.a.  Double specification of libgc.a
seems to confuse ld tool of MacOS 10.14.

The workaround is to omit libgc.la in *_LDADD specification of the
mentioned tests when the shared libraries are not requested, at least.

* configure.ac (ENABLE_SHARED): New AM_CONDITIONAL.
* cord/cord.am (cordtest_LDADD): Do not add libgc.la unless
ENABLE_SHARED; add comment.
* tests/tests.am (staticrootstest_LDADD): Likewise.
* tests/tests.am [CPLUSPLUS && !AVOID_CPP_LIB] (test_cpp_LDADD):
Likewise.
configure.ac
cord/cord.am
tests/tests.am