GNOME Bugzilla – Bug 568406
gnome-keyring does not like LDFLAGS="-Wl,--no-undefined"
Last modified: 2019-02-22 11:46:44 UTC
When building gnome-keyring 2.25.5 with LDFLAGS="-Wl,--no-undefined", it raises errors when linking libgcr. After applying this patch[1], and disabling specific LDFLAGS, there are still undefined references on libgcr and gck-roots-store-standalone.so: Warning: undefined symbols in /usr/lib64/libgcr.so.0.0.0: egg_memory_lock egg_memory_fallback egg_memory_unlock Warning: undefined symbols in /usr/lib64/gnome-keyring/standalone/gck-roots-store-standalone.so: egg_asn1_write_value egg_asn1_read_element egg_asn1_read_time egg_asn1_decode egg_asn1_get_pkix_asn1type egg_symkey_read_cipher egg_asn1_element_length egg_asn1_write_oid egg_asn1_read_dn_part egg_asn1_read_oid egg_openssl_pem_parse egg_asn1_get_pk_asn1type egg_symkey_generate_pkcs12 egg_asn1_read_dn egg_symkey_generate_simple egg_asn1_write_uint egg_asn1_encode egg_asn1_read_value egg_asn1_read_boolean egg_asn1_read_uint egg_asn1_read_content As libgcr is a system shared library, alll of the references should be solved at linking time. Regarding gck-roots-store-standalone, the undefined references come from internal objects, such as egg/*. Maybe you should split egg/*.la more specificly.
libtool, grumble grumble... All those symbols are in fact things used by libgcr. And libgcr does link to the egg stuff directly: libgcr_la_LIBADD = \ $(top_builddir)/egg/libegg.la \ $(top_builddir)/egg/libegg-secure-entry.la \ $(top_builddir)/gp11/libgp11.la \ $(GOBJECT_LIBS) \ $(GLIB_LIBS) \ $(LIBGCRYPT_LIBS) \ $(LIBTASN1_LIBS) To be honest I'm really lost when it comes to libtool. I have that flag (ie: --no-undefined) on my machine but it seems to have no effect. Are you a libtool wizard (or apprentice)? If it'd be awesome if you had a patch that resolved the issue. Otherwise I'll try to muddle my way through this and figure something out.
may egg_* should be "export"ed?
No, those are internal functions. Only gcr_* functions should be exported.
Then maybe egg should be set as static lib I think.
I get this piece of beauty: *** Warning: Linking the shared library libgcr.la against the *** static library ../egg/libegg.a is not portable! *** Warning: Linking the shared library libgcr.la against the *** static library ../egg/libegg-secure-entry.a is not portable! Along with this: /usr/bin/ld: ../egg/libegg.a(libegg_a-egg-asn1.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
Created attachment 128177 [details] [review] Try to make libegg a static library Here's what I did to try and make libegg a static library.
*** Bug 570393 has been marked as a duplicate of this bug. ***
Tried another approach. Does this fix the problem? 2009-02-07 Stef Walter <stef@memberwebs.com> * gcr/Makefile.am: Add GTK library dependency in libgcr. See bug #570393 * pkcs11/gck/Makefile.am: * pkcs11/roots-store/Makefile.am: * pkcs11/ssh-store/Makefile.am: * pkcs11/user-store/Makefile.am: Link libegg into gck where it's actually used. See bug #568406
It seems to solve the issue for me at least ! Thanks stefan ! I have been able to build with the following LDFLAGS := -Wl,-O1 -Wl,-z,defs -Wl,--as-needed
It builds correctly. But still has some probs: Warning: unused libraries in /usr/bin/gnome-keyring: libgcr.so.0 libpthread.so.0 Warning: undefined symbols in /usr/lib64/libgcr.so.0.0.0: gp11_attributes_add_ulong gp11_attributes_find_ulong gp11_slot_open_session_async gp11_object_get_type gp11_attributes_add_data gp11_attributes_ref gp11_session_create_object_async gp11_session_create_object_full gp11_slot_get_type gp11_session_get_type gp11_slot_open_session_full gp11_attributes_new_full gp11_slot_get_token_info gp11_module_set_auto_authenticate gp11_slot_open_session_finish gp11_attributes_add_boolean gp11_list_unref_free gp11_session_create_object_finish gp11_module_get_slots gp11_module_set_pool_sessions gp11_slot_equal gp11_attributes_new gp11_module_get_type gp11_attributes_get_boxed_type gp11_attributes_unref gp11_attributes_find_string gp11_module_initialize
I'm out of ideas again. libgcr is linked with libgp11 as you can see in gcr/Makefile.am in the libgcr_la_LIBADD section.
I'm assuming this is now fixed. Several other changes have been made to the building of libraries that make up gnome-keyring.