-
Notifications
You must be signed in to change notification settings - Fork 5.2k
windows: fix Envoy build on Windows #42687
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
base: main
Are you sure you want to change the base?
Conversation
|
CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to |
| SysCallIntResult OsSysCallsImpl::setsockopt(os_fd_t sockfd, int level, int optname, | ||
| const void* optval, socklen_t optlen) { | ||
| if (optname == IP_RECVTOS || optname == IPV6_RECVTCLASS) { | ||
| const int rc = ::WSASetRecvIPEcn(sockfd, *(int*)optval == 1); |
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.
Only available on newer Windows
| new file mode 100755 | ||
| index 00000000..8fb0fbe8 | ||
| --- /dev/null | ||
| +++ b/luajit_build_win.sh |
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.
Shell version of old build.py that was deleted in refactoring
bazel/foreign_cc/cel-cpp.patch
Outdated
| - args.use_param_file(param_file_arg = "%s", use_always = True) | ||
| - args.add_all(transitive_descriptor_sets) | ||
| + | ||
| + # Generate script to concatenate files listed in a parameter file into an output file. |
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.
Relatively large change
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 upstream this its hard enough maintaining lots of patches, and even harder if its for untested OS
any windows specific patches should be in a separate clearly named patch - so maintainers can quickly disable it if it doesnt apply, and it doesnt affect any other builds
| tag = config_data["build-image"]["tag"], | ||
| )) | ||
| else: | ||
| # yq via bazel doesn't work on Windows, but we don't need the file either |
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.
It downloads something but doesn't symlink or copy it in a way that it can be run, probably a bazel rule bug in @yq but it doesn't matter here
source/extensions/bootstrap/reverse_tunnel/upstream_socket_interface/reverse_tunnel_acceptor.h
Show resolved
Hide resolved
| "//envoy/filesystem:filesystem_interface", | ||
| "//source/common/common:logger_lib", | ||
| "//source/common/filesystem:filesystem_lib", | ||
| "//source/common/singleton:threadsafe_singleton", |
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.
Something about clang-cl seems to detect more of these missing dependencies (correctly)
Signed-off-by: Anuraag Agrawal <[email protected]>
60681f4 to
1d6c084
Compare
Signed-off-by: Anuraag Agrawal <[email protected]>
1d6c084 to
6fcbc41
Compare
Signed-off-by: Anuraag Agrawal <[email protected]>
b317301 to
8b02976
Compare
phlax
left a comment
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 CI won't be restored,
that is correct, and the related point is that developers have no obligation to make things work or keep things working
patches like this are still accepted.
we can accept patches to make it work if they are low maintenance and non-intrusive - but patches for upstream really must be upstreamed
@anuraaga im wondering what the motivation for this is - ie are you imagining envoy being deployed on windows somewhere?
if that is the case, and putting aside my own thoughts on whether that is a good idea, my strong suggestion would be to iniitiate a downstream project that kept up to date and did any ci/testing that is required to maintain this
| tags = ["skip_on_windows"], | ||
| ) | ||
|
|
||
| configure_make( |
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.
these rules need platform constraints so other platforms dont try to build with //...
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.
AFAICT, this is already accomplished by the select statements, especially in cc_library. This is similar to maxmind_linux_darwin below
bazel/foreign_cc/cel-cpp.patch
Outdated
| - args.use_param_file(param_file_arg = "%s", use_always = True) | ||
| - args.add_all(transitive_descriptor_sets) | ||
| + | ||
| + # Generate script to concatenate files listed in a parameter file into an output file. |
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 upstream this its hard enough maintaining lots of patches, and even harder if its for untested OS
any windows specific patches should be in a separate clearly named patch - so maintainers can quickly disable it if it doesnt apply, and it doesnt affect any other builds
| + | ||
| + ls | ||
| + cd src | ||
| +./msvcbuild.bat static |
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 this cases its obviously harder to upstream the patch - but im wondering if this .bat stuff is really needed and if it is whether it can be incorporated to existing patch/script - eg by setting an env var and calling it here if set
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 considered adding to the existing script but since it's not using make, most of the logic is actually replicating the install command. It seemed clearer to keep them separate
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 was able to remove the .bat patch, instead making sure to copy vc140.pdb to the output prefix, which is required when using /Zi as msvcbuild.bat forces to use.
I still kept the separate build_win.sh since it seems worth keeping it independent from the unix one
| create_compiler_config_setting( | ||
| name = "config_msvc", | ||
| - value = "msvc-cl", | ||
| + values = ["msvc-cl", "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.
please upstream all of this
tools/BUILD
Outdated
| "check_repositories.sh", | ||
| ]) | ||
|
|
||
| py_binary( |
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.
move this into tools/windows if its not relevant to anyone else
Not sure if I follow exactly but yes, this is the linked pyvoy. And yeah, I don't expect Envoy to bring back any CI and will need to do testing. I am wondering what part of this change is acceptable to you - if it's only the cc/h files that would still be helpful and I will just keep the build code forked. As we know, most of these dependencies aren't well maintained so while I can try to upstream changes, generally it won't work. |
i meant something like an ideally we make as few changes as possible wrt maintaining win-specific changes - i think the changes to our cc/h are unaviodable, and similar with some of the bazel selects etc - but for unsupported setups its even more important to upstream upstream changes as it significantly complicates maintaining patches @TAOXUY @dchakarwarti would you be able to review a PR to upstream these changes? |
Ah I see. That would be the workflow I plan on running in py-envoy-server which just packages Envoy for use in Python. It builds envoy and runs some tests. Not a full suite but it checks basic functionality. I don't have a big reason to separate out yet another project specifically for envoy-on-windows but in terms of the envoy repo I think it's effectively the same.
Yeah I agree that it can get hard to recreate them. TBH I was already prepping a PR for protoconverter before finding that stale PR. I'm always for upstreaming where I can. Is there any model where upstream patches with windows code can be made knowing that updates to the patch may break? I'm definitely not expecting the code to be stable for Windows and would just need to be able to react, not proact. But if even that's too much can keep those patches out of this PR. |
Signed-off-by: Anuraag Agrawal <[email protected]>
Signed-off-by: Anuraag Agrawal <[email protected]>
Signed-off-by: Anuraag Agrawal <[email protected]>
anuraaga
left a comment
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 was able to simplify the build patches, sent grpc-ecosystem/proto-converter#7 in case it may be merged.
cel-cpp seems to have coincidentally started looking into Windows issues recently
google/cel-cpp#1811
google/cel-cpp@f1a2e8e
The now one-line patch here seems to work for now and in the future it should be removable.
| tags = ["skip_on_windows"], | ||
| ) | ||
|
|
||
| configure_make( |
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.
AFAICT, this is already accomplished by the select statements, especially in cc_library. This is similar to maxmind_linux_darwin below
Signed-off-by: Anuraag Agrawal <[email protected]>
Signed-off-by: Anuraag Agrawal <[email protected]>
Signed-off-by: Anuraag Agrawal <[email protected]>
Signed-off-by: Anuraag Agrawal <[email protected]>
anuraaga
left a comment
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.
@phlax I was able to simplify the upstream patches a lot with pointers to upstreaming. Hopefully this looks better now
| + | ||
| + ls | ||
| + cd src | ||
| +./msvcbuild.bat static |
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 was able to remove the .bat patch, instead making sure to copy vc140.pdb to the output prefix, which is required when using /Zi as msvcbuild.bat forces to use.
I still kept the separate build_win.sh since it seems worth keeping it independent from the unix one
Signed-off-by: Anuraag Agrawal <[email protected]>
|
Ping for @wbpcode - but it's vacation season so mostly this ping is to shush the tool that nags on-call about stalled PRs, we don't expect prompt reviews across vacations. |
Commit Message: Fix source to allow building on Windows
Additional Description:
I am interested in using Envoy on Windows with dynamic modules - I have already published pyvoy 0.2.0 using a patchset against 1.36.4 which is working great. This PR now updates the latest main to allow building on Windows, which required quite some more digging to accomodate changes to hermetic toolchains since then. FWIU, while Windows CI won't be restored, patches like this are still accepted.
For reference, the magic incantation to invoke Bazel
https://github.com/curioswitch/py-envoy-server/pull/17/files#diff-2855bcd1d44f7c4a97fdb2d631b71cf271ac70f3918e8f6242e54cf038952e64R59
If this is merged, I plan on having that build run nightly to try to catch Windows issues post-merge. Of course, if Envoy team could accept a small CI for Windows, just building the binary but no tests, that would be nice :) But I don't expect it.
There are two changes to non-Windows codepaths
Otherwise, it is fixing some obvious syntax errors, including a dlopen wrapper around dynamic modules loading for Windows, replacing a convenience wrapper only available on newer windows with the older form, and other misc build tweaks.
/cc @mathetake @wbpcode
Risk Level:
Testing: CI
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A