cross-compile dhcp-4.2.5 and bind-9.8.4-P1

Trevor Bowen trevorbowen at gmail.com
Thu Feb 7 21:54:17 UTC 2013


Hi,

I have seen several posts on this subject, which have helped me over several 
hurdles; however, I am still having trouble cross-compiling the latest 
dhcp-4.2.5, specifically the subdir, bind (bind-9.8.4-P1).  It seems that my 
cross-compile settings are not being properly handed down to the bind sub-build.

Does anyone have a working cross-compile for dhcp-4.2.5?  Could you share 
your configuration?  Here is what I am doing (see below).

It seems some serious hacking is required on the Makefile and Makefile.in 
files all throughout the code tree to either manually propagate the 
cross-compile settings or to hard-code them.  Have I overlooked something?

Thanks!

Trevor

-----------------------------------------------------------------------
$ wget ftp://ftp.isc.org/isc/dhcp/4.2.5/dhcp-4.2.5.tar.gz
$ tar -zxvf dhcp-4.2.5.tar.gz
$ cd dhcp-4.2.5
$ ## Define cross-compile variables globally
$ export ARCH=powerpc
$ export TOOLCHAIN_BASE=/opt/freescale
$ export 
TOOLCHAIN_BIN=${TOOLCHAIN_BASE}/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe/bin
$ export CROSS_COMPILE=${TOOLCHAIN_BIN}/powerpc-none-linux-gnuspe-
$ export 
PATH="${TOOLCHAIN_BASE}/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe/powerpc-none-linux-gnuspe/bin:${TOOLCHAIN_BASE}/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe/libexec/gcc/powerpc-none-linux-gnuspe/4.3.2:${PATH}"
$ export AS=${CROSS_COMPILE}as
$ export LD=${CROSS_COMPILE}ld
$ export CC=${CROSS_COMPILE}gcc
$ export CXX=${CROSS_COMPILE}g++
$ export AR=${CROSS_COMPILE}ar
$ export NM=${CROSS_COMPILE}nm
$ export STRIP=${CROSS_COMPILE}strip
$ export SSTRIP=${CROSS_COMPILE}sstrip
$ export RANLIB=${CROSS_COMPILE}ranlib
$ export READELF=${CROSS_COMPILE}readelf
$ export OBJCOPY=${CROSS_COMPILE}objcopy
$ export OBJDUMP=${CROSS_COMPILE}objdump
$ export BLDSHARED="${CROSS_COMPILE}gcc -shared"
$ export LDSHARED="${CROSS_COMPILE}gcc -shared"
$ export HOSTARCH=ppc-linux
$ export BUILDARCH=i686-linux-gnu
$ CROSS_COMPILE=${CROSS_COMPILE}              \
AS=${AS}                                    \
LD=${LD}                                    \
CC=${CC}                                    \
CXX=${CXX}                                  \
AR=${AR}                                    \
NM=${NM}                                    \
STRIP=${STRIP}                              \
SSTRIP=${SSTRIP}                            \
RANLIB=${RANLIB}                            \
READELF=${READELF}                          \
OBJCOPY=${OBJCOPY}                          \
OBJDUMP=${OBJDUMP}                          \
BLDSHARED="${BLDSHARED}"                    \
LDSHARED="${LDSHARED}"                      \
HOSTARCH=powerpc-linux                      \
BUILDARCH=i686-linux-gnu                    \
./configure                                 \
     --host=powerpc-linux                    \
     --build=i686-linux-gnu                  \
     --exec-prefix=/                         \
     --prefix=/usr/local                     \
     --sysconfdir=/etc                       \
     --mandir=/usr/share/man                 \
     ac_cv_file__dev_random=yes
## Apply cross-compile variables to MAKE command line
$ CROSS_COMPILE=${CROSS_COMPILE}              \
AS=${AS}                                    \
LD=${LD}                                    \
CC=${CC}                                    \
CXX=${CXX}                                  \
AR=${AR}                                    \
NM=${NM}                                    \
STRIP=${STRIP}                              \
SSTRIP=${SSTRIP}                            \
RANLIB=${RANLIB}                            \
READELF=${READELF}                          \
OBJCOPY=${OBJCOPY}                          \
OBJDUMP=${OBJDUMP}                          \
BLDSHARED="${BLDSHARED}"                    \
LDSHARED="${LDSHARED}"                      \
HOSTARCH=powerpc-linux                      \
BUILDARCH=i686-linux-gnu                    \
make V=1
Making all in bind
make[1]: Entering directory `/home/tbowen/dhcp-4.2.5/bind'
Configuring BIND Export libraries for DHCP.
configure: error: in `/home/tbowen/dhcp-4.2.5/bind/bind-9.8.4-P1':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/tbowen/dhcp-4.2.5/bind'
make: *** [all-recursive] Error 1
$ cd bind/
CROSS_COMPILE=${CROSS_COMPILE}              \
AS=${AS}                                    \
LD=${LD}                                    \
CC=${CC}                                    \
CXX=${CXX}                                  \
AR=${AR}                                    \
NM=${NM}                                    \
STRIP=${STRIP}                              \
SSTRIP=${SSTRIP}                            \
RANLIB=${RANLIB}                            \
READELF=${READELF}                          \
OBJCOPY=${OBJCOPY}                          \
OBJDUMP=${OBJDUMP}                          \
BLDSHARED="${BLDSHARED}"                    \
LDSHARED="${LDSHARED}"                      \
HOSTARCH=powerpc-linux                      \
BUILDARCH=i686-linux-gnu                    \
make V=1
bind-9.8.4-P1 already unpacked...
Configuring BIND Export libraries for DHCP.
configure: error: in `/home/tbowen/dhcp-4.2.5/bind/bind-9.8.4-P1':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
make: *** [all] Error 1



More information about the dhcp-users mailing list