[ntp:questions] Help with cross-compiling NTP for the Raspberry Pi requested

Harlan Stenn stenn at ntp.org
Sat Mar 8 06:53:23 UTC 2014

--target should not be needed.

Only --build (where is it being built) and --host (where will it be
running) should matter.

Brian Inglis writes:
> On 2014-03-07 13:42, David Taylor wrote:
> > On 07/03/2014 18:10, Charles Swiger wrote:
> >> Hi--
> >>
> >> On Mar 7, 2014, at 7:30 AM, David Taylor <david-taylor at blueyonder.co.uk.in
> valid> wrote:
> >> [ ... ]
> >>> No, still getting an ntpd which is 2.87 MB in size, whereas on the Raspbe
> rry Pi native build it's 2.0 MB.  The Intel Debian version is 2.74 MB.
> >>
> >> Run 'file ntpd' to see which architecture it's compiled for.  (The size of
>  ntpd is not especially relevant...)
> >>
> >> Regards,
> >
> > Thanks, Chuck.  That's interesting - I get:
> >
> > ntpd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically link
> ed (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0x0ab8a3efbd066aa2
> 59e20d9abedbe4d1a0d1d1ba, not stripped
> >
> > So if I read that correctly, I have ended up with a 64-bit Intel version in
> stead of a 32-bit ARM version.  I was using the file size in the expectation 
> that if a cross-compile had worked, the executable should have been quite sim
> ilar in size to a native build.
> That you are getting an Intel build shows you are not cross-compiling.
> You should be able to check what you are building on by looking under
> /usr/lib/gcc/, but that may depend on your distributions: use .../...gcc -v a
> nd
> check what they say after --host=, --target, --*prefix, and --...dir=.
> All gcc distributions (and) can/should be configured and installed under the
> same base dirs differing only in their host/target triple subdirectory.
> Your cross-compiler will probably be built with --build==--host and
> --target=arm-bcm2708hardfp-linux
> You may also have different binutils under e.g. /usr/<prefix>/bin to handle
> different object file format variations, and that dir may also need to be
> added to your path, if not installed in standard gcc  dir locations.
> With your current setup, looks like you should be running configure as:
> PATH=/home/david/kernel/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm
> -bcm2708hardfp-linux-gnueabi/bin:$PATH\
> ./configure --build=x86_64-unknown-linux --host=arm-bcm2708hardfp-linux-gnuea
> bi --target=arm-bcm2708hardfp-linux-gnueabi\ --enable-linux-caps
> but -unknown- could be -pc-, and you may also need a different binutils dir
> at the head of the path.
> (Re-)read the environment/cross-compiling notes for gcc and autoconf
> (type info gcc and info autoconf and look for environment and targets)
> to ensure you have everything required available in the right places,
> and have modified what the configure and make processes require to
> cross-compile.
> Shell scripts are your friends for this because you can reproduce
> and reverse whatever you need to do to setup your cross-environment,
> within the shell child environment, without breaking your normal
> Linux shell environment.
> You may need to do something like create an RPi-cross-bin directory,
> symlink cross-compiler components into that ...bin using their normal
> names, without any cross-compile prefix, then add that ...bin directory
> to the head of your path while you are cross-configuring and compiling,
> so that autoconf and gcc get to see what they expect to see, if the NTP
> setup requires tweaks to cross-compile.
> You may want to first try copying over all the configure generated
> files from the native RPi build, modify those and/or the environment,
> and try make.
> You could also try backing up your Linux cross-compile directories
> to another set of directories, and also copy across your whole
> native RPi compiler environment to a different set of directories,
> and diff both sets of include, SO, and lib directory contents
> to check for any differences between your cross- and native RPi
> compiler environments.
> You could then try to cp -f the contents of your native RPi compiler
> include, SO, and lib directory contents over the relevant cross-compiler
> environment directories, excluding of course the native Linux cross-compiler
> (and perhaps binutils) executables, SOs, and libs.
> This should ensure that the cross- and native RPi compilers are working
> with the same source and object libraries you have on your RPi.
> When you have managed a cross-configure, diff the generated files
> against those from your native RPi configure, to see if there is
> anything you may need to tweak, before you cross-make anything.
> -- 
> Take care. Thanks, Brian Inglis
> _______________________________________________
> questions mailing list
> questions at lists.ntp.org
> http://lists.ntp.org/listinfo/questions

More information about the questions mailing list