arduino / toolchain-avr

The AVR toolchain used by the Arduino IDE
142 stars 48 forks source link

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

Open ghost opened 3 years ago

ghost commented 3 years ago

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:

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

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:...