Skip to content

Commit 928775c

Browse files
committed
CDRIVER-3452 list zstd as dep for static build
libzstd was not listed as a library dependency for static libmongoc build, causing potentialy linker errors in consumers. Also enable zstd tests on macOS, disable on Ubuntu since installed zstd is too old.
1 parent 7c01892 commit 928775c

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

.evergreen/compile-unix.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ set -o errexit # Exit the script with error if any of the commands fail
1919
# LIBBSON Build against bundled or external libbson
2020
# EXTRA_CONFIGURE_FLAGS Extra configure flags to use
2121
# ZLIB Build against bundled or external zlib, or none
22-
# SNAPPY Build against bundled or external Snappy, or none
22+
# SNAPPY Build against Snappy, or none
2323
# SSL Build against OpenSSL or native or none
2424
# SASL Build against SASL or not
2525
# SRV Whether to enable SRV: ON or OFF
2626
# ENABLE_SHM_COUNTERS Build with SHM counters
27+
# ZSTD Build against system zstd.
2728

2829
# Options for this script.
2930
RELEASE=${RELEASE:-OFF}
@@ -54,6 +55,7 @@ echo "ANALYZE: $ANALYZE"
5455
echo "COVERAGE: $COVERAGE"
5556
echo "SKIP_TESTS: $SKIP_TESTS"
5657
echo "ZLIB: $ZLIB"
58+
echo "ZSTD: $ZSTD"
5759

5860
# Get the kernel name, lowercased
5961
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
@@ -87,6 +89,10 @@ if [ ! -z "$SNAPPY" ]; then
8789
DEBUG_AND_RELEASE_FLAGS="$DEBUG_AND_RELEASE_FLAGS -DENABLE_SNAPPY=${SNAPPY}"
8890
fi
8991

92+
if [ ! -z "$ZSTD" ]; then
93+
DEBUG_AND_RELEASE_FLAGS="$DEBUG_AND_RELEASE_FLAGS -DENABLE_ZSTD=${ZSTD}"
94+
fi
95+
9096
DEBUG_FLAGS="${DEBUG_AND_RELEASE_FLAGS} -DCMAKE_BUILD_TYPE=Debug"
9197
RELEASE_FLAGS="${DEBUG_AND_RELEASE_FLAGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo"
9298

build/evergreen_config_lib/variants.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ def android(abi):
191191
'clang 3.8 (Ubuntu 16.04)',
192192
'ubuntu1604-test',
193193
['.compression !.zstd',
194-
'debug-compile-compression-zstd',
195194
'debug-compile-scan-build',
196195
'debug-compile-asan-clang',
197196
'debug-compile-ubsan',
@@ -317,7 +316,7 @@ def android(abi):
317316
Variant('darwin',
318317
'*Darwin, macOS (Apple LLVM)',
319318
'macos-1012',
320-
['.compression !.snappy !.zstd',
319+
['.compression !.snappy',
321320
'debug-compile-coverage',
322321
'release-compile',
323322
'debug-compile-nosasl-nossl',

src/libmongoc/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,12 @@ if (NOT ENABLE_ZSTD STREQUAL OFF)
116116
message (STATUS "Detected zstd version ${ZSTD_VERSION} but version 0.8.0 required")
117117
endif ()
118118
else ()
119-
message (STATUS " Found in ${ZSTD_INCLUDE_DIRS}")
119+
message (STATUS " Found zstd version ${ZSTD_VERSION} in ${ZSTD_INCLUDE_DIRS}")
120120
set (MONGOC_ENABLE_COMPRESSION 1)
121121
set (MONGOC_ENABLE_COMPRESSION_ZSTD 1)
122-
set (MONGOC_INTERNAL_INCLUDE_DIRS ${MONGOC_INTERNAL_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIRS})
123122

123+
include_directories (${ZSTD_INCLUDE_DIRS})
124124
if (${CMAKE_VERSION} VERSION_LESS "3.12.0")
125-
link_directories(${ZSTD_LIBRARY_DIRS})
126125
set (MONGOC_ZSTD_LIBRARIES ${ZSTD_LIBRARIES})
127126
else ()
128127
set (MONGOC_ZSTD_LIBRARIES ${ZSTD_LINK_LIBRARIES})
@@ -961,7 +960,7 @@ set (libdir "\${prefix}/lib")
961960
foreach (
962961
FLAG
963962
${SASL_LIBRARIES} ${SSL_LIBRARIES} ${SHM_LIBRARIES} ${RESOLV_LIBRARIES}
964-
${THREAD_LIB} ${ZLIB_LIBRARIES} ${SNAPPY_LIBRARIES} ${ZSTD_LINK_LIBRARIES} ${ICU_LIBRARIES})
963+
${THREAD_LIB} ${ZLIB_LIBRARIES} ${SNAPPY_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} ${ICU_LIBRARIES})
965964

966965
if (IS_ABSOLUTE "${FLAG}")
967966
get_filename_component (FLAG_DIR "${FLAG}" DIRECTORY)

src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ set (MONGOC_LIBRARIES ${MONGOC_LIBRARY} ${BSON_LIBRARIES})
3737
set (IS_FRAMEWORK_VAR 0)
3838
foreach (LIB
3939
@SASL_LIBRARIES@ @SSL_LIBRARIES@ @SHM_LIBRARIES@ @RESOLV_LIBRARIES@
40-
@SNAPPY_LIBRARIES@ @ICU_LIBRARIES@
40+
@SNAPPY_LIBRARIES@ @ICU_LIBRARIES@ @MONGOC_ZSTD_LIBRARIES@
4141
)
4242
if (LIB STREQUAL "-framework")
4343
set (IS_FRAMEWORK_VAR 1)

src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ set (MONGOC_STATIC_LIBRARIES ${MONGOC_STATIC_LIBRARY} ${ZLIB_STATIC_LIBRARY} ${B
4141
# like "-framework CoreFoundation;-framework Security".
4242
set (IS_FRAMEWORK_VAR 0)
4343
foreach (LIB @SASL_LIBRARIES@ @SSL_LIBRARIES@ @SHM_LIBRARIES@ @ZLIB_LIBRARIES@
44-
@SNAPPY_LIBRARIES@ @RESOLV_LIBRARIES@ @ICU_LIBRARIES@
44+
@SNAPPY_LIBRARIES@ @RESOLV_LIBRARIES@ @ICU_LIBRARIES@ @MONGOC_ZSTD_LIBRARIES@
4545
)
4646
if (LIB STREQUAL "-framework")
4747
set (IS_FRAMEWORK_VAR 1)

0 commit comments

Comments
 (0)