Skip to content

Instantly share code, notes, and snippets.

@taichi
Created November 22, 2012 12:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taichi/4130821 to your computer and use it in GitHub Desktop.
Save taichi/4130821 to your computer and use it in GitHub Desktop.
64bit Windows7 で node.js をビルドする。

前提条件

  • Windows7 64bit
  • node-gypが動作する状態である事。つまり以下の条件を満たしている。
    • Python2.7 系インストール済み
    • Visual Studio 2010 Express インストール済み
    • Windows SDK 7.1 インストール済み
  • Windows SDK 7.0A がインストール済みである
    • つまり、ローカル環境において、WindowsSDK 7.1 と Windows SDK 7.0A が同時に存在している等、複数のWindows SDKが存在している状態である。
  • Visual Studio 2008 Express をインストールした事があるが、アンインストール済
    • これについては因果関係が不明なので無視しても良い

作業

git clone https://github.com/joyent/node.git

Express 使っている人はビルドする時のオプションに注意

よって、expressでビルドする際には、ctrppが除外される様にする。

vcbuild.bat release x64 noperfctr

以下の様なエラーが出る場合は次の作業をやる。

LINK : fatal error LNK1181: cannot open input file 'winmm.lib' [C:\development\js\workspace4.2\node\deps\v8\tools\gyp\mksnapshot.vcxproj]

デフォルトのPlatformToolsetをWindows SDK 7.1 にする。

WindowsSDK7.1がインストールされているが、プロジェクトのデフォルトPlatformToolsetがv100になっており、
v100はWindowsSDK7.0Aを参照している為64bit対応のアレコレが無かったりして大変素晴らしいので、そのデフォルト値を変更する。

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.default.props

を修正する。尚、このファイルは管理者権限が無いと修正できない。

修正前

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PlatformShortName>amd64</PlatformShortName>
    <PlatformArchitecture>64</PlatformArchitecture>
    <PlatformToolset Condition="'$(PlatformToolset)' == ''">$(DefaultX64PlatformToolset)</PlatformToolset>
    <PlatformToolset Condition="'$(PlatformToolset)' == ''">v100</PlatformToolset>

    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'!=''">$(IntermediateOutputPath)</IntDir>
    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'==''">$(Platform)\$(Configuration)\</IntDir>
    <OutDir Condition="'$(OutDir)'=='' AND '$(SolutionDir)' != ''">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
    <OutDir Condition="'$(OutDir)'=='' AND '$(SolutionDir)' == ''">$(IntDir)</OutDir>
  </PropertyGroup>
</Project>

修正後

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PlatformShortName>amd64</PlatformShortName>
    <PlatformArchitecture>64</PlatformArchitecture>
    <PlatformToolset Condition="'$(PlatformToolset)' == ''">$(DefaultX64PlatformToolset)</PlatformToolset>
    <PlatformToolset Condition="'$(PlatformToolset)' == ''">Windows7.1SDK</PlatformToolset>

    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'!=''">$(IntermediateOutputPath)</IntDir>
    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'==''">$(Platform)\$(Configuration)\</IntDir>
    <OutDir Condition="'$(OutDir)'=='' AND '$(SolutionDir)' != ''">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
    <OutDir Condition="'$(OutDir)'=='' AND '$(SolutionDir)' == ''">$(IntDir)</OutDir>
  </PropertyGroup>
</Project>

以下の様なエラーが出るが恐らくリリース作業をする人にだけ関係のあるエラーなので無視する。

SignTool Error: No certificates were found that met all the given criteria.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment