#971249 waf: CHECK_VALUEOF does not work during cross compilation

Package:
src:tevent
Source:
tevent
Submitter:
Helmut Grohne
Date:
2022-05-08 20:27:04 UTC
Severity:
normal
Tags:
#971249#5
Date:
2020-09-28 04:53:03 UTC
From:
To:
Thank you for applying my previous cross build patches. My previous
installment ended with:

I've now looked into this and think that there are two bigger steps to
solve these. In the "probably more" department, there is a recurring
scheme of using a "CHECK_VALUEOF". It is used to determine the value of
an integer. If that value happens to be a compile time constant, it can
be determined using bisection. waf already does something similar in
CHECK_SIZEOF. I've implemented it for CHECK_VALUEOF and it now works
similar to autoconf's AC_COMPUTE_INT. In particular, it only does the
expensive bisection during cross compilation. In a native build, it
continues to use the quick run test it did before. I've attached a patch
for this.

For the mkstemp thingy there is little we can do. You cannot check this
property without running code. So during cross compilation, all you can
do is assume that it works. I think the solution will be adding

#971249#10
Date:
2022-05-06 08:40:01 UTC
From:
To:
Umm. waf in samba is doing many "bad" things which can be done in a more
efficient way not requiring to run compiled binaries. Yes, sizeof(foo) is
a good example, valueof is another example.

I think it is too much work to patch all these things out in debian.
It might be a good idea to try to ping upstream about this, maybe they'll
include similar change(s) to make cross-compilations easier.  But probably
not in Debian.

I'd not spend more time on trying to make waf-based samba builds to be
cross-compilable, unless upstream is actually willing to accept the
work somehow. So far, it seems like upstream isn't willing even to
accept simple spelling fixes.

FWIW, Helmut, what do you think about using qemu-user[-static] to help
cross-compiling stuff? It should significantly help in situations like
this one, to be able to run the small test binaries in an emulated mode,
provided you do have the foreign libs installed on the system.  Yes it
is not the fastest, but for sizeof/valueof tests like this it will
Just Work, hopefully...

Thanks,

/mjt

#971249#15
Date:
2022-05-08 20:03:29 UTC
From:
To:
Samba regularly accepts changes to improve cross-compilation.  We test
a lame cross-compilation mode in our autobuild and would love to have
both an improved test (that is more realistic) and any improvements our
user community can find.

We regularly accept patches that are correctly signed off and submitted
to GitLab per https://wiki.samba.org/index.php/Contribute

This would seem to be the best route forward, per:

https://wiki.samba.org/index.php/Waf#Using_--cross-execute

Andrew Bartlett