After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639039 - gobject-introspection: GstPbutils gir scanner fails to link with gold linker
gobject-introspection: GstPbutils gir scanner fails to link with gold linker
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal blocker
: 0.10.32
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-09 06:15 UTC by brofkims
Modified: 2011-01-11 15:04 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description brofkims 2011-01-09 06:15:16 UTC
1. Gst-plugin-base-0.10.31.2 as of latest git source cannot be built on developmental Ubuntu 11.04(natty) with gcc-4.5.2 and binutils-2.21.
The behavioure of Gcc-4.5.x is different from previous versions, ie., It directly tries to link binary against necessary libraries.

2. I failed to link Pbutils-0.10.0 against libgstreamer-0.10.so, and the build process of gst-plugins-base-0.10.31.2 aborts. Error messsages are as follows:

 libtool: link: ( cd ".libs" && rm -f "libgstpbutils-0.10.la" && ln -s "../libgstpbutils-0.10.la" "libgstpbutils-0.10.la" )
PKG_CONFIG_PATH="../../../pkgconfig" \
		/usr/bin/g-ir-scanner -v --namespace GstPbutils \
		--nsversion=0.10 \
		--strip-prefix=Gst \
		--c-include='gst/pbutils/pbutils.h' --c-include='gst/pbutils/codec-utils.h' --c-include='gst/pbutils/descriptions.h' --c-include='gst/pbutils/encoding-profile.h' --c-include='gst/pbutils/encoding-target.h' --c-include='gst/pbutils/install-plugins.h' --c-include='gst/pbutils/missing-plugins.h' --c-include='gst/pbutils/gstdiscoverer.h' --c-include='gst/pbutils/gstpluginsbaseversion.h' --c-include='gst/pbutils/pbutils-enumtypes.h' \
		-I../../../gst-libs \
		-I../../../gst-libs \
		--add-include-path=./../video \
		--add-include-path=`/usr/bin/pkg-config --variable=girdir gstreamer-0.10` \
		--library=libgstpbutils-0.10.la \
		--include=Gst-0.10 \
		--libtool="../../../libtool" \
		--pkg gstreamer-0.10 \
		--pkg gstreamer-video-0.10 \
		--pkg-export gstreamer-pbutils-0.10 \
		--add-init-section="gst_init(NULL,NULL);" \
		--output GstPbutils-0.10.gir \
		./pbutils.h ./codec-utils.h ./descriptions.h ./encoding-profile.h ./encoding-target.h ./install-plugins.h ./missing-plugins.h ./gstdiscoverer.h ./gstpluginsbaseversion.h ./pbutils-enumtypes.h \
		./gstpluginsbaseversion.c ./pbutils.c ./codec-utils.c ./descriptions.c ./encoding-profile.c ./encoding-target.c ./install-plugins.c ./missing-plugins.c ./gstdiscoverer.c ./gstdiscoverer-types.c ./pbutils-enumtypes.c ./pbutils-marshal.c
