openntpd port for freebsd8: removal of custom arc4random_uniform

no@spam@mgedv.net nospam at mgedv.net
Sat May 15 18:46:05 UTC 2010


hi naddy,

i'm not sure whether this is relevant or not, but:

in the openntpd-4.6 port there's a file called arc4random.c,
which gets involved during compilation and linking of openntpd:

static linking fails because the function arc4random_uniform
(which did not exist on 7.2-RELEASE) is delivered by the OS-libs:

compile:/data/compile/compile/openntpd-4.6# make
cc -O2 -pipe  -Wall -I/data/compile/compile/openntpd-4.6 -Wstrict-prototypes 
 -Wmissing-prototypes -Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual 
 -Wsign-compare -std=gnu99 -fstack-protector  -o ntpd ntpd.o buffer.o log.o 
imsg.o ntp.o ntp_msg.o parse.o config.o server.o client.o util.o ntp_dns.o 
adjfreq.o arc4random.o -lmd
/usr/lib/libc.a(arc4random.o)(.text+0x3f0): In function 
`arc4random_uniform':
: multiple definition of `arc4random_uniform'
arc4random.o(.text+0x0): first defined here
*** Error code 1

Stop in /data/compile/compile/openntpd-4.6.


i tried removing the arc4random.c file from the Makefile and
compiled openntpd static without any problems:

cc -O2 -pipe  -Wall -I/data/compile/compile/openntpd-4.6 -Wstrict-prototypes 
 -Wmissing-prototypes -Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual 
 -Wsign-compare -std=gnu99 -fstack-protector  -o ntpd ntpd.o buffer.o log.o 
imsg.o ntp.o ntp_msg.o parse.o config.o server.o client.o util.o ntp_dns.o 
adjfreq.o -lmd

compile:/data/compile/compile/openntpd-4.6# file ntpd
ntpd: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), 
statically linked, for FreeBSD 8.0 (800107), not stripped


my patch looks as follows:

--- Makefile.orig       2010-05-15 17:53:31.000000000 +0200
+++ Makefile    2010-05-15 18:02:49.000000000 +0200
@@ -2,7 +2,7 @@

 PROG=  ntpd
 SRCS=  ntpd.c buffer.c log.c imsg.c ntp.c ntp_msg.c parse.y config.c \
-       server.c client.c util.c ntp_dns.c adjfreq.c arc4random.c
+       server.c client.c util.c ntp_dns.c adjfreq.c
 CFLAGS+= -Wall -I${.CURDIR}
 CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
 CFLAGS+= -Wmissing-declarations

(tested on FREEBSD 8.0-RELEASE)

cheers.

ps: don't directly reply to me, post to the lists. 




More information about the freebsd-ports-bugs mailing list