GNOME Bugzilla – Bug 782525
make check fails with lto : missing library symbols
Last modified: 2019-02-04 10:02:28 UTC
Trying to build 1.8.0 with --enable-lto results in the following failure when running "make check": ./tools/check-exports.sh "./libnm/.libs/libnm.so" "./libnm/libnm.ver" >>linker script "./libnm/libnm.ver" contains symbols that are not exported by library "./libnm/.libs/libnm.so": 1 nm_access_point_get_last_seen@libnm_1_0_6 2 nm_device_get_metered@libnm_1_0_6 3 nm_device_wifi_request_scan_options@libnm_1_0_6 4 nm_device_wifi_request_scan_options_async@libnm_1_0_6 5 nm_metered_get_type@libnm_1_0_6 6 nm_setting_connection_autoconnect_slaves_get_type@libnm_1_0_4 7 nm_setting_connection_get_autoconnect_slaves@libnm_1_0_4 8 nm_setting_connection_get_metered@libnm_1_0_6 9 nm_setting_ip_config_get_dns_priority@libnm_1_2_4 10 nm_setting_wired_get_wake_on_lan@libnm_1_0_6 11 nm_setting_wired_get_wake_on_lan_password@libnm_1_0_6 12 nm_setting_wired_wake_on_lan_get_type@libnm_1_0_6 13 nm_utils_enum_from_str@libnm_1_0_6 14 nm_utils_enum_to_str@libnm_1_0_6 15 nm_utils_wifi_2ghz_freqs@libnm_1_0_6 16 nm_utils_wifi_5ghz_freqs@libnm_1_0_6 Makefile:17083: recipe for target 'check-local-exports-libnm' failed make[3]: *** [check-local-exports-libnm] Error 1
we usually don't enable LTO for our build due to `man gcc` saying: "Link-time optimization does not work well with generation of debugging information. Combining -flto with -g is currently experimental and expected to produce unexpected results." Anyway, great if you enable it and we can iron out issues. Can you attach the output of $ nm "./libnm/.libs/libnm.so" Thanks.
Created attachment 351674 [details] nm output
Attached the output of nm. $ gcc --version gcc (Debian 6.3.0-17) 6.3.0 20170510 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ ld --version GNU ld (GNU Binutils for Debian) 2.28 Copyright (C) 2017 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty.
The symbols exposed with NM_BACKPORT_SYMBOL() are dropped, which does __asm__(".symver "G_STRINGIFY(VERSIONED_FUNC)", "G_STRINGIFY(ORIG_FUNC)"@"G_STRINGIFY(VERSION)) Seems to be a known bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200 The mmentioned workaround -flto-partition=none did not work for me. There are also other failures: like: [ -n "" ] && export ; if [ -n "./src/settings/plugins/ibft/.libs/libnm-settings-plugin-ibft.so" ] && echo -fdata-sections -ffunction-sections -Wl,--gc-sections -flto -flto-partition=none - ./src/NetworkManager: symbol lookup error: ./src/settings/plugins/ibft/.libs/libnm-settings-plugin-ibft.so: undefined symbol: _nm_logging_enabled_state Makefile:17324: recipe for target 'check-local-symbols-settings-ibft' failed [ -n "" ] && export ; if [ -n "./src/settings/plugins/ifcfg-rh/.libs/libnm-settings-plugin-ifcfg-rh.so" ] && echo -fdata-sections -ffunction-sections -Wl,--gc-sections -flto -flto-partitio ./src/NetworkManager: symbol lookup error: ./src/settings/plugins/ifcfg-rh/.libs/libnm-settings-plugin-ifcfg-rh.so: undefined symbol: nm_setting_8021x_scheme_vtable Makefile:17343: recipe for target 'check-local-symbols-settings-ifcfg-rh' failed hm... ideas welcome how to fix that.
(In reply to Thomas Haller from comment #4) > There are also other failures: these should be fixed with bug 783311.
Created attachment 352996 [details] [review] [patch] [NON-WORKING] build: add -flto-parition=none to CFLAGS for LTO builds When building with -flto, our backported API is dropped and unit tests rightly fail: ./tools/check-exports.sh "./libnm/.libs/libnm.so" "./libnm/libnm.ver" >>linker script "./libnm/libnm.ver" contains symbols that are not exported by library "./libnm/.libs/libnm.so": 1 nm_access_point_get_last_seen@libnm_1_0_6 2 nm_device_get_metered@libnm_1_0_6 3 nm_device_wifi_request_scan_options@libnm_1_0_6 According to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200, -flto-parition=none but it doesn't...
Fixed by: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/commit/483dc4004720e826decdc178738736a77c9eb61e