Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Bazel: static server build on Linux.

Kishore Nallan8ee4b010ff5f
diff --git a/.bazelrc b/.bazelrc
index ba92695c..308daae4 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,5 +1,8 @@
+build --incompatible_strict_action_env
build --action_env=BAZEL_CXXOPTS="-std=c++17"
-build --experimental_strict_action_env
build --define=TYPESENSE_VERSION=\"nightly\"
-
build --cxxopt="-std=c++17"
+
+build --enable_platform_specific_config
+
+build:linux --action_env=BAZEL_LINKLIBS="-l%:libstdc++.a -l%:libgcc.a"
diff --git a/BUILD b/BUILD
index 6ff72875..03a961bb 100644
--- a/BUILD
+++ b/BUILD
@@ -72,6 +72,10 @@ cc_binary(
local_defines = [
"TYPESENSE_VERSION=\\\"$(TYPESENSE_VERSION)\\\""
],
+ linkopts = select({
+ "@platforms//os:linux": ["-static-libstdc++", "-static-libgcc"],
+ "//conditions:default": [],
+ }),
copts = COPTS,
deps = [":common_deps"],
)
diff --git a/bazel/foreign_cc.patch b/bazel/foreign_cc.patch
index 76fd5f77..08b8ee9f 100644
--- a/bazel/foreign_cc.patch
+++ b/bazel/foreign_cc.patch
@@ -11,3 +11,35 @@
configure = configure_path,
+--- foreign_cc/private/cc_toolchain_util.bzl
++++ foreign_cc/private/cc_toolchain_util.bzl
+@@ -265,15 +265,24 @@ def get_tools_info(ctx):
+ cc_toolchain = cc_toolchain,
+ )
+
++ cxx = cc_common.get_tool_for_action(
++ feature_configuration = feature_configuration,
++ action_name = ACTION_NAMES.cpp_compile,
++ )
++ cxx_splitted = cxx.split("/")
++ if(cxx_splitted[-1] == "gcc"):
++ cxx_splitted[-1] = "g++"
++ cxx = "/".join(cxx_splitted)
++ if(cxx_splitted[-1] == "clang"):
++ cxx_splitted[-1] = "clang++"
++ cxx = "/".join(cxx_splitted)
++
+ return CxxToolsInfo(
+ cc = cc_common.get_tool_for_action(
+ feature_configuration = feature_configuration,
+ action_name = ACTION_NAMES.c_compile,
+ ),
+- cxx = cc_common.get_tool_for_action(
+- feature_configuration = feature_configuration,
+- action_name = ACTION_NAMES.cpp_compile,
+- ),
++ cxx = cxx,
+ cxx_linker_static = cc_common.get_tool_for_action(
+ feature_configuration = feature_configuration,
+ action_name = ACTION_NAMES.cpp_link_static_library,
+
diff --git a/bazel/rocksdb.BUILD b/bazel/rocksdb.BUILD
index 05786443..6732e683 100644
--- a/bazel/rocksdb.BUILD
+++ b/bazel/rocksdb.BUILD
@@ -41,6 +41,7 @@ cmake(
"//conditions:default": ["-DCMAKE_CXX_FLAGS=-Wno-error=maybe-uninitialized"],
}),
lib_source = "//:all_srcs",
+ targets = ["rocksdb"],
out_static_libs = ["librocksdb.a"],
deps = ["@com_github_google_snappy//:snappy"],
)