# dhcpcd build errors (solved)

## brian33x51

Finally got around to posting this.

Running gentoo ~amd64 on several boxes

For several months I've been unable to build dhcpcd versions.  I assume it was during one of the glibc upgrades which changed /usr/include/net/*

I don't see this reported in bugs or anywhere around here, anything obvious I'm missing?

The following errors always kill the build (example from net-misc/dhcpcd-5.1.4):

gcc -O2 -pipe -march=native -fomit-frame-pointer  -c compat/arc4random.c -o compat/arc4random.o

if-bsd.c:37:23: error: net/if_dl.h: No such file or directory

if-bsd.c:43:40: error: net80211/ieee80211_ioctl.h: No such file or directory

gcc -O2 -pipe -march=native -fomit-frame-pointer  -c compat/closefrom.c -o compat/closefrom.o

gcc -O2 -pipe -march=native -fomit-frame-pointer  -c compat/strlcpy.c -o compat/strlcpy.o

sed -e 's:@DBDIR@:/var/lib/dhcpcd:g' -e 's:@HOOKDIR@:/lib/dhcpcd/dhcpcd-hooks:g' -e 's:@SCRIPT@:/lib/dhcpcd/dhcpcd-run-hooks:g' -e 's:@SYSCONFDIR@:/etc:g' dhcpcd-run-hooks.in > dhcpcd-run-hooks

bpf.c: In function 'open_socket':

bpf.c:80: error: 'BIOCVERSION' undeclared (first use in this function)

bpf.c:80: error: (Each undeclared identifier is reported only once

bpf.c:80: error: for each function it appears in.)

bpf.c:90: error: 'BIOCSETIF' undeclared (first use in this function)

bpf.c:94: error: 'BIOCGBLEN' undeclared (first use in this function)

bpf.c:119: error: 'BIOCSETF' undeclared (first use in this function)

bpf.c: In function 'get_raw_packet':

bpf.c:166: error: storage size of 'packet' isn't known

if-bsd.c: In function 'if_address':

if-bsd.c:130: error: storage size of 'ifa' isn't known

sed -e 's:@DBDIR@:/var/lib/dhcpcd:g' -e 's:@HOOKDIR@:/lib/dhcpcd/dhcpcd-hooks:g' -e 's:@SCRIPT@:/lib/dhcpcd/dhcpcd-run-hooks:g' -e 's:@SYSCONFDIR@:/etc:g' dhcpcd.conf.5.in > dhcpcd.conf.5

if-bsd.c:146: error: 'struct sockaddr_in' has no member named 'sin_len'

if-bsd.c:147: error: 'struct sockaddr_in' has no member named 'sin_len'

if-bsd.c:149: error: 'struct sockaddr_in' has no member named 'sin_len'

if-bsd.c:156: error: 'SIOCAIFADDR' undeclared (first use in this function)Last edited by brian33x51 on Tue Jan 26, 2010 5:52 pm; edited 1 time in total

----------

## Hu

You are missing emerge --info.  :Wink:   We know from your post that you use ~amd64, but it would be nice to know the versions of some of the common tools, which will be included in the emerge --info output.

----------

## brian33x51

System uname: Linux-2.6.32-gentoo-r1-x86_64-Intel-R-_Xeon-R-_CPU_E5410_@_2.33GHz-with-gentoo-2.0.1

Timestamp of tree: Sat, 23 Jan 2010 00:30:01 +0000

distcc 3.1 x86_64-pc-linux-gnu [disabled]

ccache version 2.4 [disabled]

app-shells/bash:     4.0_p37

dev-java/java-config: 2.1.9-r1

dev-lang/python:     2.6.4, 3.1.1-r1

dev-util/ccache:     2.4-r8

dev-util/cmake:      2.8.0

sys-apps/baselayout: 2.0.1

sys-apps/openrc:     0.6.0-r1

sys-apps/sandbox:    2.2

sys-devel/autoconf:  2.13, 2.65

sys-devel/automake:  1.9.6-r2, 1.10.3, 1.11.1

sys-devel/binutils:  2.20

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.6b

virtual/os-headers:  2.6.30-r1

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe -march=native -pipe -fomit-frame-pointer"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -pipe -march=native -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sfperms splitdebug strict unmerge-logs unmerge-orphans userfetch"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

LDFLAGS="-Wl,-O1"

LINGUAS="en"

MAKEOPTS="-j9"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="64bit 7zip S3TC X a52 aac acl acpi alsa amd64 amr ao audiofile berkdb bluetooth branding bzip2 cairo ccache cdaudio cdda cdio cdr cilk cli consolekit corefonts cpufreq cracklib crypt cscope cups curl cxx d dbus dga dillo dirac dri dts dv dvd dvdr emboss encode evo exif expat faac faad fam ffmpeg firefox flac fortran fping gd gdbm gif glitz gnutls gpm gps graphviz gsm gstreamer gtk hal hou i18n iconv imagemagick imap ipv6 jpeg jpeg2k lame largefile lcms libffi libnotify libsamplerate libwww lvm lyx lzma lzo mad maps mikmod mjpeg mmap mmx mmxext mng modplug modules mp2 mp3 mp3rtp mp3tunes mp4 mp4live mpd mpeg mpeg2 mplayer mppe-mppc mpu401 mschap msn mtp mudflap multilib musepack music musicbrainz ncurses networkmanager nls nolvm1 nptl nptlonly nuv ogg ogm openal openexr opengl openmp pam pcre pdf perl plotutils png postproc ppds pppd proj python qt-static qt3-static qt3support qt4 quicktime raw readline reflection reiserfs rtc schroedinger screen sdl session shout sid smime smp sndfile sou sox speech speex spell spl sqlite3 sse sse2 sse3 ssl ssse3 startup-notification subtitles svg sysfs szip t1lib taglib tcpd tga theora threads threadsafe thunar tiff transcode truetype tta tv tvtime unicode usb v4l v4l2 vcd vcdinfo vcdx vim vim-pager voice vorbis wma wmf wmp x264 xfce xine xml xmp xorg xpm xulrunner xv xvid yv12 zlib" ALSA_CARDS="intel_hda" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="joystick mouse evdev keyboard ps2mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeonhd" 

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================

                        Package Settings

