0

I am trying to build a arm RPI4 crosscompiler and toolchain on cygwin on windows 10 with ctosstool-ng-1.24.0

The process works fine generating a arm RPI4 toolchain from ubuntu 20.4 host but fails on windows 10

The Prebuilt Windows Toolchain for Raspberry Pi have gold linker issue that fails to resolve gtk-3 and gdk-3 dependencies libs on windows. so I am trying to see if a newly generated one will resolve the problem.

ctosstool-ng build fails on cygwin for armv8-rpi3-linux-gnueabihf consistently with a flurry of

[ERROR]      /usr/include/sys/features.h:322:5: error: "_FORTIFY_SOURCE" is not defined, evaluates to 0 [-Werror=undef]

followed by

[EXTRA]      Installing C library start files
[ERROR]      ../include/link.h:43:57: error: unknown type name 'Lmid_t'; did you mean 'pid_t'?
[ERROR]      ../sysdeps/posix/dl-fileid.h:27:5: error: unknown type name 'ino64_t'
[ERROR]      ../sysdeps/posix/dl-fileid.h:35:17: error: storage size of 'st' isn't known
[ERROR]      ../sysdeps/posix/dl-fileid.h:37:37: error: '_STAT_VER' undeclared (first use in this function)
[ERROR]      /usr/include/cygwin/core_dump.h:19:10: fatal error: windows.h: No such file or directory
[ERROR]      /usr/include/cygwin/core_dump.h:19:10: fatal error: windows.h: No such file or directory
[ERROR]      make[3]: *** [../Makerules:287: /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.h] Error 1
[ERROR]      make[3]: *** Waiting for unfinished jobs....
[ERROR]      make[3]: *** [../Makerules:287: /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tcb-offsets.h] Error 1
[ERROR]      /usr/include/cygwin/core_dump.h:19:10: fatal error: windows.h: No such file or directory
[ERROR]      make[3]: *** [../Makerules:287: /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/rtld-global-offsets.h] Error 1
[ERROR]      make[2]: *** [Makefile:258: csu/subdir_lib] Error 2
[ERROR]      make[1]: *** [Makefile:9: csu/subdir_lib] Error 2
[ERROR]  /
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Building for multilib 1/1: '''
[ERROR]  >>        called in step 'Installing C library headers & start files'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@376]
[ERROR]  >>        called from: glibc_backend_once[scripts/build/libc/glibc.sh@374]
[ERROR]  >>        called from: CT_IterateMultilibs[scripts/functions@1586]
[ERROR]  >>        called from: glibc_backend[scripts/build/libc/glibc.sh@74]
[ERROR]  >>        called from: glibc_start_files[scripts/build/libc/glibc.sh@38]
[ERROR]  >>        called from: do_libc_start_files[scripts/build/libc.sh@28]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@696]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      https://crosstool-ng.github.io/docs/known-issues/
[ERROR]  >>
[ERROR]  >>  If you feel this is a bug in crosstool-NG, report it at:
[ERROR]  >>      https://github.com/crosstool-ng/crosstool-ng/issues/
[ERROR]  >>
[ERROR]  >>  Make sure your report includes all the information pertinent to this issue.
[ERROR]  >>  Read the bug reporting guidelines here:
[ERROR]  >>      http://crosstool-ng.github.io/support/
[ERROR]  /
[ERROR]  (elapsed: 130:50.55)
[131:02] / make: *** [ct-ng:261: build] Error 2

I have tried cygwin gcc version 9.3 and 11.3 and also, under menuconfig, glib2.28 and glib2.24. All of them fail at the "libc_start_files" step after installing kernel_headers.

Steps followed from :

$ ../configure --prefix=<install-dir>
$ make
$ make install
$ ./ct-ng armv8-rpi3-linux-gnueabihf
$ ./ct-ng menuconfig (choose glib 2.28)
$ ./ct-ng build

Link to : build logs .config make and make-install logs

If anyone has else succeeded on building this on windows host please share your steps/configuration.

===[UPDATE 1] ===

It looks like c:/cygwin64//usr/include cygwin env is being included in the compiler options. I located ac_cv_env_CPPFLAGS_value=-Ic:/cygwin64//usr/include in build/build-libc-startfiles/multilib/config.cache. But not sure if thats the one causing linux files into cygwin64 includes.

gawk -f ../scripts/gen-as-const.awk ../sysdeps/arm/tlsdesc.sym |
arm-unknown-linux-gnueabihf-gcc  -O2 -D_FORTIFY_SOURCE=0  
-mlittle-endian   -mcpu=cortex-a53  -mfpu=neon-vfpv4 -mhard-float    
-S -o /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.hT3 
-std=gnu11 -fgnu89-inline  -O2 -Wall -Wundef -Wwrite-strings 
-fmerge-all-constants -fno-stack-protector -frounding-math -g 
-Wstrict-prototypes -Wold-style-definition -fno-math-errno     
-ftls-model=initial-exec   

-U_FORTIFY_SOURCE -Ic:/cygwin64//usr/include  

< rest pf of the includes are from under the .build dir >
... -I.. -I../libio -I. -nostdinc -isystem  .... 
-DTOP_NAMESPACE=glibc       -DGEN_AS_CONST_HEADERS -x c -   
-MD -MP -MF /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.h.dT 
-MT '/cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.h.d 
/cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.h'

Also its not clear how these propagate from the root build directory into the component build/compiler options.

Any suggestion to track/debug the compiler options will be most helpful.

===

Has anyone encountered these errors?

What could be causing them?

Please share any experience you have on the above.

Frant
  • 5,382
  • 1
  • 16
  • 22
sith
  • 447
  • 7
  • 15
  • `windows.h` belongs to `w32api-headers` package. https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86_64%2Fw32api-headers%2Fw32api-headers-9.0.0-1&grep=windows.h – matzeri Jan 19 '22 at 10:11
  • In general, it is unlikely that a cross tool designed around Linux will easily run under another system. You need to look one error at time and see if the upstream code is going for wrong path following bad assumption. For the first error `Lmid_t` exists on Linux, but does not on Cygwin. See `dlfcn.h` and https://man7.org/linux/man-pages/man3/dlopen.3.html – matzeri Jan 19 '22 at 10:22
  • @matzeri - thanks - in 2016 or so I had to hack quite a few compiler errors like this for a arm toolchain generation on cygwin and obviously thats obsolete now, so I am trying to generate one again. I will look into the links you have posted. – sith Jan 20 '22 at 09:45
  • @matzeri Following your links - I suspect c:/cygwin64//usr/include cygwin env is being included in the compiler options. Please see update above. If you can suggest ways to track the compile/build arguements to the components. – sith Jan 21 '22 at 14:47

0 Answers0