[U-Boot] ARM tools-only CROSS_COMPILE issues within Cygwin

Chris Renshaw osm0sis at outlook.com
Sat May 20 03:53:26 UTC 2017


Hi!

I've managed to get U-Boot sandbox_defconfig tools-only compiling nicely in Cygwin with a few minor modifications to the source tree I hope you'll consider for proper inclusion:

	# Even with case insensitivity disabled, Cygwin does not handle execution of the file scripts/Kconfig and the directory scripts/kconfig correctly
	mv scripts/Kconfig scripts/Kconfig-scripts;
	sed -i 's;source "scripts/Kconfig";source "scripts/Kconfig-scripts";' Kconfig;
	
	# We can still be conservative with our standard without breaking the Cygwin compile completely (inline function issues)
	sed -i "s/HOSTCFLAGS\t+= -ansi/HOSTCFLAGS\t+= -std=gnu90/" Makefile;
	
	# Cygwin's compiler will create a .dll, not a .so
	sed -i 's/mv _libfdt.so/mv _libfdt.*/' tools/Makefile;

My problems arise when I then attempt to do the same for any Android NDK stand-alone cross-compiler through Cygwin. I've managed to get most other things to compile with this setup as the stand-alone is the preferred/only method to ensure a proper sysroot etc. when using Makefiles. The issues and some workarounds for getting any further with U-Boot sandbox_defconfig tools-only I've come up with so far are as follows:

1) Despite exporting the usual PATH and CROSS_COMPILE environment tools-only insists on using HOSTCC and creates Cygwin builds, so:

	export CROSS_BUILD_TOOLS=y CC="${CROSS_COMPILE}gcc";

2) The exports in #1 appear to have the desired effect and forces the CROSS_COMPILE toolchain to be used for the tool builds themselves, but produces further frustrations:

  HOSTCC  tools/gen_eth_addr
g:/cygwin/home/chris/x-tools/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe: error: g:/cygwin/home/chris/x-tools/arm-linux-androideabi-4.9/bin/../sysroot/usr/lib/libc.a(atexit.o): multiple definition of 'atexit'
g:/cygwin/home/chris/x-tools/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe: g:/cygwin/home/chris/x-tools/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9/crtbegin_dynamic.o: previous definition here
g:/cygwin/home/chris/x-tools/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -ldl
/s/ndk-toolchain/src/build/../gcc/gcc-4.9/libgcc/config/arm/lib1funcs.S:1337: error: undefined reference to 'raise'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [scripts/Makefile.host:99: tools/gen_eth_addr] Error 1
make: *** [Makefile:1413: tools-only] Error 2

3) Attempting to resolve #2 by specifying --sysroot= with *any* value (ie. what should be working paths like "/home/Chris/x-tools/arm-linux-androideabi-4.9/sysroot", "G:/cygwin/home/Chris/x-tools/arm-linux-androideabi-4.9/sysroot" or just a single nonsense word like "fubar") breaks the compiler even further:

  HOSTCC  tools/gen_eth_addr
In file included from ././include/compiler.h:19:0,
                 from ././include/libfdt_env.h:12,
                 from <command-line>:0:
g:\cygwin\home\chris\x-tools\arm-linux-androideabi-4.9\lib\gcc\arm-linux-androideabi\4.9\include\stdint.h:9:26: fatal error: stdint.h: No such file or directory
 # include_next <stdint.h>
                          ^
compilation terminated.
make[1]: *** [scripts/Makefile.host:99: tools/gen_eth_addr] Error 1
make: *** [Makefile:1413: tools-only] Error 2

I've attempted to throw -L and -I with various paths at it by adding them to the exported CC= override, both with -Wl, and without to no avail. Considering under Cygwin itself the tools build and the NDK stand-alone toolchains work perfectly for other things I feel like I'm close, so I'm wondering if there is anything I am missing or any fixes (e.g. to make CROSS_COMPILE work normally on Cygwin with tools-only, or, getting --sysroot to cooperate like it should) you could think of that might improve the situation.

Thank you for any insight or guidance you can provide!

Chris Renshaw


More information about the U-Boot mailing list