Skip to content

Commit 0955820

Browse files
committed
[GR-17097] Avoid NFI exception while loading libc via full FFI.
PullRequest: truffleruby/945
2 parents 2b2a7f8 + cb2a893 commit 0955820

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/truffle/ffi.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ module Platform
2727
# so we need to break the cycle.
2828
ADDRESS_SIZE = 64
2929
LONG_SIZE = 64
30+
31+
if ::Truffle::Platform.linux?
32+
# Set it so FFI::Library finds the right file directly, like on MRI,
33+
# and does not need to try and fail to load the /lib64/libc.so loader script.
34+
GNU_LIBC = 'libc.so.6'
35+
end
3036
end
3137

3238
TypeDefs = {}

lib/truffle/socket/truffle/foreign.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module Truffle
2828
module Socket
2929
module Foreign
3030
extend ::FFI::Library
31-
ffi_lib ::FFI::Library::LIBC
31+
ffi_lib ::FFI::Library::CURRENT_PROCESS
3232

3333
SIZEOF_INT = ::FFI.type_size(:int)
3434

0 commit comments

Comments
 (0)