-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Changes from all commits
080845b
6fcbc41
8b02976
cd0e20d
d42ba51
e0bfb72
4d1fee3
2ce46e6
e05b8fd
f1dc4f8
db16aa1
7e8341b
ec35983
c6f5fc6
e04dab6
3766659
95bb385
a60d4d5
0774afa
d94d500
e8b89e6
f1c99d2
b1e4e71
646541d
a778915
fe412a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel | ||
| index 732514d..a6be18b 100644 | ||
| --- a/build_defs/BUILD.bazel | ||
| +++ b/build_defs/BUILD.bazel | ||
| @@ -13,10 +13,23 @@ package( | ||
| ) | ||
|
|
||
| create_compiler_config_setting( | ||
| - name = "config_msvc", | ||
| + name = "config_msvc_cl", | ||
| value = "msvc-cl", | ||
| ) | ||
|
|
||
| +create_compiler_config_setting( | ||
| + name = "config_clang_cl", | ||
| + value = "clang-cl", | ||
| +) | ||
| + | ||
| +selects.config_setting_group( | ||
| + name = "config_msvc", | ||
| + match_any = [ | ||
| + ":config_clang_cl", | ||
| + ":config_msvc_cl", | ||
| + ], | ||
| +) | ||
| + | ||
| config_setting( | ||
| name = "aarch64", | ||
| values = {"cpu": "linux-aarch_64"}, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| diff --git a/luajit_build_win.sh b/luajit_build_win.sh | ||
| new file mode 100755 | ||
| index 00000000..c6267893 | ||
| --- /dev/null | ||
| +++ b/luajit_build_win.sh | ||
| @@ -0,0 +1,38 @@ | ||
| +#!/bin/bash | ||
| + | ||
| +set -e | ||
| + | ||
| +PREFIX="" | ||
| +while [[ $# -gt 0 ]]; do | ||
| + case $1 in | ||
| + --prefix=*) | ||
| + PREFIX="${1#*=}" | ||
| + shift | ||
| + ;; | ||
| + --prefix) | ||
| + PREFIX="$2" | ||
| + shift 2 | ||
| + ;; | ||
| + *) | ||
| + shift | ||
| + ;; | ||
| + esac | ||
| +done | ||
| + | ||
| +# Copy source tree to a build directory | ||
| +SRC_DIR="$(dirname "$(realpath "$0")")" | ||
| +BUILD_DIR="$(basename "$SRC_DIR")" | ||
| +cp -r "$SRC_DIR" "$BUILD_DIR" | ||
| +cd "$BUILD_DIR" | ||
| + | ||
| +cd src | ||
| +./msvcbuild.bat static | ||
| + | ||
| +mkdir -p "$PREFIX/lib" | ||
| +cp lua51.lib "$PREFIX/lib" | ||
| +mkdir -p "$PREFIX/include/luajit-2.1" | ||
| +for header in lauxlib.h luaconf.h lua.h lua.hpp luajit.h lualib.h; do | ||
| + cp "$header" "$PREFIX/include/luajit-2.1" | ||
| +done | ||
| +mkdir -p "$PREFIX/bin" | ||
| +cp luajit.exe "$PREFIX/bin" | ||
| diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat | ||
| index d6aed170..42604601 100644 | ||
| --- a/src/msvcbuild.bat | ||
| +++ b/src/msvcbuild.bat | ||
| @@ -18,9 +18,11 @@ | ||
| @rem Add more debug flags here, e.g. DEBUGCFLAGS=/DLUA_USE_ASSERT | ||
| @set DEBUGCFLAGS= | ||
| @set LJCOMPILE=cl /nologo /c /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_STDIO_INLINE=__declspec(dllexport)__inline | ||
| -@set LJDYNBUILD=/DLUA_BUILD_AS_DLL /MD | ||
| -@set LJDYNBUILD_DEBUG=/DLUA_BUILD_AS_DLL /MDd | ||
| -@set LJCOMPILETARGET=/Zi | ||
| +@rem Use MT to match flags set by bazel for static build | ||
| +@set LJDYNBUILD=/DLUA_BUILD_AS_DLL /MT | ||
| +@set LJDYNBUILD_DEBUG=/DLUA_BUILD_AS_DLL /MTd | ||
| +@rem Avoid incremental link which doesn't work with bazel's deletion of intermediate files | ||
| +@set LJCOMPILETARGET=/Z7 | ||
| @set LJLINKTYPE=/DEBUG /RELEASE | ||
| @set LJLINKTYPE_DEBUG=/DEBUG | ||
| @set LJLINKTARGET=/OPT:REF /OPT:ICF /INCREMENTAL:NO | ||
|
Comment on lines
+50
to
+63
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we need additional patch for these extensions (lua, protocolconverter related) works, could we just compile it out rather then add additional patches? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1683,6 +1683,27 @@ REPOSITORY_LOCATIONS_SPEC = dict( | |
| license = "Apache-2.0", | ||
| license_url = "https://github.com/bazelbuild/rules_license/blob/{version}/LICENSE", | ||
| ), | ||
| com_github_dlfcn_win32 = dict( | ||
| project_name = "dlfcn-win32", | ||
| project_desc = "An implementation of dlfcn for Windows.", | ||
| project_url = "https://github.com/dlfcn-win32/dlfcn-win32", | ||
| version = "1.4.2", | ||
| sha256 = "f61a874bc9163ab488accb364fd681d109870c86e8071f4710cbcdcbaf9f2565", | ||
| strip_prefix = "dlfcn-win32-{version}", | ||
| urls = ["https://github.com/dlfcn-win32/dlfcn-win32/archive/refs/tags/v{version}.tar.gz"], | ||
| use_category = ["dataplane_ext"], | ||
| extensions = [ | ||
| "envoy.access_loggers.dynamic_modules", | ||
| "envoy.filters.http.dynamic_modules", | ||
| "envoy.filters.listener.dynamic_modules", | ||
| "envoy.filters.network.dynamic_modules", | ||
| "envoy.filters.udp_listener.dynamic_modules", | ||
| ], | ||
| release_date = "2025-03-04", | ||
| cpe = "N/A", | ||
| license = "MIT", | ||
| license_url = "https://github.com/dlfcn-win32/dlfcn-win32/blob/v{version}/COPYING", | ||
| ), | ||
|
Comment on lines
+1686
to
+1706
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we use macro to use the method from windows to load the dynamic library rather then use a new dependency? Or will it be very complex?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I initially considered skipping the dependency after verifying everything works. But the management of function pointers that this library takes care of seemed complicated enough to consider taking advantage of the dependency - the loaded DLLs are in a sense "highly stateful" so difficult to macro |
||
| com_github_maxmind_libmaxminddb = dict( | ||
| project_name = "maxmind_libmaxminddb", | ||
| project_desc = "C library for reading MaxMind DB files", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.