# FreeBSD 10 b3 linker errors in net/samba4 and dns/bind99



## wonslung (Nov 20, 2013)

I've been trying to get Samba4 to build correctly on 10 for several days. I seem to be getting linker errors but *I* do not know enough about these to debug or fix them. I thought perhaps something in my make.conf was causing it so *I* cleared it. When that didn't work, *I* thought maybe it was one of my installed ports causing it, so *I* created a fresh jail. When this didn't work, *I* thought perhaps something was corrupt in my base system so *I* rebuilt world and kernel.

None of these worked, so *I* decided to try a fresh install. I installed 10-BETA3 in a new virtual machine. I'm able to reproduce this bug by selecting the GASSPI option in /usr/ports/dns/bind99 and building in a fresh install.

This is the bug *I* get in BIND99.


```
cc -pthread  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4 -I./include -I./unix/include -I.  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/lwres/include  -I../../lib/lwres/unix/include  -I../../lib/lwres/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/dns/include  -I../../lib/dns/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/bind9/include  -I../../lib/bind9/include  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isccfg/include  -I../../lib/isccfg/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isccc/include  -I../../lib/isccc/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isc/include  -I../../lib/isc  -I../../lib/isc/include  -I../../lib/isc/unix/include  -I../../lib/isc/pthreads/include  -I../../lib/isc/x86_32/include      -D_REENTRANT -DOPENSSL -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing -I/usr/local/include/libxml2 -I/usr/include   -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing  -Wl,-rpath=/usr/lib:/usr/local/lib  -o namedtmp0 ${BASEOBJS} ${LIBS0} ../../lib/lwres/liblwres.a ../../lib/dns/libdns.a  -lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err -lcrypto ../../lib/bind9/libbind9.a  ../../lib/isccfg/libisccfg.a ../../lib/isccc/libisccc.a ../../lib/isc/libisc.a     -L/usr/local/lib -lxml2 -lz -L/usr/lib -lm || exit 1;  rm -f named-symtbl.c named-symtbl.o;   ../../util/mksymtbl.pl  -o named-symtbl.c namedtmp0 || exit 1;  /usr/bin/make named-symtbl.o || exit 1;  rm -f namedtmp1;    cc -pthread  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4 -I./include -I./unix/include -I.  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/lwres/include  -I../../lib/lwres/unix/include  -I../../lib/lwres/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/dns/include  -I../../lib/dns/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/bind9/include  -I../../lib/bind9/include  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isccfg/include  -I../../lib/isccfg/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isccc/include  -I../../lib/isccc/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isc/include  -I../../lib/isc  -I../../lib/isc/include  -I../../lib/isc/unix/include  -I../../lib/isc/pthreads/include  -I../../lib/isc/x86_32/include      -D_REENTRANT -DOPENSSL -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing -I/usr/local/include/libxml2 -I/usr/include   -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing  -Wl,-rpath=/usr/lib:/usr/local/lib  -o namedtmp1 ${BASEOBJS} named-symtbl.o ${LIBS0} ../../lib/lwres/liblwres.a ../../lib/dns/libdns.a  -lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err -lcrypto ../../lib/bind9/libbind9.a  ../../lib/isccfg/libisccfg.a ../../lib/isccc/libisccc.a ../../lib/isc/libisc-nosymtbl.a     -L/usr/local/lib -lxml2 -lz -L/usr/lib -lm || exit 1;  rm -f named-symtbl.c named-symtbl.o;   ../../util/mksymtbl.pl  -o named-symtbl.c namedtmp1 || exit 1;  /usr/bin/make named-symtbl.o || exit 1;    cc -pthread  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4 -I./include -I./unix/include -I.  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/lwres/include  -I../../lib/lwres/unix/include  -I../../lib/lwres/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/dns/include  -I../../lib/dns/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/bind9/include  -I../../lib/bind9/include  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isccfg/include  -I../../lib/isccfg/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isccc/include  -I../../lib/isccc/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isc/include  -I../../lib/isc  -I../../lib/isc/include  -I../../lib/isc/unix/include  -I../../lib/isc/pthreads/include  -I../../lib/isc/x86_32/include      -D_REENTRANT -DOPENSSL -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing -I/usr/local/include/libxml2 -I/usr/include   -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing  -Wl,-rpath=/usr/lib:/usr/local/lib  -o namedtmp2 ${BASEOBJS} named-symtbl.o ${LIBS0} ../../lib/lwres/liblwres.a ../../lib/dns/libdns.a  -lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err -lcrypto ../../lib/bind9/libbind9.a  ../../lib/isccfg/libisccfg.a ../../lib/isccc/libisccc.a ../../lib/isc/libisc-nosymtbl.a     -L/usr/local/lib -lxml2 -lz -L/usr/lib -lm;   ../../util/mksymtbl.pl  -o named-symtbl2.c namedtmp2;  count=0;  until diff named-symtbl.c named-symtbl2.c > /dev/null ;  do  count=`expr $count + 1` ;  test $count = 42 && exit 1 ;  rm -f named-symtbl.c named-symtbl.o;   ../../util/mksymtbl.pl  -o named-symtbl.c namedtmp2 || exit 1;  /usr/bin/make named-symtbl.o || exit 1;    cc -pthread  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4 -I./include -I./unix/include -I.  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/lwres/include  -I../../lib/lwres/unix/include  -I../../lib/lwres/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/dns/include  -I../../lib/dns/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/bind9/include  -I../../lib/bind9/include  -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isccfg/include  -I../../lib/isccfg/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isccc/include  -I../../lib/isccc/include -I/var/ports/usr/ports/dns/bind99/work/bind-9.9.4/lib/isc/include  -I../../lib/isc  -I../../lib/isc/include  -I../../lib/isc/unix/include  -I../../lib/isc/pthreads/include  -I../../lib/isc/x86_32/include      -D_REENTRANT -DOPENSSL -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing -I/usr/local/include/libxml2 -I/usr/include   -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing   -Wl,-rpath=/usr/lib:/usr/local/lib -o namedtmp2 ${BASEOBJS} named-symtbl.o  ${LIBS0} ../../lib/lwres/liblwres.a ../../lib/dns/libdns.a  -lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err -lcrypto ../../lib/bind9/libbind9.a  ../../lib/isccfg/libisccfg.a ../../lib/isccc/libisccc.a ../../lib/isc/libisc-nosymtbl.a     -L/usr/local/lib -lxml2 -lz -L/usr/lib -lm;   ../../util/mksymtbl.pl  -o named-symtbl2.c namedtmp2;  done ;  mv namedtmp2 named;  rm -f namedtmp0 namedtmp1 namedtmp2 named-symtbl2.c;  fi
../../lib/dns/libdns.a(gssapictx.o): In function `dst_gssapi_acceptctx':
gssapictx.c:(.text+0xd46): undefined reference to `gsskrb5_register_acceptor_identity'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make[4]: stopped in /var/ports/usr/ports/dns/bind99/work/bind-9.9.4/bin/named
*** Error code 1

Stop.
make[3]: stopped in /var/ports/usr/ports/dns/bind99/work/bind-9.9.4/bin
*** Error code 1

Stop.
make[2]: stopped in /var/ports/usr/ports/dns/bind99/work/bind-9.9.4
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/dns/bind99
*** Error code 1

Stop.
make: stopped in /usr/ports/dns/bind99

===>>> make failed for dns/bind99
===>>> Aborting update
```


