heimdal
heimdal copied to clipboard
Cross compilation fails
Describe the bug
I'm not able to cross compile Heimdal I've tried latest release: 7.7.0 and current master: https://github.com/heimdal/heimdal/commit/56b60a1a40022b651091933200dbefd087e32805
To Reproduce
- Clone the repo
- Run
sh autogen.sh
- Run
./configure --prefix=/tmp/test_heimdal --build=x86_64-linux-gnu --host=aarch64-linux-gnu
- Run
make
- Build fails with:
CCLD asn1_compile
asn1_compile --one-code-file --template --option-file=./rfc2459.opt ./rfc2459.asn1 rfc2459_asn1 || (rm -f rfc2459_asn1_files ; exit 1)
/bin/bash: asn1_compile: command not found
Makefile:2372: recipe for target 'rfc2459_asn1_files' failed
make[2]: *** [rfc2459_asn1_files] Error 1
make[2]: Leaving directory '/tmp/heimdal/heimdal/lib/asn1'
Makefile:589: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/heimdal/heimdal/lib'
Makefile:632: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
Expected behavior
I need this to be able to build Heimdal for the Julia BinaryBuilder: https://docs.binarybuilder.org
Desktop
- OS: Ubuntu 18.04.6 LTS
Additional context
It looks like there is something wrong with the makefiles, when doing cross compilation:
This fails:
./configure --prefix=/tmp/test_heimdal --build=x86_64-linux-gnu --host=aarch64-linux-gnu && make
Here we have:
$ grep ASN1_COMPILE lib/asn1/Makefile | head -1
ASN1_COMPILE = asn1_compile
This works:
./configure --prefix=/tmp/test_heimdal && make
Here we have:
$ grep ASN1_COMPILE lib/asn1/Makefile | head -1
ASN1_COMPILE = $(top_builddir)/lib/asn1/asn1_compile$(EXEEXT)
This looks more correct.
Cross-compiling Heimdal does not work. Its unclear when it worked last. The challenge is that Heimdal builds and executes many in-tree binaries which depend on in-tree libraries in order to generate the final output. The in-tree binaries and libraries are also the output. For cross-compilation to succeed the build system will need to build some targets multiple times at different stages of the build and execute the correct version locally. The build system clearly does not handle this case today.
Besides that, for lib/asn1
in particular we need make absolutely sure that we use the correct sizeof()
and offsetof()
expressions if we're cross-compiling, and we almost certainly do not, especially in the "template" backend of the compiler!
To make cross-compilation work we'd have to:
- build executables we need for both, the build and the release, twice: once for the local build and once for the release
- fix
lib/asn1/gen_template.c
- produce something that one can run
make check
with on the target system - maybe other things.
I'm going to close this, though it'd be really nice to have cross-compilation working.