Skip to content
Prev Previous commit
Next Next commit
Revert the protobuf update, which had broad fallout.
Instead, silence a zlib warning in the emsdk transition.

Signed-off-by: Martijn Stevenson <mstevenson@google.com>
  • Loading branch information
martijneken committed Oct 1, 2024
commit fe5c4a9a6067a4c359b9c2e726bd76ff9e816fc0
6 changes: 2 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Required for emsdk: https://github.com/emscripten-core/emsdk/blob/main/bazel/README.md
# Claimed to be required for emsdk:
# https://github.com/emscripten-core/emsdk/blob/main/bazel/README.md
build --incompatible_enable_cc_toolchain_resolution

# C++14 or higher is required by Abseil, which is included from protobuf.
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
5 changes: 5 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cc_library(
"proxy_wasm_api.h",
"proxy_wasm_externs.h",
],
copts = ["-std=c++17"],
deps = [
":common_lib",
"@com_google_protobuf//:protobuf_lite",
Expand All @@ -25,6 +26,7 @@ cc_library(
"proxy_wasm_common.h",
"proxy_wasm_enums.h",
],
copts = ["-std=c++17"],
)

cc_library(
Expand All @@ -39,6 +41,7 @@ cc_library(
"proxy_wasm_externs.h",
"proxy_wasm_intrinsics.h",
],
copts = ["-std=c++17"],
visibility = ["//visibility:public"],
)

Expand All @@ -62,6 +65,7 @@ proto_library(
cc_library(
name = "proxy_wasm_intrinsics_lite",
hdrs = ["proxy_wasm_intrinsics_lite.h"],
copts = ["-std=c++17"],
defines = ["PROXY_WASM_PROTOBUF_LITE"],
visibility = ["//visibility:public"],
deps = [
Expand All @@ -75,6 +79,7 @@ cc_library(
cc_library(
name = "proxy_wasm_intrinsics_full",
hdrs = ["proxy_wasm_intrinsics_full.h"],
copts = ["-std=c++17"],
defines = ["PROXY_WASM_PROTOBUF_FULL"],
visibility = ["//visibility:public"],
deps = [
Expand Down
7 changes: 6 additions & 1 deletion bazel/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ def _optimized_wasm_cc_binary_transition_impl(settings, attr):
# Define STANDALONE_WASM at compile time as well as link time (below).
# This influences Abseil libraries using conditional dependencies.
# TODO(martijneken): Remove after Abseil stops using this define.
#
# Disable warning -Wdeprecated-non-prototype for zlib:
# https://github.com/madler/zlib/issues/633
# This is fixed in more recent versions of zlib / protobuf.
# TODO(martijneken): Remove after protobuf version update.
return {
"//command_line_option:copt": ["-O3", "-DSTANDALONE_WASM"],
"//command_line_option:copt": ["-O3", "-DSTANDALONE_WASM", "-Wno-deprecated-non-prototype"],
"//command_line_option:cxxopt": [],
"//command_line_option:linkopt": [],
"//command_line_option:collect_code_coverage": False,
Expand Down
17 changes: 3 additions & 14 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,7 @@ def proxy_wasm_cpp_sdk_repositories():
maybe(
http_archive,
name = "com_google_protobuf",
sha256 = "a700a49470d301f1190a487a923b5095bf60f08f4ae4cac9f5f7c36883d17971",
strip_prefix = "protobuf-23.4",
url = "https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protobuf-23.4.tar.gz",
)

# Update protobuf dependency to fix unused function CodepointSkipBackwards.
# https://github.com/protocolbuffers/utf8_range/commit/d863bc33e15cba6d873c878dcca9e6fe52b2f8cb
# TODO(martijneken): Remove this when protobuf picks up the fix.
maybe(
http_archive,
name = "utf8_range",
sha256 = "568988b5f7261ca181468dba38849fabf59dd9200fb2ed4b2823da187ef84d8c",
strip_prefix = "utf8_range-d863bc33e15cba6d873c878dcca9e6fe52b2f8cb",
url = "https://github.com/protocolbuffers/utf8_range/archive/d863bc33e15cba6d873c878dcca9e6fe52b2f8cb.zip",
sha256 = "77ad26d3f65222fd96ccc18b055632b0bfedf295cb748b712a98ba1ac0b704b2",
strip_prefix = "protobuf-3.17.3",
url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-all-3.17.3.tar.gz",
)
3 changes: 3 additions & 0 deletions example/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ licenses(["notice"]) # Apache 2
proxy_wasm_cc_binary(
name = "http_wasm_example.wasm",
srcs = ["http_wasm_example.cc"],
copts = ["-std=c++17"],
)

proxy_wasm_cc_binary(
name = "http_wasm_example_with_protobuf_lite.wasm",
srcs = ["http_wasm_example.cc"],
copts = ["-std=c++17"],
protobuf = "lite",
)

proxy_wasm_cc_binary(
name = "http_wasm_example_with_protobuf_full.wasm",
srcs = ["http_wasm_example.cc"],
copts = ["-std=c++17"],
protobuf = "full",
)