GNOME Bugzilla – Bug 769783
networkmanager-openvpn-1.2.4 - undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
Last modified: 2016-08-16 08:44:55 UTC
Created attachment 333160 [details] [review] networkmanager-openvpn-1.2.4-fix-undefined-reference-to-dlclose.patch make[4]: Entering directory '/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests' x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -pthread -I/usr/include/libnm -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2 -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2 -I../../shared -I../../properties -DTEST_SR CDIR="\"/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests\"" -DTEST_BUILDDIR="\"/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests\"" -pipe -O2 -march=bdver3 -c -o test_import_export-test-import-export.o `test -f 'test-import-export.c' || echo './'`test -import-export.c /bin/sh ../../libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -I../../shared -I../../properties -DTEST_SRCDIR="\"/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests\"" -DTEST_BUILDDIR="\"/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests\"" -pipe -O2 -march=bdver3 -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -o test-import-export test_import_export-test-import-export.o -lnm -lgio-2.0 -lgobject-2.0 -lglib-2.0 -ldl ../../properties/libnm-vpn-plugin-openvpn-test.la libtool: link: x86_64-pc-linux-gnu-gcc -I../../shared -I../../properties -DTEST_SRCDIR=\"/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests\" -DTEST_BUILDDIR=\"/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests\" -pipe -O2 -march=bdver3 -Wl,-O1 -Wl,--has h-style=gnu -o test-import-export test_import_export-test-import-export.o -Wl,--as-needed -ldl ../../properties/.libs/libnm-vpn-plugin-openvpn-test.a -lnm -lgio-2.0 -lgobject-2.0 -lglib-2.0 -pthread /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../properties/.libs/libnm-vpn-plugin-openvpn-test.a(libnm_vpn_plugin_openvpn_test_la-nm-vpn-plugin-utils.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5' /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../lib64/libdl.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[4]: *** [Makefile:691: test-import-export] Error 1 make[4]: Leaving directory '/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests' The issue is that the test binary does not link against libdl.so. Attached patch fixes this.
The change to test_import_export_glib_LDADD seems unnecessary to me, because it is for "test-import-export-glib". "test-import-export-glib" (contrary to "test-import-export") links against libnm-glib.so (instead of libnm.so) and does not call nm_vpn_plugin_utils_load_editor() -- which is the only caller of dlopen(). In other words: I think "test-import-export-glib" does not end up using dlopen(). So, the relevant change of your patch seems to be: test_import_export_LDADD = \ ... - -ldl \ + $(DLOPEN_LIBS) \ with: AC_SEARCH_LIBS([dlopen], [dl dld], [], [ Can you explain why that is necessary or on which system? `man dlopen` for me only mentions "link with -ldl", it doesn't mention libdld.
Created attachment 333193 [details] build.log I realised the patch is actually incorrect - it fixes the symptoms, but not the underlying cause. The actual issue is that properties/libnm-vpn-plugin-openvpn-test.a is underlinked and thus dlclose() is unreferenced when linking it into the test: libtool: link: x86_64-pc-linux-gnu-gcc -I../../shared -I../../properties -DTEST_SRCDIR=\"/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests\" -DTEST_BUILDDIR=\"/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests\" -pipe -O2 -march=bdver3 -Wl,-O1 -Wl,--hash-style=gnu -o test-import-export test_import_export-test-import-export.o -Wl,--as-needed -ldl ../../properties/.libs/libnm-vpn-plugin-openvpn-test.a -lnm -lgio-2.0 -lgobject-2.0 -lglib-2.0 -pthread /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../properties/.libs/libnm-vpn-plugin-openvpn-test.a(libnm_vpn_plugin_openvpn_test_la-nm-vpn-plugin-utils.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5' /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../lib64/libdl.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[4]: *** [Makefile:691: test-import-export] Error 1 make[4]: Leaving directory '/var/tmp/portage/net-misc/networkmanager-openvpn-1.2.4/work/NetworkManager-openvpn-1.2.4/properties/tests' I will attached a fixed patch in a minute. Sidenote: dlopen() and friends can be in different libraries depending on the platform - thus the actual library has to be searched for. This is also the example in Diego Elio "flameeyes" Pettenò's autotools tutorial [1] for when/how to search for symbols in multiple libraries. You probably looked into a GNU/Linux glibc manpage? Sidenote: I am searching for dlopen(), and am thus using the accordingly named variable, because that is the most common situation and dlopen() and dlclose() are part of the same library. [1]: https://autotools.io/autoconf/finding.html
Created attachment 333194 [details] [review] networkmanager-openvpn-1.2.4-fix-undefined-reference-to-dlclose.patch
applied as https://git.gnome.org/browse/network-manager-openvpn/commit/?id=220b38717f8d0fc16c8b9d68cfd6e5b5751e4669 then, I modified it to be https://git.gnome.org/browse/network-manager-openvpn/commit/?id=8d76aebe99b1b9c67adab4922c0c33edb1f89b7f to be the same as in NetworkManager: https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=1f2eeb85d80d0a484cc842ddb0277dd93a7916f9 Dennis, does this work for you? I close the BZ for now, please reopen if there are still issues. Thanks.
I confirm. The combined patch (220b38717f8d0fc16c8b9d68cfd6e5b5751e4669 + 8d76aebe99b1b9c67adab4922c0c33edb1f89b7f) applies to 1.2.4 and fixes the issue.