hroptatyr/dateutils

Cross Compile (for arm) fails

hongkongkiwi opened this issue · 8 comments

I'm trying to cross compile the package for arm, but turns out it also cross compiles "yuck" and then tries to use the cross compiled version which results in:

>>> dateutils  Building
  GEN      version.mk
  GEN      yuck.m4i
/bin/bash: ./yuck-bootstrap: cannot execute binary file: Exec format error
make[2]: *** [Makefile:721: yuck.m4i] Error 1
/bin/bash: line 3: yuck: command not found
Making all in build-aux
  GEN      yuck.m4i
/bin/bash: ./yuck-bootstrap: cannot execute binary file: Exec format error
make[2]: *** [Makefile:721: yuck.m4i] Error 1
make[1]: *** [Makefile:491: all-recursive] Error 1
make: *** [package/pkg-generic.mk:250: /buildroot_output/build/dateutils/.stamp_built] Error 2

Can I pass a compiler flag to disable yuck? I don't want any docs or anything else, just the core tools on my system.

Hi,
yuck is just a code generator. With the latest patch (b57aab9) you can specify

$ ./configure --without-included-yuck YUCK=/bin/false

to skip building yuck. However, the .yucc files (and possibly .man etc.) must be generated somehow. Ideally you'd configure the thing twice (out-of-tree builds are possible), once with the included yuck, and once set up for cross compilation.

Then

$ ./configure --CROSS-COMPILE-STUFF --without-included-yuck YUCK=/path/to/host/yuck

should work.

Oh, and in case you're building the tarball it's much easier: Delete the GNUmakefile and kick build-aux from SUBDIRS in the main Makefile.

Unfortunately now I'm getting this error:
configure: error: cannot run test program while cross compiling

Any ideas? Is there a flag to not run the tests.

Here are my configure opts:
./configure --prefix=/root/buildroot/output/host --sysconfdir=/root/buildroot/output/host/etc --enable-static -q --target=arm-linux-uclibcgnueabihf --with-sysroot=/root/buildroot/output/host/arm-linux-uclibcgnueabihf/sysroot --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --with-gmp=/root/buildroot/output/host --with-mpc=/root/buildroot/output/host --with-mpfr=/root/buildroot/output/host --with-pkgversion='Buildroot 2021.02.1' --with-bugurl=http://bugs.buildroot.net/ --without-zstd --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --enable-tls --enable-plugins --enable-lto --enable-threads --without-isl --without-cloog --with-abi=aapcs-linux --with-cpu=cortex-a5 --with-fpu=neon-vfpv4 --with-float=hard --with-mode=arm --enable-languages=c,c++ --with-build-time-tools=/root/buildroot/output/host/arm-linux-uclibcgnueabihf/bin --enable-shared --disable-libgomp --silent

For reference, I'm not installing man pages, so no need to generate those.

Oh yes, that rings a bell. That is the test to determine the zone file layout. That test (and possibly others) isn't cross-compile-proof. I suppose you could set the variable ax_cv_zoneinfo_utc (and ax_cv_zoneinfo_utc) manually and comment out, or otherwise skip the test in the configure script.

ax_cv_zoneinfo_utc should be the first match of /usr/{share/zoneinfo,lib/zoneinfo,local/etc/zoneinfo,share/lib/zoneinfo}/{UTC,UCT,Universal,Zulu}.

ax_cv_zoneinfo_utc_right is safe to be ignored (for now), so you could just comment out the whole test.

Any chance for AX_ZONEINFO to be more cross-compile friendly?

Try dd9c667 for a configure run without deep inspection of zoneinfo files.

That helped, thanks! An additional issue that I ran into is that ltrcc will build for the --host instead of the --build (no HOSTCC/etc. type plumbing). I'm not sure if there's a canonical way of supporting that in a single build flow.

Thanks for reporting the ltrcc issue. Yes it seems tough. Without getting a second configure script involved that configures for --build==--host I don't see either how to get this built in a single build.

At the moment I feel this is over the top for something as trivial as generating a C file with a a few constants. So instead in 1bab114 I stooped to committing generated code.