Samba4 crashes with a similar error:


```
[3443/3713] Linking default/source4/dns_server/libservice-dns.so
03:48:21 runner cc default/libcli/dns/dns_1.o default/source4/dns_server/dns_server_1.o default/source4/dns_server/dns_query_1.o default/source4/dns_server/dns_update_1.o default/source4/dns_server/dns_utils_1.o default/source4/dns_server/dns_crypto_1.o -o /usr/ports/net/samba4/work/samba-4.0.12/bin/default/source4/dns_server/libservice-dns.so -Wl,-no-undefined -Wl,--export-dynamic -pthread -Wl,--as-needed -shared -Wl,-R/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/ports/net/samba4/work/samba-4.0.12/bin/shared -Wl,-rpath,/usr/ports/net/samba4/work/samba-4.0.12/bin/shared/private -Ldefault/libcli/registry -Ldefault/source4/libcli/ldap -Ldefault/auth -Ldefault/nsswitch -Ldefault/libds/common -Ldefault/libcli/ldap -Ldefault/lib/ccan -Ldefault/lib/socket -Ldefault/libcli/smb -Ldefault/source4/lib/socket -Ldefault/libcli/cldap -Ldefault/source4/libcli -Ldefault/libcli/nbt -Ldefault/lib/addns -Ldefault/source4/cluster -Ldefault/source4/lib/events -Ldefault/lib/dbwrap -Ldefault/libcli/util -Ldefault/lib/tdb_wrap -Ldefault/source4/libcli/wbclient -Ldefault/source4/auth/kerberos -Ldefault/source4/dsdb -Ldefault/libcli/security -Ldefault/source4/auth -Ldefault/nsswitch/libwbclient -Ldefault/lib/krb5_wrap -Ldefault/lib/tdb_compat -Ldefault/libcli/auth -Ldefault/source3 -Ldefault/libcli/named_pipe_auth -Ldefault/source4/lib/messaging -Ldefault/librpc -Ldefault/lib/replace -Ldefault/source4/heimdal_build -Ldefault/source4/librpc -Ldefault/auth/gensec -Ldefault/lib/ldb-samba -Ldefault/lib -Ldefault/lib/param -Ldefault/lib/util -Ldefault/auth/credentials -Ldefault/source4/auth/ntlm -Ldefault/source3/auth -Ldefault/source4/smbd -L/usr/local/lib -Wl,-Bdynamic -lservice -lauth -lauth4 -lsamba-credentials -ltevent-util -lsamba-hostconfig -lsamba-sockets -lldbsamba -lgensec -lndr-samba4 -lgssapi-samba4 -lreplace -lndr-samba -lMESSAGING -lnpa_tstream -ldcerpc -lprocess_model -lsamba-util -llibcli_lsa3 -llibcli_netlogon3 -ltrusts_util -lcliauth -lads -ltdb_compat -lkrb5samba -lmsrpc3 -lpdb -lwbclient -lcom_err-samba4 -lsamba-modules -ldcerpc-samba4 -lauth_unix_token -lsamba-security -lsamdb -lauthkrb5 -lLIBWBCLIENT_OLD -lsamdb-common -ltdb-wrap -lerrors -lndr -ldbwrap -lutil_tdb -levents -lserver-role -lroken-samba4 -lndr-nbt -lasn1util -lndr-standard -lndr-krb5pac -lkrb5-samba4 -lasn1-samba4 -lhcrypto-samba4 -lwind-samba4 -lcluster -laddns -lcli-nbt -lsmbclient-raw -ldcerpc-binding -lcli_cldap -lnetif -lcli_smb_common -ldcerpc-samba -lutil_setid -linterfaces -lccan -lsmbconf -lsamba3-util -lsmbldap -llibsmb -lcli-ldap-common -lgse -lflag_mapping -lsmbldaphelper -lsecrets3 -lwinbind-client -lauth_sam_reply -lheimbase-samba4 -lhx509-samba4 -lcli-ldap -lsmb_transport -lsmbregistry -lCHARSET3 -lutil_reg -lutil_cmdline -lsmbd_shim -lldap -llber -lcups -lcrypt -lrt -lz -lexecinfo -lpthread -lutil -lgnutls -lgcrypt -lsasl2 -lpam -lpyldb-util -lldb -ltalloc -ltevent -ltdb
cc: error: unable to execute command: Segmentation fault (core dumped)
cc: error: linker command failed due to signal (use -v to see invocation)
```

