Skip to content

Commit 22212d6

Browse files
committed
Remove warning by not calling have_library after pkg_config
pkg_config without the options arguments stores the result in the global values. Calling `pkg_config` and `have_library` causes -lffi to appear twice in the LIBS variable in the resulting Makefile, and causes ld on macOS to emit a warning: $ bundle exec rake compile 2>&1 | grep warning: ld: warning: ignoring duplicate libraries: '-lffi'
1 parent 6368ee0 commit 22212d6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ext/fiddle/extconf.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ def enable_debug_build_flag(flags)
6464
dir_config 'libffi'
6565

6666
if pkg_config("libffi")
67+
have_libffi = true
6768
libffi_version = pkg_config("libffi", "modversion")
6869
end
6970

70-
have_ffi_header = false
7171
if have_header(ffi_header = 'ffi.h')
72-
have_ffi_header = true
72+
have_libffi = true
7373
elsif have_header(ffi_header = 'ffi/ffi.h')
7474
$defs.push('-DUSE_HEADER_HACKS')
75-
have_ffi_header = true
76-
end
77-
if have_ffi_header && (have_library('ffi') || have_library('libffi'))
7875
have_libffi = true
7976
end
77+
unless have_libffi
78+
have_libffi = have_library('ffi') || have_library('libffi')
79+
end
8080
end
8181

8282
unless have_libffi

0 commit comments

Comments
 (0)