premake / premake/premake-core

Path to root appended on flags when building with gmake2 and MSVC

Open
#2,489 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What seems to be the problem?
When using gmake2 as the output generator, then trying to build it with MSVC by manually setting CXX=cl (which I'm putting into path through this https://github.com/nathan818fr/vcvars-bash/blob/main/vcvarsall.sh), all flags will get the root path appended to them (eg. C:/Program Files/Git (in my case I'm using the MinGW environment that ships with git and have manually added gnumake to it)

What did you expect to happen?
It just builds

What have you tried so far?
I've tried to look through the generated makefiles to see why this happens, however it's not clear to me why this happens. I've also tried using gmake2, gmake and gmakelegacy but all produce the same bug

How can we reproduce this?
This should go for any premake5 project (Note you require MSVC installed aswell has have wget and gnumake in your msys2/mingw environment

wget https://raw.githubusercontent.com/nathan818fr/vcvars-bash/refs/heads/main/vcvarsall.sh
chmod +x vcvarsall.sh
eval "(./vcvarsall.sh amd64)"
premake5 gmake2
CXX=cl make
  • Visual Studio 2022 (vs2022)
  • Visual Studio 2019 (vs2019)
  • Visual Studio 2017 (vs2017)
  • Visual Studio 2015 (vs2015)
  • Visual Studio 2012 (vs2012)
  • Visual Studio 2010 (vs2010)
  • Visual Studio 2008 (vs2008)
  • Visual Studio 2005 (vs2005)
  • GNU Makefile (gmake)
  • GNU Makefile Legacy (gmakelegacy)
  • XCode (xcode)
  • Codelite
  • Other (Please list below)

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

Sample log output:

streisky@desertstorm MINGW64 ~/Desktop/Source Code/zeroproxy-new (master)
$ CXX=cl make client-iw9
==== Building asmjit (debug_win32) ====
a64assembler.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35209 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '-MF'
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/DDEBUG', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/DDEBUG' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/D_DEBUG', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/D_DEBUG' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/DASMJIT_STATIC', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/DASMJIT_STATIC' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/Gm-', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/Gm-' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/MP', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/MP' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/Od', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/Od' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/MTd', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/MTd' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/Z7', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/Z7' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/W0', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/W0' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/EHsc', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/EHsc' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/MD', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/MD' ignored
cl : Command line warning D9024 : unrecognized source file type '../../build/obj/Win32/Debug/asmjit/a64assembler.d', object file assumed
cl : Command line warning D9027 : source file '../../build/obj/Win32/Debug/asmjit/a64assembler.d' ignored

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 by reproducing the issue with the listed vcvarsall.sh, premake5 gmake2, and CXX=cl make commands, then inspect the generated GNU makefiles and how their compiler flags are formed. Done means an MSVC build from the gmake output no longer prefixes compiler flags with the Git root path.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.