I would appreciate any guidance here.


----------



## wonslung (Nov 20, 2013)

After talking to someone in #samba, I figured out how to get past this error on BIND99, but I'm still stuck on Samba4.

There is a patch for GSSAPI at /usr/ports/dns/samba-nsupdate/files/patch-configure.in

Also, you need to add the following to Makefile:


```
USE_AUTOTOOLS=  autoconf autoheader
```

After this, /usr/ports/dns/bind99 will build which in turn makes samba4 build properly.


----------



## Zucca (Dec 1, 2013)

Im excited to see if the new FreeBSD 10 with those https://wiki.freebsd.org/WhatsNew/FreeBSD10 new features will work with Samba4.

My question is if the LDNS as replacement of BIND (see details here http://blog.des.no/2013/09/local-caching-resolver-in-freebsd-10/) will work with Samba4, so you don't need to install /usr/ports/dns/bind99 at all. I hope this post makes sense since I'm pretty new with FreeBSD and Samba4, if not sorry in advance.


----------



## fugee279 (Sep 2, 2014)

@wonslung said: 





> There is a patch for GSSAPI at /usr/ports/dns/samba-nsupdate/files/patch-configure.in


Can anyone tell me how to apply the patch on FreeBSD 10?


----------



## SirDice (Sep 2, 2014)

The patch is automatically applied when you build the port.


----------

