Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 669754 - =net-fs/samba-4.8.6 fails to build with gold linker
Summary: =net-fs/samba-4.8.6 fails to build with gold linker
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's SAMBA Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-27 09:17 UTC by Bernd
Modified: 2021-01-07 16:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
samba-4.8.6:20181027-080559.log.bz2 build log (samba-4.8.6:20181027-080559.log.bz2,74.13 KB, application/x-bzip)
2018-10-27 09:17 UTC, Bernd
Details
emerge-info.txt (emerge-info.txt,13.01 KB, text/plain)
2018-10-27 09:18 UTC, Bernd
Details
emerge-info_samba-4.8.6-r2.txt (emerge-info_samba-4.8.6-r2.txt,14.49 KB, text/plain)
2019-05-24 23:00 UTC, Bernd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernd 2018-10-27 09:17:28 UTC
Created attachment 553306 [details]
samba-4.8.6:20181027-080559.log.bz2 build log

There are several issues with the current stable samba-4.8.6 ebuild.

It fails to build with the ld.gold linker and bails out when linking libnss-wrapper-winbind.so for abi_x86_32:

[1973/2369] Linking default/nsswitch/libnss-wrapper-winbind.so
10:19:44 runner x86_64-pc-linux-gnu-gcc -m32 default/nsswitch/winbind_nss_linux_6.o -o /var/tmp/portage/net-fs/samba-4.8.6/work/samba-4.8.6-abi_x86_32.x86/bin/default/nsswitch/libnss-wrapper-winbind.so -O2 -pipe -march=bdver2 -mprefer-avx128 -mvzeroupper -frecord-gcc-switches -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -fstack-protector -shared -Wl,--version-script=/var/tmp/portage/net-fs/samba-4.8.6/work/samba-4.8.6-abi_x86_32.x86/bin/default/nsswitch/nss_wrapper_winbind.vscript -Wl,-h,libnss-wrapper-winbind.so.2 -Ldefault/lib/replace -Ldefault/nsswitch -L/usr/local/lib -Wl,-Bdynamic -lwinbind-client-samba4 -lreplace-samba4 -lcrypt -lbsd -lattr -lnsl -ldl -lrt
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: internal error in define_default_version, at /var/tmp/portage/sys-devel/binutils-2.30-r4/work/binutils-2.30/gold/symtab.cc:877
collect2: error: ld returned 1 exit status

When ld.bfd is used it successfully finishes the build.

When I looked into this I found another issue. The ebuild seems to not respect USE flags.

artus /etc # emerge -pqv '=net-fs/samba-4.8.6::gentoo'
[ebuild     U ] net-fs/samba-4.8.6 [4.5.16] USE="acl client fam pam python%* syslog system-mitkrb5 systemd winbind -addc -addns -ads -ceph% -cluster -cups -debug% (-dmapi) -gnutls -gpg -iprint -ldap -quota (-selinux) (-system-heimdal) -test -zeroconf" ABI_X86="32 (64) (-x32)" PYTHON_TARGETS="python2_7" 

But in the log file:
CCFLAGS="-O2 -pipe -march=bdver2 -mprefer-avx128 -mvzeroupper -frecord-gcc-switches" LINKFLAGS="-O2 -pipe -march=bdver2 -mprefer-avx128 -mvzeroupper -frecord-gcc-switches -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0" "/var/tmp/portage/net-fs/samba-4.8.6/work/samba-4.8.6/buildtools/bin/waf" --prefix=/usr --libdir=/usr/lib32 --enable-fhs --sysconfdir=/etc --localstatedir=/var --with-modulesdir=/usr/lib32/samba --with-piddir=/run/samba --bundled-libraries=NONE --builtin-libraries=NONE --disable-rpath --disable-rpath-install --nopyc --nopyo --without-acl-support --without-ad-dc --without-dnsupdate --without-ads --disable-cephfs --without-cluster-support --disable-cups --without-dmapi --without-fam --without-gpgme --disable-iprint --without-pam --without-quotas --without-syslog --without-systemd --without-winbind --disable-python --disable-avahi --with-system-mitkrb5 --disable-gnutls --without-lttng --without-ldap configure

You can see, that acl, fam, pam, syslog, systemd, winbind and python USE flags are not passed correctly to the build system.
Comment 1 Bernd 2018-10-27 09:18:49 UTC
Created attachment 553308 [details]
emerge-info.txt

emerge --info '=net-fs/samba-4.8.6::gentoo` output
Comment 2 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2018-10-27 09:28:33 UTC
(In reply to Bernd from comment #0)
> 
> You can see, that acl, fam, pam, syslog, systemd, winbind and python USE
> flags are not passed correctly to the build system.

That's because we only enable these options for the native ABI and you looked at the configure output from the non-native ABI build.
Comment 3 Bernd 2018-10-27 14:13:38 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #2)
> (In reply to Bernd from comment #0)
> > 
> > You can see, that acl, fam, pam, syslog, systemd, winbind and python USE
> > flags are not passed correctly to the build system.
> 
> That's because we only enable these options for the native ABI and you
> looked at the configure output from the non-native ABI build.

Ok, I see. 
I assume the non-native ABI build is using default options then?
What's the reason for passing USE flags only to native ABI builds?
Comment 4 Bernd 2019-05-24 22:59:50 UTC
The current stable 4.8.6-r2 is still failing to build with gold linker.

[ 112/2369] Linking default/lib/replace/libreplace-samba4.so
21:23:39 runner x86_64-pc-linux-gnu-gcc -m32 default/lib/replace/replace_2.o default/lib/replace/cwrap_2.o -o /var/tmp/portage/net-fs/samba-4.8.6-r2/work/samba-4.8.6-abi_x86_32.x86/bin/default/lib/replace/libreplace-samba4.so -O2 -pipe -march=bdver2 -fstack-protector-strong -fstack-check -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -fstack-protector -shared -Wl,--version-script=/var/tmp/portage/net-fs/samba-4.8.6-r2/work/samba-4.8.6-abi_x86_32.x86/bin/default/lib/replace/replace.vscript -L/usr/local/lib -Wl,-Bdynamic -lrt -ldl -lnsl -lattr -lbsd -lcrypt
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: internal error in define_default_version, at /var/tmp/portage/sys-devel/binutils-2.31.1-r6/work/binutils-2.31.1/gold/symtab.cc:877
collect2: error: ld returned 1 exit status
Waf: Leaving directory `/var/tmp/portage/net-fs/samba-4.8.6-r2/work/samba-4.8.6-abi_x86_32.x86/bin'
Build failed:  -> task failed (err #1): 
        {task: cc_link replace_2.o,cwrap_2.o -> libreplace-samba4.so}
 * ERROR: net-fs/samba-4.8.6-r2::gentoo failed (compile phase):
 *   build failed

Switching to bfd linker will finish to build the package.

artus /etc # emerge -pqv =net-fs/samba-4.8.6-r2
[ebuild   R   ] net-fs/samba-4.8.6-r2  USE="acl addc addns client fam gnutls gpg pam python syslog system-mitkrb5 systemd winbind -ads -ceph -cluster -cups -debug (-dmapi) -iprint -ldap -quota (-selinux) (-system-heimdal) -test -zeroconf" ABI_X86="32 (64) (-x32)" PYTHON_TARGETS="python2_7"
Comment 5 Bernd 2019-05-24 23:00:44 UTC
Created attachment 577732 [details]
emerge-info_samba-4.8.6-r2.txt

output of emerge --info =net-fs/samba-4.8.6-r2