dylib linking

Jordan K. Hubbard jkh at apple.com
Sat Jun 26 16:42:01 PDT 2010


I'll bet if you flattened the dyld namespace in this particular scenario, this problem would go away.  -flat_namespace is generally not a first recommendation, but if you know what you're doing it has its place.

- Jordan

On Jun 25, 2010, at 10:05 PM, Jeremy Lavergne wrote:

> If you're well-versed in linking, feel free to check out the rest of the email and maybe look at the source code from the pspp-devel port.
> 
> 
> 
> We just fixed a fairly major upstream bug when building PSPP on Mac OS X, but I'm curious if there isn't a pair of knowledgeable eyes that could point out why it happened: the Mac appears to be acting exceptional in this case. I feel it's likely a case of doing it wrong but my insight on linking is limited.
> 
> Thanks for your input!
> 
> Begin forwarded message:
> 
>> Both libpspp.la and libpspp-core.la linked directly against libgl.la, and the UI linked against both libpspp.la and libpspp-core.la.  This works fine on ELF systems, but with Mach-O on Mac OS X it silently causes duplicate symbols at runtime.  In particular there are two different copies of rpl_optarg from libgl.la.  Different code sees different copies of these, which causes a segfault at runtime whenever anyone invokes pspp with an option that takes an argument.
>> 
>> Reported by Jeremy Lavergne <jeremy at lavergne.gotdns.org>, with debugging
>> assistance by Jeremy and by John Darrington.
>> ---
>> src/automake.mk   |    4 +---
>> tests/automake.mk |    4 ++--
>> 2 files changed, 3 insertions(+), 5 deletions(-)
>> 
>> diff --git a/src/automake.mk b/src/automake.mk
>> index cfd3a9f..5226649 100644
>> --- a/src/automake.mk
>> +++ b/src/automake.mk
>> @@ -31,9 +31,7 @@ src_libpspp_la_LIBADD = \
>> 	src/language/liblanguage.la \
>> 	src/math/libpspp-math.la \
>> 	src/output/liboutput.la \
>> -        $(GSL_LIBS) \
>> -	gl/libgl.la
>> -
>> +        $(GSL_LIBS)
>> 
>> include $(top_srcdir)/src/math/automake.mk
>> include $(top_srcdir)/src/output/automake.mk
>> diff --git a/tests/automake.mk b/tests/automake.mk
>> index 699ce5d..f23a0e7 100644
>> --- a/tests/automake.mk
>> +++ b/tests/automake.mk
>> @@ -183,7 +183,7 @@ check_PROGRAMS += \
>> 
>> tests_data_datasheet_test_SOURCES = \
>> 	tests/data/datasheet-test.c
>> -tests_data_datasheet_test_LDADD = gl/libgl.la src/libpspp-core.la $(LIBINTL) 
>> +tests_data_datasheet_test_LDADD = src/libpspp-core.la $(LIBINTL) 
>> tests_data_datasheet_test_CFLAGS = $(AM_CFLAGS)
>> 
>> tests_libpspp_ll_test_SOURCES = \
>> @@ -263,7 +263,7 @@ tests_libpspp_range_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
>> 
>> tests_libpspp_str_test_SOURCES = \
>> 	tests/libpspp/str-test.c
>> -tests_libpspp_str_test_LDADD = src/libpspp/libpspp.la gl/libgl.la $(LIBINTL) 
>> +tests_libpspp_str_test_LDADD = gl/libgl.la src/libpspp/libpspp.la $(LIBINTL) 
>> 
>> tests_libpspp_string_map_test_SOURCES = \
>> 	src/libpspp/hash-functions.c \
>> -- 
>> 1.7.1
>> 
>> 
>> -- 
>> "Sanity is not statistical."
>> --George Orwell
>> 
>> _______________________________________________
>> pspp-dev mailing list
>> pspp-dev at gnu.org
>> http://lists.gnu.org/mailman/listinfo/pspp-dev
> 
> _______________________________________________
> macports-dev mailing list
> macports-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev



More information about the macports-dev mailing list