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 782525 - make check fails with lto : missing library symbols
make check fails with lto : missing library symbols
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
1.8.x
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-05-11 17:35 UTC by Michael Biebl
Modified: 2019-02-04 10:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
nm output (193.14 KB, text/plain)
2017-05-11 22:16 UTC, Michael Biebl
  Details
[patch] [NON-WORKING] build: add -flto-parition=none to CFLAGS for LTO builds (1.35 KB, patch)
2017-06-01 11:00 UTC, Thomas Haller
none Details | Review

Description Michael Biebl 2017-05-11 17:35:30 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
Comment 1 Thomas Haller 2017-05-11 18:05:00 UTC
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.
Comment 2 Michael Biebl 2017-05-11 22:16:21 UTC
Created attachment 351674 [details]
nm output
Comment 3 Michael Biebl 2017-05-11 22:17:36 UTC
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.
Comment 4 Thomas Haller 2017-05-12 08:18:08 UTC
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.
Comment 5 Thomas Haller 2017-06-01 10:56:52 UTC
(In reply to Thomas Haller from comment #4)

> There are also other failures:

these should be fixed with bug 783311.
Comment 6 Thomas Haller 2017-06-01 11:00:21 UTC
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...