=================================================================

net-misc/dhcpcd-5.0.6 was built with the following:

USE="(multilib) zeroconf" 

CFLAGS="-O2 -pipe -march=core2 -mssse3 -pipe -fomit-frame-pointer"

CXXFLAGS="-O2 -pipe -march=core2 -mssse3 -pipe -fomit-frame-pointer"

----------

## d2_racing

Can you retry without zeroconf use flag ?

----------

## UberLord

It's trying to build the BSD interface. I'd assume that you're running Linux, hence the error.

Could you attach the output of the configure section please?

----------

## brian33x51

I'm the only one having these problems?  Or is no one running dhcpcd ?  Is dhcpcd even maintained anymore?

Would it just be easier to run some other dhcp client instead?

If I take the raw package, untar it and do the "configure/make" dance it fails even earlier in the build process.

Heres the requested output:

 * CPV:  net-misc/dhcpcd-5.1.4

 * REPO: gentoo

 * USE:  amd64 elibc_glibc kernel_linux multilib userland_GNU zeroconf

>>> Unpacking source...

>>> Unpacking dhcpcd-5.1.4.tar.bz2 to /var/tmp/portage/net-misc/dhcpcd-5.1.4/work

>>> Source unpacked in /var/tmp/portage/net-misc/dhcpcd-5.1.4/work

>>> Compiling source in /var/tmp/portage/net-misc/dhcpcd-5.1.4/work/dhcpcd-5.1.4 ...

./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/lib64 --prefix= --libexecdir=/lib/dhcpcd --dbdir=/var/lib/dhcpcd --localstatedir=/var --with-hook=ntp.conf --with-hook=yp.conf

Configuring dhcpcd for ... LINUX

Using compiler gcc

Testing for getifaddrs ... yes

Testing for arc4random ... no

Testing for closefrom ... no

Testing for getline ... yes

Testing for strlcpy ... no

Checking for ntpd ... /usr/sbin/ntpd (50-ntp.conf)

Checking for ypind ... /usr/sbin/ypbind (50-yp.conf)

Finding hook ntp.conf ... 50-ntp.conf

Finding hook yp.conf ... 50-yp.conf

   SYSCONFDIR =         /etc

   SBINDIR =            /sbin

   LIBDIR =             /lib64

   LIBEXECDIR =         /lib/dhcpcd

   DBDIR =              /var/lib/dhcpcd

   RUNDIR =             /var/run

   MANDIR =             /usr/share/man

   HOOKSCRIPTS =        50-ntp.conf 50-yp.conf

----------

## UberLord

 *brian33x51 wrote:*   

> I'm the only one having these problems?  Or is no one running dhcpcd ?  Is dhcpcd even maintained anymore?
> 
> Would it just be easier to run some other dhcp client instead?

 

I'm kinda insulted! I've been actively maintaining dhcpcd for years, and promptly fixing reported bugs.

This issue has not been reported before, and 5.1 got a new build system.

 *Quote:*   

> 
> 
> >>> Compiling source in /var/tmp/portage/net-misc/dhcpcd-5.1.4/work/dhcpcd-5.1.4 ...
> 
> ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/lib64 --prefix= --libexecdir=/lib/dhcpcd --dbdir=/var/lib/dhcpcd --localstatedir=/var --with-hook=ntp.conf --with-hook=yp.conf
> ...

 

That's the error right there, LINUX should be in lower case.

I'm guessing that $OS is being set in the build env somehow. Are you using portage or something else?

----------

## UberLord

Does this patch work?

```
diff --git a/configure b/configure

index 7de2a9b..b59b3c1 100755

--- a/configure

+++ b/configure

@@ -1,11 +1,18 @@

 #!/bin/sh

 # Try and be like autotools configure, but without autotools

+# Ensure that we do not inherit these from env

 HOOKSET=false

 ARC4RANDOM=

 CLOSEFROM=

 GETLINE=

 STRLCPY=

+OS=

+BUILD=

+HOST=

+TARGET=

+DEBUG=

+FORK=

 for x; do

        opt=${x%%=*}

```

----------

## brian33x51

Most definitely this seems to work with a local build.

For fun I created a dhcp-5.1.4-r1 with your patch and it built and installed properly.

----------

## UberLord

Groovy.

This has been committed upstream.

http://roy.marples.name/projects/dhcpcd/changeset/cbd9497b6c1cb3e6e87bfe8d4c729ffc7377fe30

I'll hopefully be making a new dhcpcd release this week.

----------

## d2_racing

Weird bug in fact.

----------