g-ir-scanner: warning: Option --strip-prefix has been deprecated;
see --identifier-prefix and --symbol-prefix.
g-ir-scanner: compile: gcc -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -g -Wall -O2 -Wno-error -I../../../gst-libs -I../../../gst-libs -I/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gstreamer-0.10 -I/usr/include/libxml2 -c -o /home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/tmp-introspect2AEHMr/GstPbutils-0.10.o /home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/tmp-introspect2AEHMr/GstPbutils-0.10.c
/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/tmp-introspect2AEHMr/GstPbutils-0.10.c: In function ‘main’:
/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/tmp-introspect2AEHMr/GstPbutils-0.10.c:501:3: warning: implicit declaration of function ‘gst_init’
g-ir-scanner: link: ../../../libtool --mode=link --tag=CC --silent gcc -o /home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/tmp-introspect2AEHMr/GstPbutils-0.10 -export-dynamic -g -O2 -g -Wall -O2 -Wno-error -L. libgstpbutils-0.10.la -pthread -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 /home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/tmp-introspect2AEHMr/GstPbutils-0.10.o
/usr/bin/ld.bfd.real: /home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/tmp-introspect2AEHMr/GstPbutils-0.10.o: undefined reference to symbol 'gst_init'
/usr/bin/ld.bfd.real: note: 'gst_init' is defined in DSO /usr/lib64/libgstreamer-0.10.so.0 so try adding it to the linker command line
/usr/lib64/libgstreamer-0.10.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
linking of temporary binary failed: Command '['../../../libtool', '--mode=link', '--tag=CC', '--silent', 'gcc', '-o', '/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/tmp-introspect2AEHMr/GstPbutils-0.10', '-export-dynamic', '-g', '-O2', '-g', '-Wall', '-O2', '-Wno-error', '-L.', 'libgstpbutils-0.10.la', '-pthread', '-lgio-2.0', '-lgobject-2.0', '-lgmodule-2.0', '-lgthread-2.0', '-lrt', '-lglib-2.0', '/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/tmp-introspect2AEHMr/GstPbutils-0.10.o']' returned non-zero exit status 1
make[6]: *** [GstPbutils-0.10.gir] error 1
make[6]: Leaving directory `/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils'
make[5]: *** [all] error 2
make[5]: Leaving directory `/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils'
make[4]: *** [all-recursive] error 1
make[4]: Leaving directory `/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst'
make[3]: *** [all-recursive] error 1
make[3]: Leaving directory `/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs'
make[2]: *** [all-recursive] error 1
make[2]: Leaving directory `/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig'
make[1]: *** [all] error 2
make[1]: Leaving directory `/home/brofkims/build/gst-plugins-base0.10-0.10.31.2+git20110108.orig'
make: *** [debian/stamp-makefile-build] error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2

3. I successfully built gst-plugins-base-0.10.31.2 after patching gst-libs/gst/pbutils/Makefile.{am,in} as follows:

changes:

added '--library=gstreamer-0.10' to gst-libs/gst/pbutils/Makefile.am and '@HAVE_INTROSPECTION_TRUE@               --library=gstreamer-0.10' to gst-libs/gst/pbutils/Makefile.in to link binary against libgstreamer-0.10.so

patch:

diff -urN gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/Makefile.am gst-plugins-base0.10-0.10.31.2+git20110108/gst-libs/gst/pbutils/Makefile.am
--- gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/Makefile.am    2011-01-09 14:47:18.000000000 +0900
+++ gst-plugins-base0.10-0.10.31.2+git20110108/gst-libs/gst/pbutils/Makefile.am 2011-01-09 00:48:20.000000000 +0900
@@ -85,6 +85,7 @@
                --add-include-path=$(srcdir)/../video \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-0.10` \
                --library=libgstpbutils-0.10.la \
+               --library=gstreamer-0.10 \
                --include=Gst-0.10 \
                --libtool="$(top_builddir)/libtool" \
                --pkg gstreamer-0.10 \
diff -urN gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/Makefile.in gst-plugins-base0.10-0.10.31.2+git20110108/gst-libs/gst/pbutils/Makefile.in
--- gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/Makefile.in    2011-01-09 14:46:55.000000000 +0900
+++ gst-plugins-base0.10-0.10.31.2+git20110108/gst-libs/gst/pbutils/Makefile.in 2011-01-09 00:40:23.000000000 +0900
@@ -1116,6 +1116,7 @@
 @HAVE_INTROSPECTION_TRUE@              --add-include-path=$(srcdir)/../video \
 @HAVE_INTROSPECTION_TRUE@              --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-0.10` \
 @HAVE_INTROSPECTION_TRUE@              --library=libgstpbutils-0.10.la \
+@HAVE_INTROSPECTION_TRUE@              --library=gstreamer-0.10 \
 @HAVE_INTROSPECTION_TRUE@              --include=Gst-0.10 \
 @HAVE_INTROSPECTION_TRUE@              --libtool="$(top_builddir)/libtool" \
 @HAVE_INTROSPECTION_TRUE@              --pkg gstreamer-0.10 \
