Skip to content

Commit

Permalink
Append -pthread to linker options
Browse files Browse the repository at this point in the history
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
  • Loading branch information
larskanis committed May 22, 2021
1 parent 4ad6fd5 commit 54db5ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/ffi_c/extconf.rb
Expand Up @@ -57,6 +57,9 @@ def system_libffi_usable?
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"
Expand Down

1 comment on commit 54db5ef

@printfinn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks so much!

Please sign in to comment.