Bug 11764 - --builtin-libraries=replace causes undefined symbols
--builtin-libraries=replace causes undefined symbols
Status: ASSIGNED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build
4.4.0rc3
All All
: P5 normal
: ---
Assigned To: Ralph Böhme
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-01 14:25 UTC by Ralph Böhme
Modified: 2016-11-21 14:46 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2016-03-01 14:25:26 UTC
Trying to build Samba with ./configure --builtin-libraries=replace results in unpredicatable failing builds, depending on the remainning configure options.

When run with only --builtin-libraries=replace

[3364/3925] Linking default/nsswitch/libwbclient/libwbclient.so
default/source4/heimdal/lib/com_err/com_err_126.o: In function `error_message':
com_err.c:(.text+0x92): undefined reference to `rep_strlcpy'
default/source4/heimdal/lib/com_err/error_126.o: In function `com_right_r':
error.c:(.text+0x180): undefined reference to `rep_strlcpy'
collect2: error: ld returned 1 exit status

Trying to build Samba-4.4.0-rc3 results in:

[2448/2798] Linking default/source4/client/smbclient4
default/source3/libsamba-cluster-support-samba4.so: undefined reference
to `lp__ctdbd_socket'
collect2: error: ld returned 1 exit status

this is a problem in the waf dependency resolver that is triggered by

  --builtin-libraries=replace

waf adds the libreplace objects directly into all components that use them, eg libsamba-cluster-support-samba4, but libsamba-cluster-support-samba4 has undefined symbols (lp__ctdbd_socket)

When linking binaries where libsamba-cluster-support-samba4 is passed as a library object, but the binary doesn't use symbols from it, the linker would drop the dependency because we pass --as-needed

But because due to --builtin-libraries=replace the library does contains needed symbols (the symbols from libreplace), the linker picks up the dependency and the chokes on the undefined symbol.

A possible way to address this would be to ensure libraries that set allow_undefined_symbols=True are not chosen as grouping library, but there may be more to it then just this.
Comment 1 Arkadiusz Miskiewicz 2016-10-06 18:35:44 UTC
4.2.X was building fine with --builtin-libraries=replace. 4.4.X and current 4.5.X, too no longer builds here, too :(
Comment 2 Francis Brosnan Blázquez 2016-11-21 14:46:20 UTC
Just confirm same error happens building with:

    samba-4.5.1.tar.gz
    tdb-1.3.11.tar.gz
    talloc-2.1.8.tar.gz
    tevent-0.9.31.tar.gz
    ldb-1.1.27.tar.gz

Full ./configure command used:

   ./configure --prefix=/usr --enable-fhs --sysconfdir=/etc --localstatedir=/var 
               --with-privatedir=/var/lib/samba/private --with-smbpasswd-file=/etc/samba/smbpasswd 
               --with-piddir=/var/run/samba  --with-pammodulesdir=/lib/x86_64-linux-gnu/security  
               --with-pam   --with-syslog   --with-utmp 	--with-winbind 	 --with-shared-modules=idmap_rid,\
                 idmap_ad,idmap_adex,idmap_hash,idmap_ldap,idmap_tdb2,vfs_dfs_samba4,auth_samba4 
               --with-automount  --with-ldap  --with-ads  --with-dnsupdate  --libdir=/usr/lib/x86_64-linux-gnu  
               --with-modulesdir=/usr/lib/x86_64-linux-gnu/samba  --datadir=/usr/share 
               --with-lockdir=/var/run/samba --with-statedir=/var/lib/samba  --with-cachedir=/var/cache/samba 
               --disable-avahi --disable-rpath  --disable-rpath-install --bundled-libraries=NONE,pytevent,iniparser,roken,\
                 wind,hx509,asn1,heimbase,hcrypto,krb5,gssapi,heimntlm,hdb,kdc,com_err,compile_et,asn1_compile  
               --builtin-libraries=replace,ccan 	 
               --with-cluster-support --with-socketpath=/var/run/ctdb/ctdbd.socket --with-logdir=/var/log/ctdb

When compiling, relevant error log reported is:


    [3351/3835] Linking default/source4/heimdal_build/libcom_err-samba4.so
    default/source4/heimdal/lib/com_err/com_err_126.o: In function `error_message':
    com_err.c:(.text+0x92): undefined reference to `rep_strlcpy'
    default/source4/heimdal/lib/com_err/error_126.o: In function `com_right_r':
    error.c:(.text+0x180): undefined reference to `rep_strlcpy'
    collect2: error: ld returned 1 exit status
    Waf: Leaving directory `/usr/src/samba-4.5.1/bin'
    Build failed:  -> task failed (err #1): 
    	{task: cc_link com_err_126.o,error_126.o -> libcom_err-samba4.so}
    Makefile:8: recipe for target 'all' failed
    make: *** [all] Error 1

Also confirm samba compiles just fine by removing/not-using "--builtin-libraries=replace"