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 577275 - [check] Exports all symbols by check
[check] Exports all symbols by check
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal major
: 0.10.25
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-03-30 08:38 UTC by Sebastian Dröge (slomo)
Modified: 2009-10-16 11:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastian Dröge (slomo) 2009-03-30 08:38:37 UTC
Hi,
the libgstcheck library exports all symbols by check (not only the public check API but all symbols) and additionally requires check for linking (.la and .pc files). This can cause potential problems, especially if the internal ABI of check changes and libgstcheck isn't rebuild.

We should remove the check symbols via the libtool exports regex magic IMHO
Comment 1 Sebastian Dröge (slomo) 2009-03-30 08:48:27 UTC
Example:

objdump -t libs/gst/check/.libs/*so | grep send
0000000000007f90 l     F .text	000000000000006a              srunner_send_evt
000000000020d8f8 l     O .bss	0000000000000008              send_file2
000000000020d8f0 l     O .bss	0000000000000008              send_file1
0000000000008a70 g     F .text	0000000000000068              send_loc_info
0000000000008ae0 g     F .text	0000000000000060              send_failure_info
0000000000008a10 g     F .text	0000000000000058              send_ctx_info

Comment 2 Sebastian Dröge (slomo) 2009-03-30 10:32:13 UTC
Erm, better example:

objdump -w -f -p -T -R libs/gst/check/.libs/*so  | grep rpl
0000000000007330 g    DF .text	0000000000000011  Base        rpl_malloc
0000000000007ae0 g    DF .text	0000000000000028  Base        rpl_realloc

No idea where these come from though
Comment 3 Sebastian Dröge (slomo) 2009-03-30 10:33:22 UTC
... they come from check
Comment 4 Tim-Philipp Müller 2009-03-30 10:45:03 UTC
> We should remove the check symbols via the libtool exports regex magic IMHO

I agree.
Comment 5 Sebastian Dröge (slomo) 2009-03-30 11:50:48 UTC
Ok, the problem is the following:

We pass -export-dynamic to the linker for libgstcheck. This makes sure that all symbols from check are exported.

Now if we remove this all our unit tests will fail to work. This is because libgstcheck has a copy of check internally and the unit test has a second copy of check integrated. libgstcheck will call into it's copy, the unit tests into it's own copy. As check has a global state that needs to be initialized, this also exists twice but is only initialized once.

This problem does not happen if we use -export-dynamic as then the linker will choose the correct symbols when linking the unit tests.


No idea how we could fix this. One way would be to export the symbols of check from libgstcheck and not link against check anymore. This would mean that our library interface depends on the ABI of check. The other way would be, to not link libgstcheck with check. This would have the disadvantage that we can't link libgstcheck with -no-undefined or -Wl,-z,defs but other than that it seems to be a good solution.

What do you think?
Comment 6 Tim-Philipp Müller 2009-07-14 10:32:24 UTC
I'm not sure what changed, but for me on debian sid (amd64) all our unit tests suddenly blow up with:

 tpm@zingle:~/gst/git/gstreamer/tests/check$ make gst/gst.check
 Running suite(s): Gst
 check_msg.c:76: No messaging setup [6x]
 0%: Checks: 6, Failures: 0, Errors: 6
 (null):-1:S:gst tests:test_init:0: (after this point) Early exit with return value 2 [repeated for other tests]

The culprit seems to be the -export-symbols-regex that ends up in my libs/gst/check/Makefile:

GST_CHECK_LIB_LDFLAGS = -Wl,--export-dynamic -export-symbols-regex \^\(_*\(gst_\|Gst\|GST_\).*\|check_\(debug\|mutex\|cond\)\|buffers\|mutex\|start_cond\|sync_cond\|thread_list\)$

If I change this to just

GST_CHECK_LIB_LDFLAGS = -Wl,--export-dynamic

it all works fine again. (This is with check-0.9.6 btw, but the check package hasn't changed in months.)

Not quite sure what the proper fix is, but marking as blocker for now.
Comment 7 Tim-Philipp Müller 2009-07-14 11:26:09 UTC
I think maybe we should just slurp a local copy of check into libgstcheck and then make the check symbols of that local copy public API of libgstcheck.

Not only would we be in full control of the libgstcheck ABI/API that way, but it likely would also solve build/dependency problems on some systems (like with darwinports or whatever it was called etc.). And our stuff won't break when the check people change (internal) API again (which we rely on quite a bit).
Comment 8 Tim-Philipp Müller 2009-07-17 09:03:31 UTC
Removing blocker status, since no one else seems to be running into this other than me and slomo.
Comment 9 Tim-Philipp Müller 2009-07-17 09:22:48 UTC
I should add that this is linking against a static libcheck_pic.a on x86-64 (there don't seem to be a libcheck .so on debian).
Comment 10 Sebastian Dröge (slomo) 2009-07-19 10:06:13 UTC
Yes, this problem can only happen when static linking check, otherwise there's no way the code can exist twice (in the unit test & libgstcheck).

Tim, will you commit a change to include a check copy in libgstcheck after freeze?
Comment 11 Tim-Philipp Müller 2009-07-19 10:18:27 UTC
> Tim, will you commit a change to include a check copy in libgstcheck after
> freeze?

Sure, if there are no objections. I've got a patch locally, but it needs some more love, and I should probably pull in the changes from upstream svn to make it work on mingw32 as well.
Comment 12 Tim-Philipp Müller 2009-08-06 20:44:13 UTC
Ok, so I've pushed this now:

---------------------------------------------------------------------
commit 06cc1d1d5882d6064d78b0f3a63dd2b10dcbe918
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Tue Aug 4 10:22:25 2009 +0100

    check: disable unit test support on win32 for now
    
    Until we make the internal libcheck work on windows.

commit 2d42fd4a2fc359ecfff380e8df185e576bf1bd0f
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Sun Jul 19 17:04:58 2009 +0100

    check: fix symbol exporting

commit 572b213b79294beda16ad23c7a3a19c1563d0642
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Fri Jul 17 00:46:32 2009 +0100

    check: fix issues with 'make distcheck'
    
    Seems to work now, at least on *nix. One of the configure checks
    caused these weird issues - but which one?

commit ecbea36d3995062e8e16dfbce7d86e29a02fdf17
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Thu Aug 6 17:27:12 2009 +0100

    check: use private copy of check for libgstcheck
    
    See #577275. Seems to work fine, but doesn't distcheck yet.

commit a209779f1cab5ddf6b5096e4c654801428308d5e
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Thu Jul 16 18:39:16 2009 +0100

    check: add internal copy of check-0.9.6
    
    Not hooked up yet. See #577275.

---------------------------------------------------------------------

Which fixes my build problems and allows us more control over the ABI and API, but as far as I can tell we still need to export a lot of check's crap, although there are probably some symbols we can drop.

Keeping bug open for now, but setting to NEEDINFO: Sebastian, what's left to do?


Comment 13 Sebastian Dröge (slomo) 2009-10-16 11:12:54 UTC
Nothing :)