Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcbuild does not always generate field <TargetMachine> in project files. #13569

Open
tamaroth opened this issue Jun 9, 2017 · 7 comments
Open
Assignees
Labels
build Issues and PRs related to build files or the CI. confirmed-bug Issues with confirmed bugs. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. windows Issues and PRs related to the Windows platform.
Projects

Comments

@tamaroth
Copy link

tamaroth commented Jun 9, 2017

  • Version: v9.0.0-pre
  • Platform: Windows 10 x64
  • Subsystem:

When generating project files for node, gyp does not include for librarian but does so for linker. As a result the linking fails as MSBuild will default unknown machine to x64 (on x64 platforms).
The result is as follows:

vcbuild.bat debug static vs2017 x86

...
LINK : warning LNK4068: /MACHINE not specified; defaulting to X64 [c:\Users\tamaroth\Downloads\node\node.vcxproj]
Debug\obj\node\async-wrap.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' [c:\Users\tamaroth\Downloads\node\node.vcxproj]

This is manually easily fixed by modyfying .vcxproj file to include proper inside .

For instance, from the above command, the node.vcxproj file in Debug|Win32 configuration has this entry:

    <Lib>
      <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
    </Lib>

If I modify it to

    <Lib>
      <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
      <TargetMachine>MachineX86</TargetMachine>
    </Lib>

Everything works great.

Inside

node\tools\gyp\pylib\gyp\msvs_emulation.py

in function GetLibFlags (line: 515) it says to add specific machine, but for some reason it's not added later on to the project file.

@gibfahn gibfahn added build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform. labels Jun 9, 2017
@gibfahn
Copy link
Member

gibfahn commented Jun 9, 2017

cc/ @nodejs/platform-windows

@refack
Copy link
Contributor

refack commented Jun 9, 2017

@tamaroth just to make sure: it only happens with the static arg? i.e. vcbuild.bat debug static vs2017 x86?

@refack refack added the confirmed-bug Issues with confirmed bugs. label Jun 9, 2017
@refack
Copy link
Contributor

refack commented Jun 9, 2017

Repro. I think I'd rather add this in node.gyp then patch GYP
Ref: https://gyp.gsrc.io/docs/LanguageSpecification.md#Detailed-Design

@refack refack self-assigned this Jun 9, 2017
@tamaroth
Copy link
Author

@refack Sorry for late response, yes, as far as I can tell it happens only when building as static library. There's also another error when building release library (problem with included resources), but I will make additional bug report for it.

@Trott
Copy link
Member

Trott commented Apr 30, 2018

@refack Suggestions for how to unstick this? Any team that might be cc'ed? Or maybe a label to add like help wanted or something?

@refack
Copy link
Contributor

refack commented Nov 15, 2018

/CC @nodejs/gyp ¯_(ツ)_/¯

@jasnell jasnell added this to Would need investigation in Futures Jun 25, 2020
@joyeecheung
Copy link
Member

Not sure if it's related but

node/common.gypi

Lines 307 to 315 in 83eb4f2

['target_arch=="ia32"', {
'TargetMachine' : 1, # /MACHINE:X86
}],
['target_arch=="x64"', {
'TargetMachine' : 17, # /MACHINE:X64
}],
['target_arch=="arm64"', {
'TargetMachine' : 0, # NotSet. MACHINE:ARM64 is inferred from the input files.
}],
adds TargetMachine for release builds, even though there doesn't appear to be one for the debug builds.

@joyeecheung joyeecheung added the help wanted Issues that need assistance from volunteers or PRs that need help to proceed. label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. confirmed-bug Issues with confirmed bugs. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. windows Issues and PRs related to the Windows platform.
Projects
Futures
Would need investigation
Development

No branches or pull requests

5 participants