Comment 1 Sebastian Dröge (slomo) 2011-01-09 12:58:23 UTC
I can confirm this with latest GIT and the patch fixes the failure but this still keeps

  GEN    GstPbutils-0.10.gir
/home/slomo/projects/gstreamer/head/gst-plugins-base/gst-libs/gst/pbutils/tmp-introspecteEefFY/GstPbutils-0.10.c: In function ‘main’:
/home/slomo/projects/gstreamer/head/gst-plugins-base/gst-libs/gst/pbutils/tmp-introspecteEefFY/GstPbutils-0.10.c:20:3: warning: implicit declaration of function ‘gst_init’


Something has to include gst/gst.h here
Comment 2 brofkims 2011-01-09 14:45:49 UTC
I changed gst_init(NULL,NULL) to gst_init(&argc,&argv) in gst-libs/gst/pbutils/Makefile.{am,in} as a try, then warnings above doesn't appear any more.
This instance is also in docs/libs/Makefile.in.
Here is a unified patch.

diff -urN gst-plugins-base0.10-0.10.31.2+git20110108.orig/docs/libs/Makefile.in gst-plugins-base0.10-0.10.31.2+git20110108/docs/libs/Makefile.in
--- gst-plugins-base0.10-0.10.31.2+git20110108.orig/docs/libs/Makefile.in       2011-01-08 16:07:26.000000000 +0900
+++ gst-plugins-base0.10-0.10.31.2+git20110108/docs/libs/Makefile.in    2011-01-09 23:19:23.000000000 +0900
@@ -816,7 +816,7 @@
 @ENABLE_GTK_DOC_TRUE@      CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"                         \
 @ENABLE_GTK_DOC_TRUE@      CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)"                         \
 @ENABLE_GTK_DOC_TRUE@      LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)"                         \
-@ENABLE_GTK_DOC_TRUE@      gtkdoc-scangobj --type-init-func="gst_init(NULL,NULL)"      \
+@ENABLE_GTK_DOC_TRUE@      gtkdoc-scangobj --type-init-func="gst_init(&argc,&argv)"    \
 @ENABLE_GTK_DOC_TRUE@          --module=$(DOC_MODULE) ;                                \
 @ENABLE_GTK_DOC_TRUE@  else                                                            \
 @ENABLE_GTK_DOC_TRUE@      for i in $(SCANOBJ_FILES) ; do                              \
diff -urN gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/Makefile.am gst-plugins-base0.10-0.10.31.2+git20110108/gst-libs/gst/pbutils/Makefile.am
--- gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/Makefile.am    2011-01-09 14:47:18.000000000 +0900
+++ gst-plugins-base0.10-0.10.31.2+git20110108/gst-libs/gst/pbutils/Makefile.am 2011-01-09 22:40:44.000000000 +0900
@@ -85,12 +85,13 @@
                --add-include-path=$(srcdir)/../video \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-0.10` \
                --library=libgstpbutils-0.10.la \
+               --library=gstreamer-0.10 \
                --include=Gst-0.10 \
                --libtool="$(top_builddir)/libtool" \
                --pkg gstreamer-0.10 \
                --pkg gstreamer-video-@GST_MAJORMINOR@ \
                --pkg-export gstreamer-pbutils-@GST_MAJORMINOR@ \
-               --add-init-section="gst_init(NULL,NULL);" \
+               --add-init-section="gst_init(&argc,&argv);" \
                --output $@ \
                $(gir_headers) \
                $(gir_sources)
diff -urN gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/Makefile.in gst-plugins-base0.10-0.10.31.2+git20110108/gst-libs/gst/pbutils/Makefile.in
--- gst-plugins-base0.10-0.10.31.2+git20110108.orig/gst-libs/gst/pbutils/Makefile.in    2011-01-09 14:46:55.000000000 +0900
+++ gst-plugins-base0.10-0.10.31.2+git20110108/gst-libs/gst/pbutils/Makefile.in 2011-01-09 22:41:11.000000000 +0900
@@ -1116,12 +1116,13 @@
 @HAVE_INTROSPECTION_TRUE@              --add-include-path=$(srcdir)/../video \
 @HAVE_INTROSPECTION_TRUE@              --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-0.10` \
 @HAVE_INTROSPECTION_TRUE@              --library=libgstpbutils-0.10.la \
