premake / premake/premake-core

Premake doesn't set CC variable when generating gsys2 project files (Win10)

Open
#1,640 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

What seems to be the problem?
Premake doesn't set the CC variable with gmake and gmake2 generator when trying to build a C project

What did you expect to happen?
I expected that i'll be able to build a simple Hello World with barebones premake copied from "Getting Started" guide.

What have you tried so far?
I've managed to build the program after adding CC = gcc directly into generated *.make file.

How can we reproduce this?

PS C:\Users\SteelPh0enixVM\C> mingw32-make
"==== Building HelloWorld (debug) ===="
Creating obj/Debug
main.c
process_begin: CreateProcess(NULL, cc -MMD -MP -g -o obj/Debug/main.o -MF obj/Debug/main.d -c main.c, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make[1]: *** [HelloWorld.make:132: obj/Debug/main.o] Error 2
mingw32-make: *** [Makefile:30: HelloWorld] Error 2

This issue happens when you either

  • have language set to C in premake5.lua - fails on build due to lack of CC variable content
  • try to build a C file in C++ project - same as above
  • try to link the project with language set to C - fails on linking, because it's trying to use CC for final compilation step

What version of Premake are you using?
premake5 (Premake Build Script Generator) 5.0.0-alpha16

Anything else we should know?
I've tested it on my personal PC and in a clean virtual machine (both machines have latest Windows 10, MinGW-w64 (x86_64, 8.1.0 and latest Premake). I was able to reproduce the issue on both machines.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the gmake and gmake2 generator output for the premake5.lua example, then inspect the generated HelloWorld.make and Makefile to see how C compiler commands are selected. Reproduce with mingw32-make and verify that generated makefiles define and use CC for compiling and linking the C project.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.