mkmf have_func fails if Ruby is compiled with static libruby
If Ruby is compiled with static libruby, then mkmf have_func calls will fail. This is because have_func tries to compile a binary, passing -lruby-static to the compiler. However this fails because binary also needs to be linked to a bunch of libraries that ruby-static.a depends on, such as -lm, -lrt, -ldl etc.
See Phusion Passenger bug 1314 comment 68140592 for details and for an mkmf.log. Users who have a static libruby are unable to use the Phusion Passenger native extension, because a
have_func('rb_thread_call_without_gvl') failed where it should have succeeded.
#1 [ruby-core:67191] Updated by Nobuyoshi Nakada about 2 years ago
- Status changed from Open to Third Party's Issue
$LIBS is cleared at https://github.com/phusion/passenger/blob/master/ext/ruby/extconf.rb#L24.