+@HAVE_INTROSPECTION_TRUE@              --library=gstreamer-0.10 \
 @HAVE_INTROSPECTION_TRUE@              --include=Gst-0.10 \
 @HAVE_INTROSPECTION_TRUE@              --libtool="$(top_builddir)/libtool" \
 @HAVE_INTROSPECTION_TRUE@              --pkg gstreamer-0.10 \
 @HAVE_INTROSPECTION_TRUE@              --pkg gstreamer-video-@GST_MAJORMINOR@ \
 @HAVE_INTROSPECTION_TRUE@              --pkg-export gstreamer-pbutils-@GST_MAJORMINOR@ \
-@HAVE_INTROSPECTION_TRUE@              --add-init-section="gst_init(NULL,NULL);" \
+@HAVE_INTROSPECTION_TRUE@              --add-init-section="gst_init(&argc,&argv);" \
 @HAVE_INTROSPECTION_TRUE@              --output $@ \
 @HAVE_INTROSPECTION_TRUE@              $(gir_headers) \
 @HAVE_INTROSPECTION_TRUE@              $(gir_sources)
Comment 3 Tim-Philipp Müller 2011-01-10 11:12:45 UTC
I don't understand why the --library=gstreamer-0.10 is needed at all (why doesn't it get that info from the pkg-config file?), but it looks ok.

> I changed gst_init(NULL,NULL) to gst_init(&argc,&argv) in
> gst-libs/gst/pbutils/Makefile.{am,in} as a try, then warnings above doesn't
> appear any more.

Why would this help with the "implicit declaration of function ‘gst_init’" warning (is that the one you meant?)

(PS: only Makefile.am needs patching, Makefile.in is generated from that when you run autogen.sh)
Comment 4 Benjamin Otte (Company) 2011-01-10 18:26:04 UTC
I fixed this in gobject-introspection, but I suspect those fixes will only be part of gobject-introspection 0.10.2. These are the fixes to gobject-introspection:

commit 88553b4cd6776b7eff9a3b1d63eb8e49be0bd8f2
Author: Benjamin Otte <otte@redhat.com>
Date:   Mon Jan 10 18:53:55 2011 +0100

    scanner: Stop predeclaring the functions that are to be scanned
    
    Instead, rely on the c_includes. See the previous commit for details.

commit bedd7dd61508684b78bd1e95fed8025d48661b48
Author: Benjamin Otte <otte@redhat.com>
Date:   Mon Jan 10 18:48:23 2011 +0100

    scanner: Include all headers when building the dumper binary
    
    This avoids warnings about undefined functions when using init sections
    and it removes the requirement to predeclare the get_type functions that
    should be called. For an example for this problem with GStreamer, see
    https://bugzilla.gnome.org/show_bug.cgi?id=639039
    
    We can now also use gcc's error checking to ensure that users
    - specify the correct C includes in the gir file (because otherwise we
      get errors when compiling the dumper).
    - the types do actually exist (because again, the compiler will
      complain).

commit 34fad966c2f642dcf0cc9c7beefeb62dbb8fec60
Author: Benjamin Otte <otte@redhat.com>
Date:   Mon Jan 10 18:15:03 2011 +0100

    scanner: Use packages from --pkg
    
    Use pkgconfig files from --pkg when compiling the dump binary.
    
    This helps avoiding linker errors when init sections are provided that
    use code from those packages.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639039
Comment 5 Benjamin Otte (Company) 2011-01-10 18:35:32 UTC
From looking at the gobject-introspection code, the "--library gstreamer-0.10" flag suggested above is the only flag for current releases of gobject-introspection. So I'd suggest adding that as a quickfix for the current release and remove it later once the g-o-i requirement gets bumped.

