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

Fix mac arm build.

Kishore Nallan0013c50ffd67
diff --git a/BUILD b/BUILD
index 27fdf254..18adbf83 100644
--- a/BUILD
+++ b/BUILD
@@ -103,6 +103,7 @@ cc_binary(
],
linkopts = select({
"@platforms//os:linux": ["-static-libstdc++", "-static-libgcc", "-fuse-ld=lld"],
+ "@platforms//os:macos": ["-framework Foundation", "-framework Accelerate", "-framework Metal", "-framework MetalKit"],
"//conditions:default": [],
}),
copts = COPTS + select({
@@ -205,4 +206,4 @@ cc_test(
"@platforms//os:linux": ["-fuse-ld=lld"],
"//conditions:default": [],
})
-)
\ No newline at end of file
+)
diff --git a/WORKSPACE b/WORKSPACE
index 80e6a65c..4e1f41fa 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -34,7 +34,7 @@ rules_foreign_cc_dependencies(
# brpc and its dependencies
git_repository(
name = "com_github_brpc_brpc",
- commit = "70d702f1c7c4f663d30cd0ca284bf838a8cf7afb",
+ commit = "df31bf51f08ca6afa59ef3b4f3749bf20ebd1858",
patches = [
"//bazel/brpc:brpc.patch",
],
@@ -343,4 +343,4 @@ new_git_repository(
build_file = "//bazel:snowball.BUILD",
branch = "master",
remote = "https://github.com/snowballstem/snowball.git"
-)
\ No newline at end of file
+)
diff --git a/bazel/brpc/brpc.patch b/bazel/brpc/brpc.patch
index f686f03f..6d6bbd72 100644
--- a/bazel/brpc/brpc.patch
+++ b/bazel/brpc/brpc.patch
@@ -1,36 +1,30 @@
--- src/bvar/default_variables.cpp
+++ src/bvar/default_variables.cpp
-@@ -447,7 +447,13 @@
- // in MacOS.
- memset(s, 0, sizeof(ProcIO));
- static pid_t pid = getpid();
-- rusage_info_current rusage;
-+
-+ #ifdef __arm__
-+ rusage_info_v4 rusage;
-+ #else
-+ rusage_info_current rusage;
-+ #endif
-+
- if (proc_pid_rusage(pid, RUSAGE_INFO_CURRENT, (void**)&rusage) != 0) {
- PLOG(WARNING) << "Fail to proc_pid_rusage";
+@@ -442,19 +442,6 @@
return false;
+ }
+ return true;
+-#elif defined(OS_MACOSX)
+- // TODO(zhujiashun): get rchar, wchar, syscr, syscw, cancelled_write_bytes
+- // in MacOS.
+- memset(s, 0, sizeof(ProcIO));
+- static pid_t pid = getpid();
+- rusage_info_current rusage;
+- if (proc_pid_rusage(pid, RUSAGE_INFO_CURRENT, (void**)&rusage) != 0) {
+- PLOG(WARNING) << "Fail to proc_pid_rusage";
+- return false;
+- }
+- s->read_bytes = rusage.ri_diskio_bytesread;
+- s->write_bytes = rusage.ri_diskio_byteswritten;
+- return true;
+ #else
+ return false;
+ #endif
---- src/butil/third_party/dynamic_annotations/dynamic_annotations.h
-+++ src/butil/third_party/dynamic_annotations/dynamic_annotations.h
-@@ -498,7 +498,7 @@
- const char *file, int line, const volatile void *mem,
- const char *description) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
- void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)(
-- const char *file, int line, const volatile void *mem, long size,
-+ const char *file, int line, const volatile void *mem, size_t size,
- const char *description) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
- void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)(
- const char *file, int line,
--- BUILD.bazel
+++ BUILD.bazel
-@@ -48,7 +48,7 @@ LINKOPTS = [
+@@ -51,7 +51,7 @@ LINKOPTS = [
"-pthread",
"-ldl",
] + select({
@@ -39,7 +33,7 @@
"-framework CoreFoundation",
"-framework CoreGraphics",
"-framework CoreData",
-@@ -206,7 +206,7 @@ BUTIL_SRCS = [
+@@ -217,7 +217,7 @@ BUTIL_SRCS = [
"src/butil/recordio.cc",
"src/butil/popen.cpp",
] + select({
@@ -48,14 +42,14 @@
"src/butil/time/time_mac.cc",
"src/butil/mac/scoped_mach_port.cc",
],
-@@ -322,7 +322,7 @@ cc_library(
+@@ -332,7 +332,7 @@ cc_library(
"//bazel/config:brpc_with_glog": ["@com_github_google_glog//:glog"],
"//conditions:default": [],
}) + select({
- "@bazel_tools//tools/osx:darwin": [":macos_lib"],
+ "@platforms//os:macos": [":macos_lib"],
"//conditions:default": [],
- }),
- )
+ }) + select({
+ "//bazel/config:brpc_with_boringssl": ["@boringssl//:ssl", "@boringssl//:crypto"],
diff --git a/bazel/whisper.BUILD b/bazel/whisper.BUILD
index 671405f7..01aacf11 100644
--- a/bazel/whisper.BUILD
+++ b/bazel/whisper.BUILD
@@ -72,4 +72,4 @@ cuda_library(
"ggml-backend.h",
"ggml-alloc.h",
"ggml-backend-impl.h"],
-)
\ No newline at end of file
+)