GNOME Bugzilla – Bug 783311
NetworkManager 1.8.0 runtime failure when built with LTO enabled
Last modified: 2017-06-01 11:01:50 UTC
When build with LTO enabled, NetworkManager fails to load critical modules and cannot connect to any networks. I traced it down to this warning in the build log: BINUTILS_NM="/usr/bin/x86_64-pc-linux-gnu-nm" "/x/portage/net-misc/networkmanager-1.8.0/work/NetworkManager-1.8.0/tools/create-exports-NetworkManager.sh" --called-from-make "/x/portage/net-misc/networkmanager-1.8.0/work/NetworkManager-1.8.0" /usr/bin/x86_64-pc-linux-gnu-nm: src_libNetworkManager_la-nm-checkpoint-manager.o: plugin needed to handle lto object Setting BINUTILS_NM=/usr/bin/gcc-nm in the environment resolves this. This is a wrapper that passes the proper --plugin arguments to the 'nm' command.
This might be resolved by replacing this line in configure.ac: AC_PATH_TOOL(BINUTILS_NM, nm, nm) With this: AC_CHECK_TOOLS(NM, [gcc-nm nm]) And update Makefile.am to reference $(NM) instead of $(BINUTILS_NM). This would look for gcc-nm before nm, and allow the user to override this using the standard 'NM' environment variable.
Should be fixed on master by https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=484d666485f481ea3fce447bfeec0b32a3b4f793 . If you don't agree with the patch or it doesn't work, please reopen. Thanks for reporting and telling how to fix it. Note that LTO is still broken after this. See https://bugzilla.gnome.org/show_bug.cgi?id=782525#c6