The warning from gst_main() cannot be fixed in any reasonable way without my patches, so I'd suggest ignoring it for the time being. The patches above fix it.
Comment 6 Tim-Philipp Müller 2011-01-10 18:58:31 UTC
Well, just adding --library=gstreamer-0.10 breaks things for me in an uninstalled setup:

g-ir-scanner: compile: gcc -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I../../../gst-libs -I../../../gst-libs -I/home/tpm/gst/git/gst-plugins-base/gst-libs -I/home/tpm/gst/git/gstreamer -I/home/tpm/gst/git/gstreamer/libs -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -c -o /home/tpm/gst/git/gst-plugins-base/gst-libs/gst/pbutils/tmp-introspectW7K3ut/GstPbutils-0.10.o /home/tpm/gst/git/gst-plugins-base/gst-libs/gst/pbutils/tmp-introspectW7K3ut/GstPbutils-0.10.c
g-ir-scanner: link: ../../../libtool --mode=link --tag=CC --silent gcc -o /home/tpm/gst/git/gst-plugins-base/gst-libs/gst/pbutils/tmp-introspectW7K3ut/GstPbutils-0.10 -export-dynamic -L. libgstpbutils-0.10.la -lgstreamer-0.10 -pthread -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 /home/tpm/gst/git/gst-plugins-base/gst-libs/gst/pbutils/tmp-introspectW7K3ut/GstPbutils-0.10.o
/home/tpm/gst/git/gstreamer/libs/gst/base/.libs/libgstbase-0.10.so.0: undefined reference to `gst_clock_single_shot_id_reinit'
/home/tpm/gst/git/gst-plugins-base/gst-libs/gst/video/.libs/libgstvideo-0.10.so.0: undefined reference to `gst_element_factory_list_get_elements'
/home/tpm/gst/git/gst-plugins-base/gst-libs/gst/video/.libs/libgstvideo-0.10.so.0: undefined reference to `gst_element_factory_list_filter'
/home/tpm/gst/git/gst-plugins-base/gst-libs/gst/video/.libs/libgstvideo-0.10.so.0: undefined reference to `gst_plugin_feature_list_debug'
collect2: ld returned 1 exit status
linking of temporary binary failed: Command '['../../../libtool', '--mode=link', '--tag=CC', '--silent', 'gcc', '-o', '/home/tpm/gst/git/gst-plugins-base/gst-libs/gst/pbutils/tmp-introspectW7K3ut/GstPbutils-0.10', '-export-dynamic', '-L.', 'libgstpbutils-0.10.la', '-lgstreamer-0.10', '-pthread', '-lgio-2.0', '-lgobject-2.0', '-lgmodule-2.0', '-lgthread-2.0', '-lrt', '-lglib-2.0', '/home/tpm/gst/git/gst-plugins-base/gst-libs/gst/pbutils/tmp-introspectW7K3ut/GstPbutils-0.10.o']' returned non-zero exit status 1
make[1]: *** [GstPbutils-0.10.gir] Error 1
Comment 7 Tim-Philipp Müller 2011-01-11 15:04:05 UTC
Hopefully this does the trick:


commit 53893cfba881f573aa398d2660b451fe138bf3e0
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Tue Jan 11 14:59:38 2011 +0000

    gobject-introspection: pass --library-path as well to make it find the right libgstreamer
    
    Makes things work again properly in uninstalled setups (and
    presumably in installed setups where GStreamer is installed
    into a non-standard prefix). Requires fixes from core git.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639039

commit 7c55ad4db33f60771d72ab7c109006d45dc335d3
Author: Byeong-ryeol Kim <brofkims@gmail.com>
Date:   Tue Jan 11 14:52:51 2011 +0000

    gobject-introspection: fix issue when gold linker is used
    
    Need to pass libgstreamer-0.10 explicitly to linker, since we're
    calling gst_init(), which in turn is needed because the encoding
    target get_type() function calls gst_value_register().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639039