premake / premake/premake-core

Object File Collision Detection Part II: Visual Studio C++ modules

Open
#2,177 1 comment 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?
The bug is related to same modules with same file names in a project. The compiler puts everything under the same intermediate directory, due to generated project configuration. Later the linker cannot find either the first or the second module, depending on the compile order. In the past there was the same issue for C++ in Visual Studio 1182.

What did you expect to happen?
Premake should either set the macro "$(IntDir)%(RelativeDir)", which would solve a lot of other stuff that could happen, or extend the old logic to generate numbered file names also for modules.

The second option could interfere with other stuff that are beyond my knoweledge. As example IntelliSense seems to also build a lot of stuff, to be able to support modules.
image

What have you tried so far?
Fixed it manually in Visual Studio under:
" -> Right Click -> Properties -> Configuration Properties / C/C++ / Output Files"
image

Also checked everything around, the good thing with the macro, this issue would never ever happen again.

Before that I tried a lot around setting the objdir properly, but it seems that premake5 is limited in that case 283.

How can we reproduce this?
Yeah, just put a basic Visual Studio 2022 C++ 20 project with two modules in different directories with the same name. Premake generates the following for the second module:
image

Manual fix:
image

  • [ x] Visual Studio 2022 (vs2022)

What version of Premake are you using?
premake5 5.0.0-beta2

Anything else we should know?
Thank you guys for this amazing build tool!

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

Reproduce the issue with a Visual Studio 2022 C++20 project containing modules with the same filename in different directories, then inspect the generated module output settings and existing object-file collision handling from issue 1182. Compare the generated configuration with the manual Configuration Properties / C/C++ / Output Files fix; done means both modules build and link without collisions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
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.