Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross Compile (for arm) fails #128

Open
hongkongkiwi opened this issue Aug 4, 2021 · 8 comments
Open

Cross Compile (for arm) fails #128

hongkongkiwi opened this issue Aug 4, 2021 · 8 comments

Comments

@hongkongkiwi
Copy link

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.

hroptatyr added a commit that referenced this issue Aug 4, 2021
* bug/128:
  fix, PEBKAC, use YUCK as set by configure everywhere, fixes issue #128
@hroptatyr
Copy link
Owner

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.

@hroptatyr
Copy link
Owner

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.

@hongkongkiwi
Copy link
Author

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.

@hroptatyr
Copy link
Owner

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.

@opello
Copy link

opello commented Aug 9, 2021

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

@hroptatyr
Copy link
Owner

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

@opello
Copy link

opello commented Aug 10, 2021

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.

@hroptatyr
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants