On Wed, 05 Mar 2014 09:43:34 +0000, David Taylor wrote: > I am trying to cross-compile NTP for the Raspberry Pi, and I am > following the instructions for NTP here: > > http://support.ntp.org/bin/view/Dev/Cross-compilingNTP > > and the successful cross-compile I did for the RPi kernel here: > > http://www.satsignal.eu/raspberry-pi/kernel-cross-compile.html > > Just following the "NTP" instructions, although I did end up with > executables, they did not run on the RPi (giving an error something like > "binary format error"), and their size is very similar to the > executables for the Intel Debian system on which I was cross compiling. > So it seems to me that I have not cross-compiled but natively > compiled. > > With the RPi kernel compile, I needed to create a couple of environment > variables: > > CCPREFIX PLATFORM > > and run a make/compile command like: > > make ARCH=arm CROSS_COMPILE=${CCPREFIX} > > whereas the NTP instructions suggest using just a "make" command. I > also see differences in the make/install command between the two sets on > instructions: > > NTP: > make DESTDIR=`pwd`/:Built install > > RPi: > MODULES_TEMP=~/modules export MODULES_TEMP make ARCH=arm > CROSS_COMPILE=${CCPREFIX} > INSTALL_MOD_PATH=${MODULES_TEMP} modules_install > > Now this could be due to the RPi command being for a Kernel compile, and > the NTP one being for a set of executables. Perhaps there is no problem > here. >
The description on http://support.ntp.org/bin/view/Dev/Cross-compilingNTP mentions a "proper" cross-compile environment and somewhat later continues with "gcc (which is symlinked to <name-of-cross-compiler>)" I think that "proper" is a somewhat ambiguous description. Although it is perfectly possible to symlink gcc to a cross compiler one has to be careful to be sure that the proper compiler is used at the right time: when you want to cross compile it MUST use the path to the link and when you want a native compile it MUSTN'T. IMO this can easily go wrong, as you have experienced, when not all is under control and therefore it is not a robust description for a general cross compile. In case of 'configure' based (autoconf) build, it is usual to select the desired (cross)compiler using the CC environment variable. I guess this may work (not tested): First setup CCPREFIX as you did with the kernel build I assume 'echo ${CCPREFIX}/gcc' points to the crosscompiler (*) Then cd <your_build_dir> CC=${CCPREFIX}/gcc ../configure make make DESTDIR=`pwd`/:Built install (although personally I don't like directorynames with ':', e.g. I would use something like `pwd`/build) (*) Check if ${CCPREFIX}/gcc --version shows the cross compiler version, otherwise when ${CCPREFIX} --version shows the cross compiler version omit /gcc in above description. -- Rob _______________________________________________ questions mailing list [email protected] http://lists.ntp.org/listinfo/questions
