Bug 213863

Summary: dns/unbound fails to build on arm64 (no sbrk)
Product: Ports & Packages Reporter: Glen Barber <gjb>
Component: Individual Port(s)Assignee: Mark Linimon <linimon>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: emaste, jaap, linimon
Priority: --- Flags: jaap: maintainer-feedback+
Version: Latest   
Hardware: arm64   
OS: Any   
Bug Depends on:    
Bug Blocks: 201763    

Description Glen Barber freebsd_committer freebsd_triage 2016-10-28 18:36:13 UTC
./libtool --tag=CC --mode=link cc  -R/usr/local/lib -I. -I/usr/local/include   -I/usr/local/include -I/usr/local/include -O2 -pipe  -fn
o-strict-aliasing -D_THREAD_SAFE -pthread -L/usr/local/lib    -L/usr/local/lib -L/usr/local/lib -o unbound acl_list.lo cachedump.lo dae
mon.lo remote.lo stats.lo unbound.lo  worker.lo dns.lo infra.lo rrset.lo dname.lo msgencode.lo  as112.lo msgparse.lo msgreply.lo packed
_rrset.lo iterator.lo iter_delegpt.lo  iter_donotq.lo iter_fwd.lo iter_hints.lo iter_priv.lo iter_resptype.lo  iter_scrub.lo iter_utils
.lo localzone.lo mesh.lo modstack.lo  outbound_list.lo alloc.lo config_file.lo configlexer.lo configparser.lo  fptr_wlist.lo locks.lo l
og.lo mini_event.lo module.lo net_help.lo  random.lo rbtree.lo regional.lo rtt.lo dnstree.lo lookup3.lo lruhash.lo  slabhash.lo timehist.lo tube.lo winsock_event.lo autotrust.lo val_anchor.lo  validator.lo val_kcache.lo val_kentry.lo val_neg.lo val_nsec3.lo val_nsec.lo  val_secalgo.lo val_sigcrypt.lo val_utils.lo dns64.lo cachedb.lo     netevent.lo listen_dnsport.lo  outside_network.lo ub_event.lo keyraw.lo sbuffer.lo wire2str.lo parse.lo parseutil.lo rrdef.lo  str2wire.lo    -lssl -lutil -levent   -lcrypto
libtool: link: cc -I. -I/usr/local/include -I/usr/local/include -I/usr/local/include -O2 -pipe -fno-strict-aliasing -D_THREAD_SAFE -pthread -o unbound .libs/acl_list.o .libs/cachedump.o .libs/daemon.o .libs/remote.o .libs/stats.o .libs/unbound.o .libs/worker.o .libs/dns.o .libs/infra.o .libs/rrset.o .libs/dname.o .libs/msgencode.o .libs/as112.o .libs/msgparse.o .libs/msgreply.o .libs/packed_rrset.o .libs/iterator.o .libs/iter_delegpt.o .libs/iter_donotq.o .libs/iter_fwd.o .libs/iter_hints.o .libs/iter_priv.o .libs/iter_resptype.o .libs/iter_scrub.o .libs/iter_utils.o .libs/localzone.o .libs/mesh.o .libs/modstack.o .libs/outbound_list.o .libs/alloc.o .libs/config_file.o .libs/configlexer.o .libs/configparser.o .libs/fptr_wlist.o .libs/locks.o .libs/log.o .libs/mini_event.o .libs/module.o .libs/net_help.o .libs/random.o .libs/rbtree.o .libs/regional.o .libs/rtt.o .libs/dnstree.o .libs/lookup3.o .libs/lruhash.o .libs/slabhash.o .libs/timehist.o .libs/tube.o .libs/winsock_event.o .libs/autotrust.o .libs/val_anchor.o .libs/validator.o .libs/val_kcache.o .libs/val_kentry.o .libs/val_neg.o .libs/val_nsec3.o .libs/val_nsec.o .libs/val_secalgo.o .libs/val_sigcrypt.o .libs/val_utils.o .libs/dns64.o .libs/cachedb.o .libs/netevent.o .libs/listen_dnsport.o .libs/outside_network.o .libs/ub_event.o .libs/keyraw.o .libs/sbuffer.o .libs/wire2str.o .libs/parse.o .libs/parseutil.o .libs/rrdef.o .libs/str2wire.o  -L/usr/local/lib -lssl -lutil -levent -lcrypto -pthread  -Wl,-rpath -Wl,/usr/local/lib
.libs/remote.o: In function `do_stats':
./daemon/remote.c:(.text+0x3f8c): undefined reference to `sbrk'
.libs/unbound.o: In function `main':
./daemon/unbound.c:(.text+0x34): undefined reference to `sbrk'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make[1]: stopped in /wrkdirs/usr/ports/dns/unbound/work/unbound-1.5.10
*** Error code 1

Stop.
make: stopped in /usr/ports/dns/unbound
Comment 1 Jaap Akkerhuis 2016-10-30 22:57:17 UTC
Currently I don't have arm64 hardware at hand so it is hard to reproduce
the problem.

Given the error, it seems that the arm64 architecture doesn't has sbrk()
but configure seems to find it anyway. For now, remove the 
#define HAVE_SBRK 1 from config.h and give that a try.

Meanwhile I'll contact the upstream.

Note: I'm also traveling this will have little time so expect delays in my reactions.
Comment 2 Ed Maste freebsd_committer freebsd_triage 2016-10-30 23:48:08 UTC
configure just compiles conftest.c containing sbrk() into conftest.o; it does not link it

Running it manually,
% cc -c  -g -O2 -D_THREAD_SAFE -pthread -Werror conftest.c
% echo $?
0

But actually trying to link it,
% cc -g -O2 -D_THREAD_SAFE -pthread -Werror conftest.c
/tmp/ss-1109f6.o: In function `main':
/scratch/emaste/unbound/conftest.c:179: undefined reference to `sbrk'
/scratch/emaste/unbound/conftest.c:179: undefined reference to `sbrk'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
%
Comment 3 Jaap Akkerhuis 2016-10-31 09:59:51 UTC
(In reply to Ed Maste from comment #2)

The upstream tells me that it is a known problem. The fix is in the repository and will be in the next release.

For now, use the repository directly, which can be found via http://unbound.net.
Comment 4 Jaap Akkerhuis 2016-12-15 15:18:37 UTC
(In reply to jaap from comment #3)

A new version of unbound has been released which should fix the problem. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215322 for details.
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2017-01-31 04:54:54 UTC
Already marked BROKEN on arm64.
Comment 6 Jaap Akkerhuis 2017-03-08 08:58:08 UTC
(In reply to Mark Linimon from comment #5)
As said before, it was fixed with the release of unbound 1.6.0

And today we released 1.6.1, so I really think this is taken over by events and can be closed.

If unbound 1.6.1 still doesn't build on arm64 I would like to know.