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

Link statically against cpp stdlib to make the binary portable.

Kishore Nallan5d9995a9dc80
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0330e582..20fef29a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,7 +76,14 @@ target_compile_definitions(search PRIVATE ROOT_DIR="${CMAKE_SOURCE_DIR}/")
target_compile_definitions(benchmark PRIVATE ROOT_DIR="${CMAKE_SOURCE_DIR}/")
target_compile_definitions(typesense_test PRIVATE ROOT_DIR="${CMAKE_SOURCE_DIR}/")
-target_link_libraries(typesense-server for h2o-evloop pthread rocksdb ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES} dl)
-target_link_libraries(search for pthread rocksdb ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES})
-target_link_libraries(benchmark for pthread rocksdb ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES})
-target_link_libraries(typesense_test pthread for rocksdb ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} gtest gtest_main)
+set(STD_LIB -static-libstdc++)
+set(ROCKSDB_LIBS rocksdb ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES})
+
+if(NOT APPLE)
+ list(APPEND ROCKSDB_LIBS rt)
+endif()
+
+target_link_libraries(typesense-server for pthread h2o-evloop ${ROCKSDB_LIBS} ${OPENSSL_LIBRARIES} dl ${STD_LIB})
+target_link_libraries(search for pthread h2o-evloop ${ROCKSDB_LIBS} ${OPENSSL_LIBRARIES} dl ${STD_LIB})
+target_link_libraries(benchmark for pthread ${ROCKSDB_LIBS} ${STD_LIB})
+target_link_libraries(typesense_test pthread for ${ROCKSDB_LIBS} gtest gtest_main ${STD_LIB})
diff --git a/docker/build.Dockerfile b/docker/build.Dockerfile
new file mode 100644
index 00000000..37bd5110
--- /dev/null
+++ b/docker/build.Dockerfile
@@ -0,0 +1,28 @@
+FROM ubuntu:12.04
+
+RUN apt-get update
+RUN apt-get install -y build-essential
+RUN apt-get install -y python-software-properties
+RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
+RUN apt-get update
+
+RUN apt-get install -y gcc-4.9
+RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
+RUN apt-get install -y g++-4.9
+RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50
+
+RUN apt-get install -y zlib1g-dev
+RUN apt-get install -y liblist-compare-perl
+RUN apt-get install -y wget
+RUN wget https://openssl.org/source/openssl-1.0.2k.tar.gz -P /opt
+RUN tar -C /opt -xvzf /opt/openssl-1.0.2k.tar.gz
+RUN cd /opt/openssl-1.0.2k && sh ./config --prefix=/usr --openssldir=/usr zlib-dynamic
+RUN make -C /opt/openssl-1.0.2k depend
+RUN make -C /opt/openssl-1.0.2k -j4
+RUN make -C /opt/openssl-1.0.2k install
+
+RUN apt-get install -y libsnappy-dev
+
+RUN wget http://www.cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.tar.gz -P /opt
+RUN tar -C /opt -xvzf /opt/cmake-3.3.2-Linux-x86_64.tar.gz
+RUN cp -r /opt/cmake-3.3.2-Linux-x86_64/* /usr
\ No newline at end of file