Skip to content

Commit 6cd970b

Browse files
etiennebarriematzbot
authored andcommitted
[ruby/psych] Remove warning by not calling find_library after pkg_config
If pkg_config returns a truthy value, it found the library and added it to the global values for the Makefile. Calling `find_library` after a successful `pkg_config` causes -lyaml 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: '-lyaml' ruby/psych@cb5e3d465c
1 parent 5b65e76 commit 6cd970b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/psych/extconf.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@
3636
libyaml = "libyaml.#$LIBEXT"
3737
$cleanfiles << libyaml
3838
$LOCAL_LIBS.prepend("$(LIBYAML) ")
39-
else # default to pre-installed libyaml
40-
pkg_config('yaml-0.1')
39+
40+
# default to pre-installed libyaml
41+
elsif pkg_config('yaml-0.1')
42+
# found with pkg-config
43+
else
4144
dir_config('libyaml')
4245
find_header('yaml.h') or abort "yaml.h not found"
4346
find_library('yaml', 'yaml_get_version') or abort "libyaml not found"

0 commit comments

Comments
 (0)