Skip to content

Commit eb2211a

Browse files
bgilbertWill Wray
authored andcommitted
zstd: don't add -pthread to static linking flags on Windows
Meson always returns -pthread in dependency('threads') on non-MSVC compilers. On Windows, zstd uses Windows threading primitives, so we don't need this. Avoid adding -pthread to libzstd's link flags, either as a Meson subproject or via pkg-config Libs.private, so the application doesn't inadvertently depend on winpthreads. Merged upstream in facebook/zstd#3931.
1 parent e35cba0 commit eb2211a

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

releases.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3548,6 +3548,7 @@
35483548
"libzstd"
35493549
],
35503550
"versions": [
3551+
"1.5.6-2",
35513552
"1.5.6-1",
35523553
"1.5.5-1",
35533554
"1.5.4-1",

subprojects/packagefiles/zstd/meson.build

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@ feature_lz4 = get_option('lz4')
8686
# =============================================================================
8787

8888
libm_dep = cc.find_library('m', required: false)
89-
thread_dep = dependency('threads', required: feature_multi_thread)
90-
use_multi_thread = thread_dep.found()
89+
if host_machine_os == os_windows
90+
thread_dep = dependency('', required: false)
91+
use_multi_thread = not feature_multi_thread.disabled()
92+
else
93+
thread_dep = dependency('threads', required: feature_multi_thread)
94+
use_multi_thread = thread_dep.found()
95+
endif
9196
# Arguments in dependency should be equivalent to those passed to pkg-config
9297
zlib_dep = dependency('zlib', required: feature_zlib)
9398
use_zlib = zlib_dep.found()

subprojects/packagefiles/zstd/meson_options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ option('bin_contrib', type: 'boolean', value: false,
2727
description: 'Enable contrib build')
2828

2929
option('multi_thread', type: 'feature', value: 'enabled',
30-
description: 'Enable multi-threading when pthread is detected')
30+
description: 'Enable multi-threading when pthread or Windows is detected')
3131
option('zlib', type: 'feature', value: 'auto',
3232
description: 'Enable zlib support')
3333
option('lzma', type: 'feature', value: 'auto',

0 commit comments

Comments
 (0)