Open jvburnes opened 9 years ago
Is it not that GCC is the default in lieu of explicit statement?
No. Some platforms (NetBSD being one) use 'clang' as their default C compiler. They need the C compiler set to 'gcc' explicitly. That's why you shouldn't make assumptions about that. If someone says 'toolset "gcc"' just assume they have a good reason.
On Thu, Sep 10, 2015 at 6:27 AM, Manu Evans notifications@github.com wrote:
Is it not that GCC is the default in lieu of explicit statement?
— Reply to this email directly or view it on GitHub https://github.com/premake/premake-core/issues/266#issuecomment-139220255 .
kind of goes with https://github.com/premake/premake-core/pull/248
which is essentially an incorrect fix too.... if we didn't assume any default, and simple don't set CC, my fix might not actually be needed either..
Open to suggestions on this. We'll have to store a default toolset somewhere? Or perhaps better to have a function that could be overridden?
well, why don't we have an actual "toolset 'default'", that way the gmake backend can just not output the CC and LINK directives which basically will cause make to use whatever C compiler is active on the system.
What about a premake.config.toolset(cfg)
function that returns what we think ought to be the default toolset adapter for the given configuration. It can check cfg.toolset
, and then lookup the default by system or similar: Windows or Visual Studio is msc
, Apple is clang
…I guess this should be extensible for modules adding support for other environments?
has this been fixed?
as a workaround, I found this method:
makesettings [[ CC = gcc ]]
How do we specify makesettings
in the premake5 lua file. I'm having issues getting the generated makefile to even use a "CC" argument. It keeps generating a CreateProcess
that is attempting to use a command on a path that shouldn't have MinGW installed.
E:\home\Code\Czengine\CzenginePlusPlus>make CC="E:\utility\MinGW\mingw64\bin\g++.exe"
"==== Building CzenginePlusPlus (debug_win64) ===="
"czengine.cpp"
process_begin: CreateProcess(NULL, sh.exe -c "/d/Prog/winlibs64ucrt_stage/mingw64/bin/x86_64-w64-mingw32-g++.exe -MD -MP -DDEBUG -m64 -g -o obj/Win64/Debug/czengine.o -MF obj/Win64/Debug/czengine.d -c src/czengine.cpp", ...) failed.
make (e=2): The system cannot find the file specified.
make[1]: *** [CzenginePlusPlus.make:135: obj/Win64/Debug/czengine.o] Error 2
make: *** [makefile:30: CzenginePlusPlus] Error 2
It appears to think that /d/...
is the path to my g++.exe
, even when I specify the path manually in my make
execution.
I'm using MinGW G++ compiler on Windows 11.
So what I found as my problem just now is that the tool is specifying CC
in the middle of the generated ${Project}.make
file, but it isn't using this property anywhere. It is attempting to use a CXX
variable that isn't defined in this file. I assume this "CXX" variable is what is producing the /d/Prog/winlibs64ucrt_stage/mingw64/bin/x86_64-w64-mingw32-g++.exe
command above. I removed the usages of CXX
from the file and replaced it with CC
. This did not 100% correct the usage, but it make it such that specifying CC
cmd line argument when executing make
work:
CC
Replacing CXX
in ${Project}.make without specifying CC
as CMD line argumentE:\home\Code\Czengine\CzenginePlusPlus>make
"==== Building CzenginePlusPlus (debug_win64) ===="
"czengine.cpp"
process_begin: CreateProcess(NULL, cc -MD -MP -DDEBUG -m64 -g -o obj/Win64/Debug/czengine.o -MF obj/Win64/Debug/czengine.d -c src/czengine.cpp, ...) failed.
make (e=2): The system cannot find the file specified.
make[1]: *** [CzenginePlusPlus.make:135: obj/Win64/Debug/czengine.o] Error 2
make: *** [makefile:30: CzenginePlusPlus] Error 2
CC
as CMD line argument after discovery that cc
is now being printed in the CreateProcess
function.E:\home\Code\Czengine\CzenginePlusPlus>make CC="E:\utility\MinGW\mingw64\bin\g++.exe"
"==== Building CzenginePlusPlus (debug_win64) ===="
"czengine.cpp"
Creating bin/Win64/Debug
Linking CzenginePlusPlus
I see above at the top of this thread that there is a "May be fixed by #1932", but it appears that fix failed to merge due to conflicts that have yet to be resolved.
Last Update:
I dove a bit further into searching out the "CXX" issue, and came across Issue #78. It appears like a nice workaround while the default premake5 gmake2
on windows issue is unresolved. I added the listed conditional into my premake.lua
file, and it worked like a charm.
.....
project "CzenginePlusPlus"
kind "ConsoleApp"
language "C++"
system "Windows"
architecture "x86_64"
if os.execute("g++ -v") == 0 then -- <====
toolset "g++"
end
files {"**.hpp","**.h","**.cpp"}
buildcommands {
"make %{cfg.buildcfg}"
}
.....
A simple check of:
solution "xyzzy" toolset "clang"
yields "CC=clang" in the generated makefiles, however:
solution "xyzzy" toolset "gcc"
does not set CC= in the generated makefiles
This is on OSX, if it makes any difference.