summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Kanis <lars@greiz-reinsdorf.de>2021-05-22 08:57:26 +0200
committerLars Kanis <lars@greiz-reinsdorf.de>2021-05-22 08:57:26 +0200
commit54db5ef6ecfbc8a2ae6ac7f9617c01406cd01fe1 (patch)
treeb215133ba75ef82e01cdb96ba57f209052943641
parent4ad6fd5f825c6d673d542571d015e198a4d0acff (diff)
downloadffi-54db5ef6ecfbc8a2ae6ac7f9617c01406cd01fe1.tar.gz
Append -pthread to linker options
This fixes the following error on Arm Linux (Raspberry Pi) symbol lookup error: ***/gems/ffi-1.15.0/lib/ffi_c.so: undefined symbol: pthread_atfork Fixes #893
-rw-r--r--ext/ffi_c/extconf.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/ffi_c/extconf.rb b/ext/ffi_c/extconf.rb
index aaf558a..720fb06 100644
--- a/ext/ffi_c/extconf.rb
+++ b/ext/ffi_c/extconf.rb
@@ -57,6 +57,9 @@ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
append_ldflags "-Wl,--exclude-libs,ALL"
end
+ # Some linux archs need explicit linking to pthread, see https://github.com/ffi/ffi/issues/893
+ append_ldflags "-pthread"
+
ffi_alloc_default = RbConfig::CONFIG['host_os'] =~ /darwin/i && RbConfig::CONFIG['host'] =~ /arm|aarch64/i
if enable_config('libffi-alloc', ffi_alloc_default)
$defs << "-DUSE_FFI_ALLOC"