-
Notifications
You must be signed in to change notification settings - Fork 66
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
build: fix ninja builds on Windows #60
Conversation
Not sure how to make this not include the other commit... |
deps/v8/gypfiles/v8-monolithic.gyp
Outdated
'conditions': [ | ||
['OS=="win"', { | ||
'libraries': ['-ldbghelp.lib', '-lshlwapi.lib', '-lwinmm.lib', '-lws2_32.lib'], | ||
}, 'OS=="linux"', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most gyp code I saw uses separate conditions for the separate cases, i.e.:
['OS=="win"', {
}],
['OS=="linux"', {
}],
Maybe do the same for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
deps/v8/gypfiles/v8-monolithic.gyp
Outdated
], | ||
# Specify a non-existent output to make the target permanently dirty. | ||
# Alternatively, a depfile could be used, but then two dirty checks | ||
# would run: one by outer the build tool, and one by build_gn.py. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/one by outer the build tool/one by the outer build tool/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
deps/v8/tools/node/build_gn.py
Outdated
|
||
with open(os.path.join(options.build_path, 'args.gn')) as f: | ||
if 'use_goma = true' in f.read(): | ||
args += ["-j500"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to use goma on chrome infrastructure, this should be configurable. Chrome infra sets 50 on standard bots currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more flags.
deps/v8/gypfiles/v8-monolithic.gyp
Outdated
@@ -49,7 +61,31 @@ | |||
'--flag', 'v8_optimized_debug=<(v8_optimized_debug)', | |||
'--flag', 'v8_enable_disassembler=<(v8_enable_disassembler)', | |||
'--flag', 'v8_postmortem_support=<(v8_postmortem_support)', | |||
'--flag', 'use_goma=<(build_v8_with_gn_use_goma)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to use goma on chrome infrastructure also the goma_dir must be configurable somehow, since it's not at the default location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more flags
node.gyp
Outdated
'conditions': [ | ||
['GENERATOR=="ninja"', { | ||
'AdditionalOptions': [ | ||
'/WHOLEARCHIVE:<(obj_dir)/<(STATIC_LIB_PREFIX)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just clarification: We don't need \ in the paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows accepts /s for path separators. I've changed them to \s though, since that's more correct.
configure
Outdated
@@ -572,6 +583,9 @@ options.prefix = os.path.expanduser(options.prefix or '') | |||
# set up auto-download list | |||
auto_downloads = nodedownload.parse(options.download_list) | |||
|
|||
if options.use_clang_cl: | |||
CC = os.path.abspath(os.path.join( | |||
'deps', 'v8', 'third_party', 'llvm-build', 'Release+Asserts', 'bin', 'clang-cl.exe')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this end up there? Is it copied from V8's deps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind. It seems to get there during fetch_deps. I checked on our bots and it's there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too V8-specific, IMO. How about turning this into a flag that takes the path to clang-cl as an argument? It should be possible for people to use an external clang-cl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've backed out the flag entirely. All it does is set the CC environment variable, so making it any more generic makes it no different than CC.
d018663
to
534f06d
Compare
configure
Outdated
@@ -568,10 +593,14 @@ parser.add_option('-C', | |||
|
|||
# Expand ~ in the install prefix now, it gets written to multiple files. | |||
options.prefix = os.path.expanduser(options.prefix or '') | |||
options.build_v8_with_gn = options.build_v8_with_gn or options.build_v8_with_gn_use_goma |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you keep lines under 80 columns in Node.js files? I know not everything is 100% clean in that respect but we try to keep new code on the straight and narrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
configure
Outdated
@@ -572,6 +583,9 @@ options.prefix = os.path.expanduser(options.prefix or '') | |||
# set up auto-download list | |||
auto_downloads = nodedownload.parse(options.download_list) | |||
|
|||
if options.use_clang_cl: | |||
CC = os.path.abspath(os.path.join( | |||
'deps', 'v8', 'third_party', 'llvm-build', 'Release+Asserts', 'bin', 'clang-cl.exe')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too V8-specific, IMO. How about turning this into a flag that takes the path to clang-cl as an argument? It should be possible for people to use an external clang-cl.
configure
Outdated
parser.add_option('--build-v8-with-gn-goma-dir', | ||
dest='build_v8_with_gn_goma_dir', | ||
default='', | ||
help='For Googlers: Value for the goma_dir GN arg.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer to keep these undocumented (help=optparse.SUPPRESS_HELP
) since they're only relevant to Googlers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm if Ben's comments addressed and if tested locally hat this still works with linux.
configure
Outdated
@@ -1054,6 +1083,10 @@ def configure_v8(o): | |||
print('Fetching dependencies to build V8 with GN') | |||
options.build_v8_with_gn = FetchDeps(v8_path) | |||
o['variables']['build_v8_with_gn'] = b(options.build_v8_with_gn) | |||
o['variables']['build_v8_with_gn_use_goma'] = b(options.build_v8_with_gn_use_goma) | |||
o['variables']['build_v8_with_gn_goma_dir_'] = options.build_v8_with_gn_goma_dir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the trailing _ indicating this field as private? Is it different to the other three?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment.
args += ["-j" + options.max_jobs] | ||
else: | ||
with open(os.path.join(options.build_path, "args.gn")) as f: | ||
if "use_goma = true" in f.read(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make this more robust to spaces? Above all gn args are passed now without spaces. Also goma might be passed as:
use_goma=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script now uses gn gen --args=
, which means GN will format the file to always have one spaces on each side of the "="
44dee42
to
5962cc2
Compare
This command failed for me:
|
I think you may have hit the same issue I did with git.exe not being in your path. I've re-uploaded with the fix as another commit in this pull request. |
|
Gah! Sorry, patch fail :(. Fixed now. |
Now it's back to the old error:
|
I think this may be an issue that's tricky for me to debug on my machines...
|
Also - do you get the same error when trying |
I get a different error:
|
You mean on |
Aha - the breakpad error was meaningful. Try adding node\deps\v8_depot_tools to your PATH as a work-around for now, and I'll see about fixing the check to look for depot_tools there rather than elsewhere. |
Adding it to PATH fixed the breakpad error, but now it results in the same error as
Same with and without this patch. |
The vs_toolchain update in depot tools has a default of 1 for DEPOT_TOOLS_WIN_TOOLCHAIN: I think in the node use case we should have a 0 default. |
If I set DEPOT_TOOLS_WIN_TOOLCHAIN to 1, then |
You've set it to 1? Not 0 by any chance? I thought 1 is the default, that makes the toolchain download start. And 0 omits it. |
Sorry, I meant I set it to |
Added a commit to set DEPOT_TOOLS_WIN_TOOLCAHIN=0 by default. |
Once you've run configure, you build in the usual way (with make). This patch is mainly about building with clang-cl though, which works only with ninja (I think). So to test, do And also: |
After I added
Then I ran
|
Did you add _depot_tools to your PATH as an absolute path? For the username one, I wonder if globally set:
then run ninja if it will still prompt? If so, it would be helpful to run |
Yes
No, but:
|
* Split "gn gen" and "ninja" invocations into two separate actions * Make the ninja action use console pool so that progress is shown * Set DEPOT_TOOLS_WIN_TOOLCHAIN=0 by default (to avoid non-googlers being asked for credentials) * Propagate depot_tools path to "gn gen" step (it runs vs_toolchain.py) * Add flags for clang-cl, setting gn args, sub-ninja -j and -l parameters
* Fixed several hardcoded paths to use <(STATIC_LIB_PREFIX) & <(STATIC_LIB_SUFFIX) * Added GENERATOR=='ninja' conditionals to /WHOLEARCHIVE flags (msbuild puts .lib files under separate directories). * Add missing link_settings for v8_monolith * Set use_sysroot=false only for non-windows builds. To build using clang-cl: python configure --build-v8-with-gn --use-clang-cl --ninja
Made a few changes:
With these changes, I'm now seeing the same error about dbghelp.dll not existing. I tried installing various other options for Visual Studio Community 2017, but nothing I tried added the file in the spot GN is expecting it to be. |
Update: Managed to appease the check by installing the windows 10 sdk from: |
Note: There are instructions for installing the correct MS deps here: |
And, can now confirm that I was able to build with DEPOT_TOOLS_WIN_TOOLCHAIN=0 (now the default). I was missing: |
I'm landing this now. Any further issues can be solved in further PRs. |
I tried on a different computer and got this:
|
Sounds like maybe the install of python in C:\Python27 is missing this file? It's supposed to live under |
Python 2.7 doesn't come with that file out of box. It's part of pywin32. Is that another requirement? |
For posterity. For this to work, you have to install
|
<(STATIC_LIB_SUFFIX)
puts .lib files under separate directories).
To build using clang-cl:
set CC="%cd%\deps\v8\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe"
python configure --build-v8-with-gn --ninja
ninja -C out\Release