Fixing cross compile armhf tangle

James Browning jamesb192 at jamesb192.com
Fri Jan 31 15:55:51 UTC 2025


> On 01/31/2025 12:59 AM PST Hal Murray via devel <devel at ntpsec.org> wrote:
> 
> 
> Currently, our CI cross compile armhf case is failing. We discussed this
> back in Sept and I fixed things by handling each of 5 cases individually.
> It turns out there are more than 5 cases. I missed the others so that's
> why cross armhf is currently failing.
> 
> I can add another handful of special cases, but that's getting pretty ugly.
> 
> So I'm investigating some waf hackery to get the size of a sample slot.

I just glanced at RFC 1589 (which the man page does not mention,
grrr). The spec there is annoyingly short-sighted. The timeval spec
FYI calls for 'two 32-bit words;' the RFC specifies most of the
values as longs, two of the five error cases are longs, and the
other three appeared outside the RFC.

TLDR: I've found that redefining them as time_t works on Linux systems. I have not tested it on other systems, though.

> wafhelpers/check_sizeof.py has separate code for the normal and cross
> cases. The cross case goes through a loop. Can somebody tell me why that
> needs a loop?
> 
> I was expecting something like compile this code with the target/cross
> include headers and compiler options to get things like the 32/64 options
> but generate code for this system so we can run it to get the answer.

It's probably over-generalized to also find things like 24-bit pointers and 80-bit floats. I think what you are trying to do would involve much knuckle grinding.  As a useless alternative, I suggest a scriptlet that would feed ${other_include}/sys/timex.h through cpp and then sed to get the likes '__syscall_slong_t' and then 'long int' as the type for all of those on Linux amd64.

the following does not work.

```sh
cpp -I${other_include} ${other_include}/sys/timex.h \
    |sed '/^#/d'>timex_blob.h
for m in esterror freq jitter maxerror offset ppsfreq precision \
    stabil tolerance; do
        a=$(sed -rn "^struct timex/,/^}/{s/[ \t]*([^ \t])[ \t]+$m.*$/\1/p}");
        t=$(sed -rn 's/__syscall_slong_/{/[ \t]*typedef[ \t]+.+[ \t]+$a.*$/p}');
        echo "$m:\t'$t'";
done
```

-30-


More information about the devel mailing list