title: lld-link: error: <root>: undefined symbol: mainCRTStartup when building V8
body: <p>I've spent a whole day on this now and I can't seem to get the <code>.lib</code> files to build with VS 2017. I followed the V8 docs here:</p>
  
  <p><a href="https://v8.dev/docs/build" rel="nofollow noreferrer">https://v8.dev/docs/build</a></p>
  
  <p>Following the instructions does work, but I end up with a V8 command line program in the <code>out</code> directory and <code>.lib</code> that do NOT work with Visual Studio 2017. </p>
  
  <blockquote>
    <p>fatal error LNK1107: invalid or corrupt file: cannot read at 0x1422A</p>
  </blockquote>
  
  <p>I executed this to try to get the build files for the libraries only:</p>
  
  <pre><code>gn gen out/lib --args="v8_static_library=true v8_use_snapshot=true v8_use_external_startup_data=false v8_monolithic=true icu_use_data_file=false is_component_build=false is_debug=false"
  </code></pre>
  
  <p>Then ran this: <code>ninja -C out/lib</code></p>
  
  <p>And this was the final result:</p>
  
  <pre><code>ninja: Entering directory `out/lib'
  [1632/1645] LINK cctest.exe cctest.exe.pdb
  FAILED: cctest.exe cctest.exe.pdb
  ninja -t msvc -e environment.x64 -- ../../../../third_party/llvm-build/Release+Asserts/bin/lld-link.exe /nologo /OUT:./cctest.exe /PDB:./cctest.exe.pdb @./cctest.exe.rsp
  lld-link: error: &lt;root&gt;: undefined symbol: mainCRTStartup
  [1634/1645] LINK generate-bytecode-expectations.exe generate-bytecode-expectations.exe.pdb
  ninja: build stopped: subcommand failed.
  </code></pre>
  
  <p>I think I'm missing something, but I have no idea at the moment.</p>