|
|
Log in / Subscribe / Register

A rift in the NTP world

A rift in the NTP world

Posted Feb 15, 2017 15:47 UTC (Wed) by rkeene (guest, #88031)
In reply to: A rift in the NTP world by fallenpegasus
Parent article: A rift in the NTP world

The information about building NTPSec provided by the parent commenter is wrong. Running "./waf build" returns the following error:

--- building host ---
The project was not configured: run "waf configure" first!

Further, running "./waf configure" fails predictably when cross-compiling (as generally you need to tell the system what platform is being targeted, though it could figure it out):
+ ./waf configure
Setting top to : /home/rkeene/devel/aurae/node/root/packages/ntpsec/workdir-pcXttoUpzzwX
Setting out to : /home/rkeene/devel/aurae/node/root/packages/ntpsec/workdir-pcXttoUpzzwX/build
--- Configuring host ---
Checking for 'gcc' (C compiler) : /home/rkeene/devel/aurae/common/compiler/online/x86_64-coreadaptive-linux/bin/gcc
Checking for program 'bison' : /home/rkeene/devel/aurae/common/detected-tools/bison
Checking compiler : no
The configuration failed
(complete log in /home/rkeene/devel/aurae/node/root/packages/ntpsec/workdir-pcXttoUpzzwX/build/config.log)

The "build.log" referenced is full of escape sequences that hinder readabilty (but I'm sure if I were using "cat" to view it would make it very colorful on my terminal) and a huge, hundred or so line Python stack trace that, from what I can gather from the stack trace, means it tried to run the code it just compiled... which of course won't work, since the code being generated isn't for the platform I'm compiling it on.

Helpfully, an "INSTALL" file is provided which tells us how to cross-compile NTPSec:

== Cross-compiling ==

Set up a cross-compile environment for the target architecture. At minimum
it will need its own binaries for the OpenSSL library.

Configure NTPSec with:

waf configure --enable-cross=/path/to/your/cross/cc

But when we actually try to use that:
+ ./waf configure --enable-cross=gcc
waf [commands] [options]
<...hundreds of lines of usage omitted...>
waf: error: no such option: --enable-cross

The usage information, however, indicates a different option of:
--cross-compiler=CROSS_COMPILER

So we try with that...
+ ./waf configure --cross-compiler=gcc
Setting top to : /home/rkeene/devel/aurae/node/root/packages/ntpsec/workdir-oyqK4b6LB8gE
Setting out to : /home/rkeene/devel/aurae/node/root/packages/ntpsec/workdir-oyqK4b6LB8gE/build
--- Configuring host ---
Checking for 'gcc' (C compiler) : /home/rkeene/devel/aurae/common/compiler/online/x86_64-coreadaptive-linux/bin/gcc
Checking for program 'bison' : /home/rkeene/devel/aurae/common/detected-tools/bison
Checking compiler : no
The configuration failed
(complete log in /home/rkeene/devel/aurae/node/root/packages/ntpsec/workdir-oyqK4b6LB8gE/build/config.log)

And the build.log looks like the same stack trace as before.

Let's assume "waf" is really dumb and tries to look at the filename of my compiler to determine the platform and give it a different name -- no change.

Let's assume it's ultra-extra dumb and is running "$CC" expecting it to be a native-compiler instead of using HOST_CC or CC_FOR_BUILD -- that seems to have gotten us further !

+ CC="${CC_FOR_BUILD}" ./waf configure --cross-compiler=gcc
Setting top to : /home/rkeene/devel/aurae/node/root/packages/ntpsec/workdir-JoHiSwi4ewtB
Setting out to : /home/rkeene/devel/aurae/node/root/packages/ntpsec/workdir-JoHiSwi4ewtB/build
--- Configuring host ---
Checking for 'gcc' (C compiler) : /home/rkeene/devel/aurae/common/detected-tools/gcc
Checking for program 'bison' : /home/rkeene/devel/aurae/common/detected-tools/bison
Checking compiler : yes
Compiler found : GCC
...
Asking python-config for pyembed '--cflags --libs --ldflags' flags : yes
Testing pyembed configuration : yes
Asking python-config for pyext '--cflags --libs --ldflags' flags : yes
Testing pyext configuration : Could not build python extensions
The configuration failed
(complete log in /home/rkeene/devel/aurae/node/root/packages/ntpsec/workdir-JoHiSwi4ewtB/build/config.log)

At this point, things are failing because it's asking our build system's "python-config" how to compile a Python extension, which differs from the host system Python... but there doesn't seem to be a way to tell it to use the correct "python-config", so we play some PATH tricks and get going further...

At this point, after reading the wrong comment, wrong documentation, and finally following the usage information and making a few guesses, then some workarounds ... the configuration is complete. Time to build it !

Of course there's no Makefile but the INSTALL documentation says we should NOW do "./waf build". It seems to work -- it's a bummer that it's not using a Makefile since it would otherwise integrate into the parallel build system.

Now we have to figure out how to install it -- with no conventional "make install DESTDIR=..." and the INSTALL file lacking (hey, atleast it's not just wrong this time) information on how to use DESTDIR. There seems to be a --destdir option to "waf", we try it out and it works on the first try... but at this point we notice we forgot to specify "--prefix" and "--sbindir" options to the configure step...

But there's no option for "--sbindir" and the "--bindir" option doesn't stop it from installing "ntpd" in /sbin, so we have to move it to the correct directory after the installation completes... and finally, we have a working package.


to post comments

A rift in the NTP world

Posted Feb 20, 2017 19:55 UTC (Mon) by fallenpegasus (guest, #58173) [Link] (2 responses)

Thank you for discovering those issues with our INSTALL file instructions for cross compiling. We're now working on fixing them.

A rift in the NTP world

Posted Feb 20, 2017 23:08 UTC (Mon) by nix (subscriber, #2304) [Link] (1 responses)

Er, if you think the problem there was just with the *instructions*, you're missing something. Not supporting DESTDIR in this day and age will make packagers want to strangle you. Not supporting parallel make is even worse.

Was this *really* an improvement? It's not looking anything like one from where I'm sitting. Any autobuilder out there understands configure/make/make install based systems supporting DESTDIR, like upstream ntp, and will at most need telling "use configure, here are the configure script options". Handling your special snowflake build system will be a lot more work, a lot more cursing, and a lot more packagers asking "why does this project even exist?".

(I hate scons too. Building Samba 4 wasn't terribly pleasant, either, particularly not for platforms with no Python installation but with a working compiler. I actually had to have the autobuilder *compile Python first*, install it in a virtualenv, then build Samba with that. Samba was worth it -- just. ntpsec... wouldn't be.)

A rift in the NTP world

Posted Feb 20, 2017 23:19 UTC (Mon) by Cyberax (✭ supporter ✭, #52523) [Link]

WAF supports DESTDIR out of box, but it's a command-line option and not a variable. It also is parallel, but since it doesn't integrate with make's job server it can't be parallel across multiple builds.

A rift in the NTP world

Posted May 21, 2020 14:08 UTC (Thu) by hridhya09 (guest, #139051) [Link]

Can you share the steps for ntpsec implementation working package

A rift in the NTP world

Posted May 27, 2020 9:26 UTC (Wed) by hridhya09 (guest, #139051) [Link]

I need a recipe for implementing ntpsec in an arm system


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds