GNOME Bugzilla – Bug 461838
Fails to build on Mac OS X i686 with multiply defined symbols
Last modified: 2008-06-26 14:57:33 UTC
Using Apple's GCC and MacPort's gstreamer: $ gcc -v Using built-in specs. Target: i686-apple-darwin8 Configured with: /private/var/tmp/gcc/gcc-5367.obj~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --with-arch=nocona --with-tune=generic --program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8 Thread model: posix gcc version 4.0.1 (Apple Computer, Inc. build 5367) $ port installed [...] gstreamer @0.10.13_0 [...] building fails with the following: gcc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/_gst.so -bundle .libs/_gst_la-gst-argtypes.o .libs/_gst_la-gstmodule.o .libs/_gst_la-pygstiterator.o .libs/_gst_la-pygstminiobject.o .libs/_gst_la-pygstvalue.o .libs/_gst_la-pygstexception.o .libs/_gst_la-gst.o -L/opt/local/lib /opt/local/lib/libgstcontroller-0.10.dylib /opt/local/lib/libz.dylib /opt/local/lib/libgstnet-0.10.dylib /opt/local/lib/libgstdataprotocol-0.10.dylib /opt/local/lib/libgstbase-0.10.dylib /opt/local/lib/libgstreamer-0.10.dylib /opt/local/lib/libgobject-2.0.dylib /opt/local/lib/libgmodule-2.0.dylib /opt/local/lib/libgthread-2.0.dylib /opt/local/lib/libxml2.dylib -lpthread -lz -lm /opt/local/lib/libglib-2.0.dylib /opt/local/lib/libintl.dylib /opt/local/lib/libiconv.dylib /usr/bin/ld: multiple definitions of symbol _PyGstIterator_Type .libs/_gst_la-gst-argtypes.o definition of _PyGstIterator_Type in section (__DATA,__common) .libs/_gst_la-gstmodule.o definition of _PyGstIterator_Type in section (__DATA,__common) /usr/bin/ld: multiple definitions of symbol __PyGObject_API .libs/_gst_la-gst-argtypes.o definition of __PyGObject_API in section (__DATA,__common) .libs/_gst_la-gstmodule.o definition of __PyGObject_API in section (__DATA,__common) .libs/_gst_la-pygstiterator.o definition of _PyGstIterator_Type in section (__DATA,__data) .libs/_gst_la-pygstiterator.o definition of __PyGObject_API in section (__DATA,__common) .libs/_gst_la-pygstminiobject.o definition of _PyGstIterator_Type in section (__DATA,__common) .libs/_gst_la-pygstminiobject.o definition of __PyGObject_API in section (__DATA,__common) .libs/_gst_la-pygstvalue.o definition of _PyGstIterator_Type in section (__DATA,__common) .libs/_gst_la-pygstvalue.o definition of __PyGObject_API in section (__DATA,__common) .libs/_gst_la-gst.o definition of _PyGstIterator_Type in section (__DATA,__common) .libs/_gst_la-gst.o definition of __PyGObject_API in section (__DATA,__common) collect2: ld returned 1 exit status make[3]: *** [_gst.la] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 If I add "-multiply_defined suppress" to LDFLAGS, building fails with the following: gcc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/_gst.so -bundle .libs/_gst_la-gst-argtypes.o .libs/_gst_la-gstmodule.o .libs/_gst_la-pygstiterator.o .libs/_gst_la-pygstminiobject.o .libs/_gst_la-pygstvalue.o .libs/_gst_la-pygstexception.o .libs/_gst_la-gst.o -L/opt/local/lib /opt/local/lib/libgstcontroller-0.10.dylib /opt/local/lib/libz.dylib /opt/local/lib/libgstnet-0.10.dylib /opt/local/lib/libgstdataprotocol-0.10.dylib /opt/local/lib/libgstbase-0.10.dylib /opt/local/lib/libgstreamer-0.10.dylib /opt/local/lib/libgobject-2.0.dylib /opt/local/lib/libgmodule-2.0.dylib /opt/local/lib/libgthread-2.0.dylib /opt/local/lib/libxml2.dylib -lpthread -lz -lm /opt/local/lib/libglib-2.0.dylib /opt/local/lib/libintl.dylib /opt/local/lib/libiconv.dylib -multiply_defined i686-apple-darwin8-gcc-4.0.1: .libs/_gst.so: No such file or directory make[3]: *** [_gst.la] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 I assume a "./configure && make" would suffice to build most libraries, but that doesn't seem to be the case here. I'm not entirely sure if it's an error in gst-python, or an error in how I'm building gst-python. In any case, I'll attach logs for "./configure" and "make", for both with and without using "-multiply_defined suppress" Also, this is with gst-python-0.10.7, but the exact same errors occur with the version in CVS -- if I let it build despite compiler warnings, that is.
Created attachment 92716 [details] ./configure, without -multiply_defined suppress
Created attachment 92717 [details] make, without -multiply_defined suppress
Created attachment 92718 [details] ./configure, with -multiply_defined suppress
Created attachment 92719 [details] make, with -multiply_defined suppress
If you look at the configure script, you'll see that how it treats multiply defined symbols depends on the environment variable MACOSX_DEPLOYMENT_TARGET. Try setting that to 10.2 or 10.3. If it isn't set, you can end up with configure assuming an inappropriate default value there.
I can confirm the same thing happens with gst-python 0.10.9 built against gstreamer 0.10.15, the latter built from stock sources (not a MacPort). I can solve the multiple references to PyGstIterator_Type with a simple patch (attached), that symbol really is defined multiple times and the build probably works on ELF targets only because of some libtool magic.
Created attachment 100897 [details] [review] Partial fix for build issues on Mac OS X
I can confirm this on Mac OS X 10.5.1, also with GStreamer from MacPorts. The build error is a little different: it only reports __PyGObject_API as a duplicate symbol. Relevant version info: Mac OS X 10.5.1 GCC 4.0.1 (Apple Inc. build 5465) Python 2.5.1_4+darwin_9 (MacPorts) GStreamer 0.10.14_0 (MacPorts)
Created attachment 103278 [details] ./configure with GStreamer 0.10.14 Output of './configure --prefix=/opt/local'
Created attachment 103279 [details] make with GStreamer 0.10.14 Output of 'make'
> Created an attachment (id=100897) [edit] > Partial fix for build issues on Mac OS X I tried this with my uninstalled gstreamer CVS tree (on ubuntu gutsy). Even though this patch looks right, it seems to make one of the unit tests fail. No idea why though (haven't looked into it futher).
just marking the patch as already commited.
Tricky one to find but very few lines in the end. 2008-06-26 Edward Hervey <edward.hervey@collabora.co.uk> * gst/common.h: * gst/gstmodule.c: * gst/interfaces.override: * gst/pbutils.override: * gst/pygstiterator.c: * gst/pygstminiobject.c: * gst/pygstminiobject.h: Fix double-import issues on macosx. Fixes #461838