Hi,
I wonder why both make implementations (i.e. mingw32-make and MSYS make) have "CC=cc" preset, although the C compiler in MinGW is called "gcc".
A binary called "cc" simply does not exist in MinGW and "make" is thus defective by design. Even a most simple Makefile like "all: test", where test.c is e.g. a hello world program, fails with
$cat Makefile
all: test
$make
cc test.c -o test
make: cc: Command not found
make: *** [test] Error 127
The CC variable is not even left undefined, it is explicitely set to "cc", so even macros like "CC?=gcc" do not work. This does not really add to portability.
I understand if make implementations should be kept as little GNU-specific as possible, but then I wonder why "CXX=g++" is preset at the same time.
Cheers,
Fabian
It is POSIX behavior to set CC=cc by default and I think CXX should be set to c++ and not g++. Except, checking my older 3.79.1 version of MSYS make CC defaults to gcc and CXX defaults to g++. And I'm remembering now having to use CC=gcc in the environment for Makefiles in some package I built once that explicitly set CC=cc in the Makefile.
I confirm that CC should default to gcc and not cc. I don't know if this is an upstream issue or a MinGW build issue so I'll let the package maintainer follow up with this. However, I'm able to set CC=gcc in the environment and set CC = gcc in the Makefile to change the value.
<Makefile>
CC = gcc
all:
echo $(CC)
echo $(CXX)
</Makefile>
>I confirm that CC should default to gcc and not cc. I don't know if this
>is an upstream issue or a MinGW build issue so I'll let the package
I think it is both an upstream and a MinGW issue: Make upstream is POSIX-compliant and sets CC=cc per default, while MinGW does not provide a cc.exe. So either Make is changed in MinGW to set CC=gcc or a the gcc package in MinGW is modified to provide an additional cc.exe (just like bash provides an additional sh.exe).
>maintainer follow up with this. However, I'm able to set CC=gcc in the
>environment and set CC = gcc in the Makefile to change the value.
Sure you can override the CC variable with CC=gcc. But it is not possible to use a conditional override like CC?=gcc, which only sets CC=gcc if it has not been set before.
AFAIK, CC = cc is the built in default for GNU make, on all platforms; I don't know if there is a build option to change it, or if it would require a patch. If a patch is required, then we would need both Cesar and Chris to agree a common patching strategy for each of our distinct GNU make offerings, (MSYS make and mingw32-make respectively.
By far the simplest solution would surely be to do as the Linux distributors do -- either link or copy /mingw/bin/gcc.exe to /mingw/bin/cc.exe; (copy is the safest strategy, since few msw archiving tools seem to support file to file links; even though NTFS has supported them forever, FAT32 does not).
For a user enacted work around, either set CC=gcc or simply run
ln /mingw/bin/gcc.exe /mingw/bin/cc.exe
in an MSYS shell. Alternatively, assign CC = @CC@ in Makefile.in, and use autoconf's AC_PROG_CC to propagate the appropriate correct assignment to Makefile, via a configure script.
If you think it is a bug that you can't use a conditional makefile assignment, then you must take that up with the upstream GNU make maintainers; we will not address that issue.
> If a patch is required, then we would need both Cesar and Chris
> to agree a common patching strategy for each of our distinct GNU make
> offerings, (MSYS make and mingw32-make respectively.
FWIW, I am also opposed to patching if this would mean a deviation from the standard behaviour, but then...
> By far the simplest solution would surely be to do as the Linux
> distributors do -- either link or copy /mingw/bin/gcc.exe to
> /mingw/bin/cc.exe
...Yes, please provide a bin/gcc.exe in the mingw32-gcc-bin package.
> For a user enacted work around, either set CC=gcc or simply run
> ln /mingw/bin/gcc.exe /mingw/bin/cc.exe
> in an MSYS shell. Alternatively, assign CC = @CC@ in Makefile.in, and use
> autoconf's AC_PROG_CC to propagate the appropriate correct assignment to
> Makefile, via a configure script.
I know, but my point is that the currently shipped bundle of GCC and (both implementations of) MAKE in MinGW is broken in a way that it cannot run the most *simple* Makefiles *without* any further user action.
> If you think it is a bug that you can't use a conditional makefile
> assignment, then you must take that up with the upstream GNU make
> maintainers; we will not address that issue.
I see, but that's not my main point.
>> By far the simplest solution would surely be to do as the Linux
>> distributors do -- either link or copy /mingw/bin/gcc.exe to
>> /mingw/bin/cc.exe
Will do.
Regards,
Cesar
>> By far the simplest solution would surely be to do as the Linux
>> distributors do -- either link or copy /mingw/bin/gcc.exe to
>> /mingw/bin/cc.exe
Sorry, I missed doing this on the last release. I'll do it on the next one.
Thanks,
Cesar
Ping
The latest release contains cc.exe and c++.exe.
Regards,
Cesar
Currently, as 2015-02-21, the cc.exe is not being installed on my bin subdirectory for MSYS.
I'm doing something wrong?
The "ln -s ./gcc.exe ./cc.exe" trick solved my problem, however.
Last edit: Lisias T 2015-02-21
Confirmed.
cc.exeis not present inMinGW\binIf not copy the executable, why not create a symbolic automatically during install?