Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do the C compilers on Cygwin generate?

Tags:

gcc

cygwin

mingw

Based on the output of the identify-compilers.sh script below, it appears that the following C compilers are available on Cygwin. Those labeled "Cygwin" require the cygwin1.dll file to be available.

What is the difference between the "pc" and "w64" compilers?

Why is there no x86_64-pc-mingw-gcc.exe executabe?

Are there any other C compilers available?

/usr/bin/gcc.exe                        64-bit  Cygwin
/usr/bin/i686-pc-cygwin-gcc.exe         32-bit  Cygwin
/usr/bin/i686-pc-mingw32-gcc.exe        32-bit
/usr/bin/i686-w64-mingw32-gcc.exe       32-bit
/usr/bin/x86_64-pc-cygwin-gcc.exe       64-bit  Cygwin
/usr/bin/x86_64-w64-mingw32-gcc.exe     64-bit

$ cat identify-compilers.sh
#!/bin/bash
for c in $(ls -1 /usr/bin/*gcc.exe); do
    echo === compiler: $c
    $c -o hello.exe hello.c
    objdump -p hello.exe | grep -i "cygwin"
    objdump -p hello.exe | grep -i "64$"
    rm hello.exe
done
like image 269
lit Avatar asked Sep 30 '22 06:09

lit


1 Answers

  1. gcc is just a hard link to x86_64-pc-cygwin-gcc

  2. x86_64-pc-cygwin-gcc and i686-pc-cygwin-gcc are as you have said the Cygwin compilers, that is to say the compilers that create programs that rely on cygwin1.dll

  3. x86_64-w64-mingw32-gcc and i686-w64-mingw32-gcc are compilers provided by the Mingw-w64 project

  4. i686-pc-mingw32-gcc is a compiler provided by the MinGW project

You may be wondering, why the two Mingw projects? Well the Mingw-w64 project was started because MinGW refused to adopt the 64-bit compiler. Between this and the starting of the MSYS2 project, I consider the MinGW project obsolete.

like image 84
Zombo Avatar answered Oct 06 '22 19:10

Zombo