Cross-compilation (was: Thank you for not using autoconf)
Laurent Bercot
ska-dietlibc at skarnet.org
Fri Jun 7 11:46:38 UTC 2013
> I think you misread what I wrote. The problem is needing to _run_ the
> test program. Proper autoconf tests simply test preprocessing,
> compiling, or linking, but not running the resulting executable. It's
> rare that you need to run a test program, and when you do, it's often
> a bug for other reasons.
I understand what you wrote, but I disagree here. Having to run a
test program is pretty common if you want to work around system bugs
or idiosyncrasies.
Some old rand() implementations have a bug where the least significant
bit isn't random at all. Some poll() implementations report EOF via
POLLIN, others via POLLHUP, others via both. Some pipe implementations
constantly report EOF to a reader once a writer has been opened then
closed, others report EOF on the first check only then do not trigger
poll() anymore. How do you test that kind of behaviour without running
a test program ?
> For instance you might test for a buggy
> version of some syscall, and find that it's working, but then get the
> buggy one at application-runtime when somebody runs your binary on an
> older kernel.
I remember making that exact point to you about signalfd() in musl,
arguing that the workaround you wrote might break build-time bug
detection. ;)
> So, basically what I'm saying is that if you need to probe _behavior_
> of an interface, that probing should be in your application itself,
> and it should be done when the application is run, rather than being
> part of the application's configure process.
Ah, OK, now I understand your stance on the matter - but I very much
disagree. You cannot ask applications to do run-time tests ! That is
totally dodging the main cross-compilation issue. Detecting
peculiar behaviours and making sure the application runs correctly is
not the application's job - can you imagine the duplicated code and
wasted cycles here ? The application's job is to run, end of story.
Making sure it runs well on a system is clearly a job for the
compilation/installation process, which does require running some
tests, which is precisely why cross-compiling is hard.
--
Laurent
More information about the busybox
mailing list