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 glibc 2.34 compatibility.

Kishore Nallane63193606de5
diff --git a/docker-build.sh b/docker-build.sh
index 6ab9d8c7..9d9fc527 100755
--- a/docker-build.sh
+++ b/docker-build.sh
@@ -22,7 +22,7 @@ if [[ "$@" == *"--depclean"* ]]; then
fi
-TYPESENSE_DEV_IMAGE="typesense-development:04-DEC-2021-1"
+TYPESENSE_DEV_IMAGE="typesense-development:06-DEC-2021-1"
if [[ "$@" == *"--graviton2"* ]]; then
TYPESENSE_DEV_IMAGE="typesense-development-arm:03-DEC-2021-1"
fi
diff --git a/docker/development-arm.Dockerfile b/docker/development-arm.Dockerfile
index be5b54f5..37fa1539 100644
--- a/docker/development-arm.Dockerfile
+++ b/docker/development-arm.Dockerfile
@@ -72,14 +72,15 @@ RUN tar -C /opt -xf /opt/elfutils-0.182.tar.bz2
RUN cd /opt/elfutils-0.182 && ./configure --disable-libdebuginfod --disable-debuginfod --without-lzma --without-bzlib && \
make -j8 && make install && rm -rf /usr/local/lib/*.so*
-ADD https://github.com/apache/incubator-brpc/archive/0.9.7-rc03.tar.gz /opt/brpc-0.9.7-rc03.tar.gz
-RUN tar -C /opt -xf /opt/brpc-0.9.7-rc03.tar.gz
-COPY patches/brpc_cmakelists.txt /opt/incubator-brpc-0.9.7-rc03/src/CMakeLists.txt
-RUN chown root:root /opt/incubator-brpc-0.9.7-rc03/src/CMakeLists.txt
-RUN mkdir -p /opt/incubator-brpc-0.9.7-rc03/bld && cd /opt/incubator-brpc-0.9.7-rc03/bld && \
+ADD https://github.com/typesense/incubator-brpc/archive/7d4d601.tar.gz /opt/brpc-7d4d601.tar.gz
+RUN tar -C /opt -xf /opt/brpc-7d4d601.tar.gz
+COPY patches/brpc_cmakelists.txt /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/src/CMakeLists.txt
+RUN chown root:root /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/src/CMakeLists.txt
+RUN mkdir -p /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/bld && \
+ cd /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/bld && \
cmake -DWITH_DEBUG_SYMBOLS=OFF -DWITH_GLOG=ON .. && \
make -j8 && make install && rm -rf /usr/local/lib/*.so* && \
- rm -rf /opt/incubator-brpc-0.9.7-rc03/bld/output/bin
+ rm -rf /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/bld/output/bin
ADD https://github.com/typesense/braft/archive/938eeb5.tar.gz /opt/braft-938eeb5.tar.gz
RUN tar -C /opt -xf /opt/braft-938eeb5.tar.gz
diff --git a/docker/development.Dockerfile b/docker/development.Dockerfile
index 6043cd2d..c9441265 100644
--- a/docker/development.Dockerfile
+++ b/docker/development.Dockerfile
@@ -74,14 +74,15 @@ RUN tar -C /opt -xf /opt/elfutils-0.182.tar.bz2
RUN cd /opt/elfutils-0.182 && ./configure --disable-libdebuginfod --disable-debuginfod --without-lzma --without-bzlib \
&& make -j8 && make install && rm -rf /usr/local/lib/*.so*
-ADD https://github.com/apache/incubator-brpc/archive/0.9.7-rc03.tar.gz /opt/brpc-0.9.7-rc03.tar.gz
-RUN tar -C /opt -xf /opt/brpc-0.9.7-rc03.tar.gz
-COPY patches/brpc_cmakelists.txt /opt/incubator-brpc-0.9.7-rc03/src/CMakeLists.txt
-RUN chown root:root /opt/incubator-brpc-0.9.7-rc03/src/CMakeLists.txt
-RUN mkdir -p /opt/incubator-brpc-0.9.7-rc03/bld && cd /opt/incubator-brpc-0.9.7-rc03/bld && \
+ADD https://github.com/typesense/incubator-brpc/archive/7d4d601.tar.gz /opt/brpc-7d4d601.tar.gz
+RUN tar -C /opt -xf /opt/brpc-7d4d601.tar.gz
+COPY patches/brpc_cmakelists.txt /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/src/CMakeLists.txt
+RUN chown root:root /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/src/CMakeLists.txt
+RUN mkdir -p /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/bld && \
+ cd /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/bld && \
cmake -DWITH_DEBUG_SYMBOLS=OFF -DWITH_GLOG=ON .. && \
make -j8 && make install && rm -rf /usr/local/lib/*.so* && \
- rm -rf /opt/incubator-brpc-0.9.7-rc03/bld/output/bin
+ rm -rf /opt/incubator-brpc-7d4d60126bcc0aefbef9fa8b3bc784bff18540be/bld/output/bin
ADD https://github.com/typesense/braft/archive/938eeb5.tar.gz /opt/braft-938eeb5.tar.gz
RUN tar -C /opt -xf /opt/braft-938eeb5.tar.gz
diff --git a/src/typesense_server_utils.cpp b/src/typesense_server_utils.cpp
index 0eaedd60..e2da0161 100644
--- a/src/typesense_server_utils.cpp
+++ b/src/typesense_server_utils.cpp
@@ -25,18 +25,21 @@ HttpServer* server;
std::atomic<bool> quit_raft_service;
extern "C" {
- typedef int (*mallctl_t)(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
+// weak symbol: resolved at runtime by the linker if we are using jemalloc, nullptr otherwise
+#ifdef __APPLE__
+ int je_mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen) __attribute__((weak_import));
+#else
+ int mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen) __attribute__((weak));
+#endif
}
bool using_jemalloc() {
// On OSX, jemalloc API is prefixed with "je_"
- mallctl_t mallctl;
#ifdef __APPLE__
- mallctl = (mallctl_t) ::dlsym(RTLD_DEFAULT, "je_mallctl");
+ return (je_mallctl != nullptr);
#else
- mallctl = (mallctl_t) ::dlsym(RTLD_DEFAULT, "mallctl");
-#endif
return (mallctl != nullptr);
+#endif
}
void catch_interrupt(int sig) {