arduino/toolchain-avr

Windows build - package-avr-gcc.bash: C compiler cannot create executable

blogarithme opened this issue · 0 comments

Hi,
By adding packages to my Cygwin installation I was able to run the scripts tools.bash, binutils.build.bash, gcc.build.bash, avr-libc.build.bash and gdb.build.bash, without error. But when I run the last step package-avr-gcc.bash (in fact it rebuilds everything !) I get this error:

...
checking for gawk... gawk
checking to see if cat works as expected... yes
checking for gcc... mingw32-gcc -m32
checking for C compiler default output file name...
configure: error: in /cygdrive/c/toolchain-avr-master/binutils-build:
configure: error: C compiler cannot create executable
See config.log for more details.

The root cause of this error is easy to fix: In the script package-avr-gcc.bash the paths for MinGW and cygwin use a, by default, invalid syntax.

Line 67: export PATH=$PATH:/c/MinGW/bin/:/c/cygwin/bin/

This syntax /c/... to name the drive C: is not valid by default.
To use this syntax you have to edit the file /etc/fstab and replace this line
none /cygdrive cygdrive binary,posix=0,user 0 0
by this line
none / cygdrive binary,posix=0,user 0 0

Notes:

  • Using mount --change-cygdrive-prefix / is not enough because the PATH created before the execution of mount is not updated.
  • Because MinGW also uses this syntax I think it is safer to allow this syntax in Cygwin an leave the line 67 unmodified.

So, please, update the documentation to add these 2 Windows requirements:

  • Cygwin and MinGW must be installed on the drive C:
  • The file C:/cygwin/etc/fstab must be edited as explained above before to start the Cygwin console used to execute package-avr-gcc.bash.

Thanks.

PS: Cygwin mounts C:/cygwin/bin on /usr/bin, and adds /usr/bin to the PATH. So only a path to /c/MinGW/bin is required.

$ mount
C:/cygwin/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin on / type ntfs (binary,auto)
C: on /c type ntfs (binary,posix=0,user,noumount,auto)

$ echo $PATH
/usr/local/bin:/usr/bin:/c/WINDOWS/system32:...