Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 2.2 got rid of rb_thread_blocking_region? #1314

Closed
FooBarWidget opened this issue Dec 3, 2014 · 46 comments
Closed

Ruby 2.2 got rid of rb_thread_blocking_region? #1314

FooBarWidget opened this issue Dec 3, 2014 · 46 comments

Comments

@FooBarWidget
Copy link
Member

It is reported that, when running Passenger under Ruby 2.2, the following error occurs:

passenger_native_support.so: undefined symbol: rb_thread_blocking_region

There have probably been large changes with regard to thread handling. This needs to be investigated.

@peterc
Copy link

peterc commented Dec 3, 2014

I just had a look at the main Ruby repo and this might help: https://github.com/ruby/ruby/blob/1c87fee3166c5208e92f1b7779507dd52c3087e1/NEWS

A variety of deprecated C APIs have been removed in Ruby 2.2. More info at https://bugs.ruby-lang.org/issues/9502 - a variety of rb_thread_blocking_* things have been replaced by the "rb_thread_call_without_gvl family" whatever that is ;-)

I don't know if this also helps but Googling some of the terms involved brought up some code where another project has updated their own C code to fit both the old and new style APIs - just in case it's useful in your own research: https://www.mail-archive.com/clogger@librelist.org/msg00022.html

@FooBarWidget FooBarWidget added this to the 5.0.0 beta 2 milestone Dec 12, 2014
@FooBarWidget
Copy link
Member Author

This is odd. I can't reproduce this with ruby-head 2.2.0dev, 2014-12-12.

@FooBarWidget
Copy link
Member Author

Never mind that last comment. :)

@xenda
Copy link

xenda commented Dec 25, 2014

I was just testing Passenger 4.0.55 and Passenger 4.0.56 with Ruby 2.2.0p0 and have find out the problem still exists:

App 22697 stderr: Passenger RackApp: /home/app/app: symbol lookup error: /usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.55/buildout/ruby/ruby-2.2.0-x86-linux/passenger_native_support.so: undefined symbol: rb_thread_blocking_region
2014/12/25 12:05:22 [error] 22688#0: *25 upstream prematurely closed connection while reading response header from upstream, client: 72.46.130.42, server: XXXX, request: "GET / HTTP/1.1", upstream: "passenger:/tmp/passenger.1.0.22668/generation-0/request:"

Any ideas if we are doing something wrong?

@FooBarWidget
Copy link
Member Author

Maybe something went wrong during compilation. Could you run this and tell me what you see?

sudo rm -rf /usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.55/buildout/ruby/ruby-2.2.0-x86-linux
passenger-config build-native-support

@xenda
Copy link

xenda commented Dec 26, 2014

Tried compiling it again, removing it and creating it with the build-native-support.

Still failing, but I see the log mentions that symbol:

# /usr/local/bin/ruby /usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby/extconf.rb
checking for alloca.h... yes
checking for ruby/version.h... yes
checking for ruby/io.h... yes
checking for ruby/thread.h... yes
checking for ruby_version... no
checking for rb_thread_io_blocking_region()... no
checking for rb_thread_call_without_gvl()... no
creating Makefile
# make clean && make
compiling /usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby/passenger_native_support.c
/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby/passenger_native_support.c: In function ‘f_generic_writev’:
/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby/passenger_native_support.c:341:6: warning: implicit declaration of function ‘rb_thread_blocking_region’ [-Wimplicit-function-declaration]
      ret = (int) rb_thread_blocking_region(writev_wrapper,
      ^
linking shared-object passenger_native_support.so

@nanaya
Copy link

nanaya commented Dec 26, 2014

the referenced commits (0ba44a9, bf8de31) fix usage of rb_thread_io_blocking_region, not rb_thread_blocking_region.

@JamesHarrison
Copy link

Can confirm I'm also seeing this with 4.0.56 and 5.0p2.

App 31609 stderr: Passenger RackApp: /home/appname/current: symbol lookup error: /home/appname/.passenger-enterprise/native_support/4.0.56/ruby-2.2.0-x86_64-linux/passenger_native_support.so: undefined symbol: rb_thread_blocking_region

... and 5.x:

App 3192 stderr: Passenger RubyApp: /home/appname/releases/20141226021229: symbol lookup error: /home/appname/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/passenger-enterprise-server-5.0.0.beta2/buildout/ruby/ruby-2.2.0-x86_64-linux/passenger_native_support.so: undefined symbol: rb_thread_blocking_region

The extensions all seem to compile cleanly, though. Tried recompiling without any change.

Edit: @edogawaconan quite right, hadn't spotted. Does that want a new issue creating to track?

@nanaya
Copy link

nanaya commented Dec 26, 2014

looking at the deprecation list, rb_thread_io_blocking_region isn't even in it. Hitting wrong target?

(yeah, I'm also getting the same error as everyone else here)

@FooBarWidget
Copy link
Member Author

No, the committed code is correct. We check for rb_thread_call_without_gvl() and use that instead of rb_thread_(io_)blocking_region. The problem is that the rb_thread_call_without_gvl() check fails for some reason, as can be seen in @xenda 's logs.

@xenda Is there an mkmf.log in the directory? If so could you attach it?

@FooBarWidget
Copy link
Member Author

I can't reproduce this error. On OS X, rb_thread_call_without_gvl is detected just fine. Which platforms are you all on?

@nanaya
Copy link

nanaya commented Dec 26, 2014

centos 6 for me

@JamesHarrison
Copy link

Debian Wheezy here.

@FooBarWidget
Copy link
Member Author

I can't reproduce it on Ubuntu 14.04 either.

@edogawaconan @JamesHarrison and everyone else, can you attach your mkmf.log?

@nanaya
Copy link

nanaya commented Dec 26, 2014

have_header: checking for alloca.h... -------------------- yes

"gcc -o conftest -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/opt/ruby22/lib -Wl,-R/opt/ruby22/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/opt/ruby22/lib -L/opt/ruby22/lib -lruby-static   -lpthread"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -E -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <alloca.h>
/* end */

--------------------

have_header: checking for ruby/version.h... -------------------- yes

"gcc -E -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <ruby/version.h>
/* end */

--------------------

have_header: checking for ruby/io.h... -------------------- yes

"gcc -E -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <ruby/io.h>
/* end */

--------------------

have_header: checking for ruby/thread.h... -------------------- yes

"gcc -E -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <ruby/thread.h>
/* end */

--------------------

have_var: checking for ruby_version... -------------------- no

"gcc -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g   -c conftest.c"
conftest.c: In function ‘t’:
conftest.c:13: error: ‘ruby_version’ undeclared (first use in this function)
conftest.c:13: error: (Each undeclared identifier is reported only once
conftest.c:13: error: for each function it appears in.)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { const volatile void *volatile p; p = &(&ruby_version)[0]; return 0; }
/* end */

--------------------

have_func: checking for rb_thread_io_blocking_region()... -------------------- no

"gcc -o conftest -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/opt/ruby22/lib -Wl,-R/opt/ruby22/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/opt/ruby22/lib -L/opt/ruby22/lib -lruby-static   -lpthread"
conftest.c: In function ‘t’:
conftest.c:13: error: ‘rb_thread_io_blocking_region’ undeclared (first use in this function)
conftest.c:13: error: (Each undeclared identifier is reported only once
conftest.c:13: error: for each function it appears in.)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_thread_io_blocking_region; return 0; }
/* end */

"gcc -o conftest -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/opt/ruby22/lib -Wl,-R/opt/ruby22/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/opt/ruby22/lib -L/opt/ruby22/lib -lruby-static   -lpthread"
conftest.c: In function ‘t’:
conftest.c:13: warning: implicit declaration of function ‘rb_thread_io_blocking_region’
/opt/ruby22/lib/libruby-static.a(thread.o): In function `timeofday':
/root/build/ruby-2.2.0/thread.c:1132: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(thread.o): In function `native_cond_timeout':
/root/build/ruby-2.2.0/thread_pthread.c:376: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(thread.o): In function `getclockofday':
/root/build/ruby-2.2.0/thread.c:1059: undefined reference to `clock_gettime'
/root/build/ruby-2.2.0/thread.c:1059: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(thread.o): In function `timeofday':
/root/build/ruby-2.2.0/thread.c:1132: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(thread.o):/root/build/ruby-2.2.0/thread_pthread.c:376: more undefined references to `clock_gettime' follow
/opt/ruby22/lib/libruby-static.a(bignum.o): In function `rb_big_pow':
/root/build/ruby-2.2.0/bignum.c:6305: undefined reference to `pow'
/root/build/ruby-2.2.0/bignum.c:6264: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(gc.o): In function `getrusage_time':
/root/build/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/root/build/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/root/build/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/root/build/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_lgamma':
/root/build/ruby-2.2.0/math.c:893: undefined reference to `lgamma_r'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_gamma':
/root/build/ruby-2.2.0/math.c:862: undefined reference to `tgamma'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_erfc':
/root/build/ruby-2.2.0/math.c:774: undefined reference to `erfc'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_erf':
/root/build/ruby-2.2.0/math.c:753: undefined reference to `erf'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_hypot':
/root/build/ruby-2.2.0/math.c:732: undefined reference to `hypot'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cbrt':
/root/build/ruby-2.2.0/math.c:675: undefined reference to `cbrt'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sqrt':
/root/build/ruby-2.2.0/math.c:632: undefined reference to `sqrt'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_log10':
/root/build/ruby-2.2.0/math.c:590: undefined reference to `log10'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_log2':
/root/build/ruby-2.2.0/math.c:548: undefined reference to `log2'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_log1':
/root/build/ruby-2.2.0/math.c:492: undefined reference to `log'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_exp':
/root/build/ruby-2.2.0/math.c:422: undefined reference to `exp'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_atanh':
/root/build/ruby-2.2.0/math.c:398: undefined reference to `atanh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_asinh':
/root/build/ruby-2.2.0/math.c:369: undefined reference to `asinh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_acosh':
/root/build/ruby-2.2.0/math.c:347: undefined reference to `acosh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_tanh':
/root/build/ruby-2.2.0/math.c:321: undefined reference to `tanh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sinh':
/root/build/ruby-2.2.0/math.c:292: undefined reference to `sinh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cosh':
/root/build/ruby-2.2.0/math.c:263: undefined reference to `cosh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_atan':
/root/build/ruby-2.2.0/math.c:234: undefined reference to `atan'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_asin':
/root/build/ruby-2.2.0/math.c:213: undefined reference to `asin'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_acos':
/root/build/ruby-2.2.0/math.c:187: undefined reference to `acos'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_tan':
/root/build/ruby-2.2.0/math.c:161: undefined reference to `tan'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sin':
/root/build/ruby-2.2.0/math.c:139: undefined reference to `sin'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cos':
/root/build/ruby-2.2.0/math.c:117: undefined reference to `cos'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_atan2':
/root/build/ruby-2.2.0/math.c:94: undefined reference to `atan2'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_exp':
/root/build/ruby-2.2.0/math.c:422: undefined reference to `exp'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cos':
/root/build/ruby-2.2.0/math.c:117: undefined reference to `cos'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sin':
/root/build/ruby-2.2.0/math.c:139: undefined reference to `sin'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cosh':
/root/build/ruby-2.2.0/math.c:263: undefined reference to `cosh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sinh':
/root/build/ruby-2.2.0/math.c:292: undefined reference to `sinh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_hypot':
/root/build/ruby-2.2.0/math.c:732: undefined reference to `hypot'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_ceil':
/root/build/ruby-2.2.0/numeric.c:1652: undefined reference to `ceil'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_floor':
/root/build/ruby-2.2.0/numeric.c:1627: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_truncate':
/root/build/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/root/build/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `ruby_float_step_size':
/root/build/ruby-2.2.0/numeric.c:1911: undefined reference to `floor'
/root/build/ruby-2.2.0/numeric.c:1907: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flodivmod':
/root/build/ruby-2.2.0/numeric.c:901: undefined reference to `fmod'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `ruby_float_step_size':
/root/build/ruby-2.2.0/numeric.c:1911: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_floor':
/root/build/ruby-2.2.0/numeric.c:1627: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_ceil':
/root/build/ruby-2.2.0/numeric.c:1652: undefined reference to `ceil'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_truncate':
/root/build/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/root/build/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/root/build/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_round':
/root/build/ruby-2.2.0/numeric.c:1780: undefined reference to `pow'
/root/build/ruby-2.2.0/numeric.c:1781: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `fix_divide':
/root/build/ruby-2.2.0/numeric.c:3035: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `fix_pow':
/root/build/ruby-2.2.0/numeric.c:3241: undefined reference to `round'
/root/build/ruby-2.2.0/numeric.c:3243: undefined reference to `pow'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/root/build/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_prev_float':
/root/build/ruby-2.2.0/numeric.c:1608: undefined reference to `nextafter'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_next_float':
/root/build/ruby-2.2.0/numeric.c:1556: undefined reference to `nextafter'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/root/build/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_pow':
/root/build/ruby-2.2.0/numeric.c:1033: undefined reference to `round'
/root/build/ruby-2.2.0/numeric.c:1024: undefined reference to `pow'
/root/build/ruby-2.2.0/numeric.c:1035: undefined reference to `pow'
/root/build/ruby-2.2.0/numeric.c:1027: undefined reference to `pow'
/opt/ruby22/lib/libruby-static.a(process.o): In function `rb_clock_gettime':
/root/build/ruby-2.2.0/process.c:7346: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(process.o): In function `rb_clock_getres':
/root/build/ruby-2.2.0/process.c:7485: undefined reference to `clock_getres'
/opt/ruby22/lib/libruby-static.a(string.o): In function `rb_str_crypt':
/root/build/ruby-2.2.0/string.c:7678: undefined reference to `crypt'
/opt/ruby22/lib/libruby-static.a(time.o): In function `time_init_0':
/root/build/ruby-2.2.0/time.c:1901: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(compile.o): In function `insn_data_to_s_detail':
/root/build/ruby-2.2.0/compile.c:5619: undefined reference to `dladdr'
/opt/ruby22/lib/libruby-static.a(iseq.o): In function `rb_insn_operand_intern':
/root/build/ruby-2.2.0/iseq.c:1263: undefined reference to `dladdr'
/opt/ruby22/lib/libruby-static.a(addr2line.o): In function `fill_lines':
/root/build/ruby-2.2.0/addr2line.c:569: undefined reference to `dlopen'
/root/build/ruby-2.2.0/addr2line.c:571: undefined reference to `dlsym'
/root/build/ruby-2.2.0/addr2line.c:573: undefined reference to `dladdr'
/opt/ruby22/lib/libruby-static.a(addr2line.o): In function `rb_dump_backtrace_with_lines':
/root/build/ruby-2.2.0/addr2line.c:703: undefined reference to `dladdr'
/opt/ruby22/lib/libruby-static.a(dln.o): In function `dln_load':
/root/build/ruby-2.2.0/dln.c:1329: undefined reference to `dlopen'
/root/build/ruby-2.2.0/dln.c:1334: undefined reference to `dlsym'
/opt/ruby22/lib/libruby-static.a(dln.o): In function `dln_strerror':
/root/build/ruby-2.2.0/dln.c:1173: undefined reference to `dlerror'
/root/build/ruby-2.2.0/dln.c:1173: undefined reference to `dlerror'
/opt/ruby22/lib/libruby-static.a(dln.o): In function `dln_load':
/root/build/ruby-2.2.0/dln.c:1337: undefined reference to `dlclose'
collect2: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { rb_thread_io_blocking_region(); return 0; }
/* end */

--------------------

have_func: checking for rb_thread_call_without_gvl()... -------------------- no

"gcc -o conftest -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/opt/ruby22/lib -Wl,-R/opt/ruby22/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/opt/ruby22/lib -L/opt/ruby22/lib -lruby-static   -lpthread"
conftest.c: In function ‘t’:
conftest.c:13: error: ‘rb_thread_call_without_gvl’ undeclared (first use in this function)
conftest.c:13: error: (Each undeclared identifier is reported only once
conftest.c:13: error: for each function it appears in.)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_thread_call_without_gvl; return 0; }
/* end */

"gcc -o conftest -I/opt/ruby22/include/ruby-2.2.0/i686-linux -I/opt/ruby22/include/ruby-2.2.0/ruby/backward -I/opt/ruby22/include/ruby-2.2.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/opt/ruby22/lib -Wl,-R/opt/ruby22/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/opt/ruby22/lib -L/opt/ruby22/lib -lruby-static   -lpthread"
conftest.c: In function ‘t’:
conftest.c:13: warning: implicit declaration of function ‘rb_thread_call_without_gvl’
/opt/ruby22/lib/libruby-static.a(thread.o): In function `timeofday':
/root/build/ruby-2.2.0/thread.c:1132: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(thread.o): In function `native_cond_timeout':
/root/build/ruby-2.2.0/thread_pthread.c:376: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(thread.o): In function `getclockofday':
/root/build/ruby-2.2.0/thread.c:1059: undefined reference to `clock_gettime'
/root/build/ruby-2.2.0/thread.c:1059: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(thread.o): In function `timeofday':
/root/build/ruby-2.2.0/thread.c:1132: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(thread.o):/root/build/ruby-2.2.0/thread_pthread.c:376: more undefined references to `clock_gettime' follow
/opt/ruby22/lib/libruby-static.a(bignum.o): In function `rb_big_pow':
/root/build/ruby-2.2.0/bignum.c:6305: undefined reference to `pow'
/root/build/ruby-2.2.0/bignum.c:6264: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(gc.o): In function `getrusage_time':
/root/build/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/root/build/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/root/build/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/root/build/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_lgamma':
/root/build/ruby-2.2.0/math.c:893: undefined reference to `lgamma_r'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_gamma':
/root/build/ruby-2.2.0/math.c:862: undefined reference to `tgamma'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_erfc':
/root/build/ruby-2.2.0/math.c:774: undefined reference to `erfc'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_erf':
/root/build/ruby-2.2.0/math.c:753: undefined reference to `erf'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_hypot':
/root/build/ruby-2.2.0/math.c:732: undefined reference to `hypot'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cbrt':
/root/build/ruby-2.2.0/math.c:675: undefined reference to `cbrt'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sqrt':
/root/build/ruby-2.2.0/math.c:632: undefined reference to `sqrt'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_log10':
/root/build/ruby-2.2.0/math.c:590: undefined reference to `log10'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_log2':
/root/build/ruby-2.2.0/math.c:548: undefined reference to `log2'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_log1':
/root/build/ruby-2.2.0/math.c:492: undefined reference to `log'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_exp':
/root/build/ruby-2.2.0/math.c:422: undefined reference to `exp'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_atanh':
/root/build/ruby-2.2.0/math.c:398: undefined reference to `atanh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_asinh':
/root/build/ruby-2.2.0/math.c:369: undefined reference to `asinh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_acosh':
/root/build/ruby-2.2.0/math.c:347: undefined reference to `acosh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_tanh':
/root/build/ruby-2.2.0/math.c:321: undefined reference to `tanh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sinh':
/root/build/ruby-2.2.0/math.c:292: undefined reference to `sinh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cosh':
/root/build/ruby-2.2.0/math.c:263: undefined reference to `cosh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_atan':
/root/build/ruby-2.2.0/math.c:234: undefined reference to `atan'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_asin':
/root/build/ruby-2.2.0/math.c:213: undefined reference to `asin'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_acos':
/root/build/ruby-2.2.0/math.c:187: undefined reference to `acos'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_tan':
/root/build/ruby-2.2.0/math.c:161: undefined reference to `tan'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sin':
/root/build/ruby-2.2.0/math.c:139: undefined reference to `sin'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cos':
/root/build/ruby-2.2.0/math.c:117: undefined reference to `cos'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_atan2':
/root/build/ruby-2.2.0/math.c:94: undefined reference to `atan2'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_exp':
/root/build/ruby-2.2.0/math.c:422: undefined reference to `exp'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cos':
/root/build/ruby-2.2.0/math.c:117: undefined reference to `cos'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sin':
/root/build/ruby-2.2.0/math.c:139: undefined reference to `sin'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_cosh':
/root/build/ruby-2.2.0/math.c:263: undefined reference to `cosh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_sinh':
/root/build/ruby-2.2.0/math.c:292: undefined reference to `sinh'
/opt/ruby22/lib/libruby-static.a(math.o): In function `math_hypot':
/root/build/ruby-2.2.0/math.c:732: undefined reference to `hypot'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_ceil':
/root/build/ruby-2.2.0/numeric.c:1652: undefined reference to `ceil'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_floor':
/root/build/ruby-2.2.0/numeric.c:1627: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_truncate':
/root/build/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/root/build/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `ruby_float_step_size':
/root/build/ruby-2.2.0/numeric.c:1911: undefined reference to `floor'
/root/build/ruby-2.2.0/numeric.c:1907: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flodivmod':
/root/build/ruby-2.2.0/numeric.c:901: undefined reference to `fmod'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `ruby_float_step_size':
/root/build/ruby-2.2.0/numeric.c:1911: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_floor':
/root/build/ruby-2.2.0/numeric.c:1627: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_ceil':
/root/build/ruby-2.2.0/numeric.c:1652: undefined reference to `ceil'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_truncate':
/root/build/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/root/build/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/root/build/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_round':
/root/build/ruby-2.2.0/numeric.c:1780: undefined reference to `pow'
/root/build/ruby-2.2.0/numeric.c:1781: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `fix_divide':
/root/build/ruby-2.2.0/numeric.c:3035: undefined reference to `floor'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `fix_pow':
/root/build/ruby-2.2.0/numeric.c:3241: undefined reference to `round'
/root/build/ruby-2.2.0/numeric.c:3243: undefined reference to `pow'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/root/build/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_prev_float':
/root/build/ruby-2.2.0/numeric.c:1608: undefined reference to `nextafter'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_next_float':
/root/build/ruby-2.2.0/numeric.c:1556: undefined reference to `nextafter'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/root/build/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/opt/ruby22/lib/libruby-static.a(numeric.o): In function `flo_pow':
/root/build/ruby-2.2.0/numeric.c:1033: undefined reference to `round'
/root/build/ruby-2.2.0/numeric.c:1024: undefined reference to `pow'
/root/build/ruby-2.2.0/numeric.c:1035: undefined reference to `pow'
/root/build/ruby-2.2.0/numeric.c:1027: undefined reference to `pow'
/opt/ruby22/lib/libruby-static.a(process.o): In function `rb_clock_gettime':
/root/build/ruby-2.2.0/process.c:7346: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(process.o): In function `rb_clock_getres':
/root/build/ruby-2.2.0/process.c:7485: undefined reference to `clock_getres'
/opt/ruby22/lib/libruby-static.a(string.o): In function `rb_str_crypt':
/root/build/ruby-2.2.0/string.c:7678: undefined reference to `crypt'
/opt/ruby22/lib/libruby-static.a(time.o): In function `time_init_0':
/root/build/ruby-2.2.0/time.c:1901: undefined reference to `clock_gettime'
/opt/ruby22/lib/libruby-static.a(compile.o): In function `insn_data_to_s_detail':
/root/build/ruby-2.2.0/compile.c:5619: undefined reference to `dladdr'
/opt/ruby22/lib/libruby-static.a(iseq.o): In function `rb_insn_operand_intern':
/root/build/ruby-2.2.0/iseq.c:1263: undefined reference to `dladdr'
/opt/ruby22/lib/libruby-static.a(addr2line.o): In function `fill_lines':
/root/build/ruby-2.2.0/addr2line.c:569: undefined reference to `dlopen'
/root/build/ruby-2.2.0/addr2line.c:571: undefined reference to `dlsym'
/root/build/ruby-2.2.0/addr2line.c:573: undefined reference to `dladdr'
/opt/ruby22/lib/libruby-static.a(addr2line.o): In function `rb_dump_backtrace_with_lines':
/root/build/ruby-2.2.0/addr2line.c:703: undefined reference to `dladdr'
/opt/ruby22/lib/libruby-static.a(dln.o): In function `dln_load':
/root/build/ruby-2.2.0/dln.c:1329: undefined reference to `dlopen'
/root/build/ruby-2.2.0/dln.c:1334: undefined reference to `dlsym'
/opt/ruby22/lib/libruby-static.a(dln.o): In function `dln_strerror':
/root/build/ruby-2.2.0/dln.c:1173: undefined reference to `dlerror'
/root/build/ruby-2.2.0/dln.c:1173: undefined reference to `dlerror'
/opt/ruby22/lib/libruby-static.a(dln.o): In function `dln_load':
/root/build/ruby-2.2.0/dln.c:1337: undefined reference to `dlclose'
collect2: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { rb_thread_call_without_gvl(); return 0; }
/* end */

--------------------

@FooBarWidget
Copy link
Member Author

I see the problem now and I also see why I can't reproduce the bug. It's because you guys compiled Ruby 2.2.0 from source, with a static libruby. However, due to what looks like a bug in Ruby's build system, the wrong compiler flags are passed when compiling native extensions, resulting in autodetection failures even though they should have passed.

This should be reported to the Ruby authors. As a workaround, you can compile Ruby with dynamic libruby instead of static libruby.

@varyform
Copy link

Same issue on ubuntu 14.04.1.

mkdir -p 'buildout/ruby/ruby-2.2.0-x86_64-linux/'
cd 'buildout/ruby/ruby-2.2.0-x86_64-linux/' && /opt/rbenv/versions/2.2.0/bin/ruby '/opt/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby/extconf.rb'
checking for alloca.h... yes
checking for ruby/version.h... yes
checking for ruby/io.h... yes
checking for ruby/thread.h... yes
checking for ruby_version... no
checking for rb_thread_io_blocking_region()... no
checking for rb_thread_call_without_gvl()... no
creating Makefile
cd 'buildout/ruby/ruby-2.2.0-x86_64-linux/' && make
compiling /opt/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby/passenger_native_support.c
/opt/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby/passenger_native_support.c: In function ‘f_generic_writev’:
/opt/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby/passenger_native_support.c:341:6: warning: implicit declaration of function ‘rb_thread_blocking_region’ [-Wimplicit-function-declaration]
      ret = (int) rb_thread_blocking_region(writev_wrapper,
      ^
linking shared-object passenger_native_support.so

However everything is ok on 2nd ubuntu box.
The only differences there is that failing version is built with http_secure_link_module.
Gonna experiment with that and post here details if any.

@varyform
Copy link

@FooBarWidget oh.. seems like rvm compiles it right but rbenv not.

@xenda
Copy link

xenda commented Dec 26, 2014

I'm currently compiling Ruby with the dynamic library. Will report in a couple of minutes if everything goes right.

@FooBarWidget
Copy link
Member Author

@varyform I've already figured out what the problem is. See my comment above. I'm reporting an issue to the Ruby authors right now.

@FooBarWidget
Copy link
Member Author

The bug report is here: https://bugs.ruby-lang.org/issues/10656

@xenda
Copy link

xenda commented Dec 26, 2014

After recompiling as suggested, it's working now. @FooBarWidget Thanks a lot for the help figuring this out.

Have an awesome weekend!

@varyform
Copy link

Yeah, works fine with CONFIGURE_OPTS=--enable-shared rbenv install 2.2.0

@gbuesing
Copy link

I'm getting this error on Heroku with Passenger 4.0.56 and the Ruby version in my Gemfile set to "2.2.0":

Passenger RackApp: /app: symbol lookup error: /app/vendor/bundle/ruby/2.2.0/gems/passenger-4.0.56/buildout/ruby/ruby-2.2.0-x86_64-linux/passenger_native_support.so: undefined symbol: rb_thread_blocking_region

@jvdgeest
Copy link

I'm having the same issue on Ubuntu 14.04 using rbenv, ruby 2.2.0 and Passenger 4.0.56. I tried compiling ruby using @varyform's suggestion, but that didn't help. From the log:

App 10075 stderr: Passenger RackApp: /srv/www/.../current: symbol lookup error: /home/deploy/.passenger/native_support/4.0.56/ruby-2.2.0-x86_64-linux/passenger_native_support.so: undefined symbol: rb_thread_blocking_region

Edit: after a clean install I had more luck. Seems to work now, thanks @FooBarWidget and @varyform :)

@nanaya
Copy link

nanaya commented Dec 28, 2014

just dropping in to say --enable-shared also "fixed" it for me.

(in quote because it's to work around a bug in ruby)

@toncid
Copy link

toncid commented Dec 30, 2014

+1

I'm getting this error after a Ruby 2.2 upgrade on Heroku (Passenger v4.0.56). Any suggestions on how to address this issue there?

Thanks!

@FooBarWidget
Copy link
Member Author

@toncid @gbuesing You guys should contact Heroku and complain to them, referring to https://bugs.ruby-lang.org/issues/10656. Alternatively, you can work around this problem by setting the PASSENGER_USE_RUBY_NATIVE_SUPPORT=0 environment variable to disable use of native_support in Passenger.

@FooBarWidget
Copy link
Member Author

Wait, maybe I spoke too soon. I got some feedback from the Ruby core team, and this issue might be caused by Passenger after all. I'm investigating.

@FooBarWidget
Copy link
Member Author

This appears to be a Passenger bug after all. In mkmf.rb we clear $LIBS in order to fix #168, but that fix appears to cause issues with static libruby, and for some reason only on Ruby 2.2.

I've pushed an experimental patch to the fix_static_libruby branch, but I need help to verify whether it fixes the problem. With that patch, Passenger should work even if you use a static libruby. Could anyone confirm that it works?

@thomasdarde
Copy link

I have a compilation timeout on heroku with fix_static_libruby branch

@FooBarWidget
Copy link
Member Author

You can't use the branch on Heroku yet because compilation doesn't work on Heroku. It'll only work on Heroku after we've released binaries.

Can someone who's not on Heroku verify that the fix works?

@toncid
Copy link

toncid commented Dec 30, 2014

@FooBarWidget Can you please explain implications that PASSENGER_USE_RUBY_NATIVE_SUPPORT=0 brings? I'd like to understand what it turns off and at what (performance-wise) cost.

Also, I believe this ticket should be reopened until it's fixed.

@FooBarWidget
Copy link
Member Author

@toncid It turns off use of the native extension, causing Passenger to fallback to pure-Ruby code. The native extension contains micro-optimized code paths for things like I/O, sockets, etc. Turning it off has a small performance impact, but it's probably unnoticeable outside of hello world benchmarks.

@decasia
Copy link

decasia commented Dec 30, 2014

@FooBarWidget, for what it's worth, I just installed your fix_static_libruby branch (on Ubuntu 12.04 with statically built Ruby 2.2.0) and still see the undefined symbol: rb_thread_blocking_region error when trying to start applications. If there's any specific debugging information that would be helpful, I'd be happy to provide it.

(I used specific_install to pull in the code from Github, for what it's worth.)

@FooBarWidget
Copy link
Member Author

@decasia Could you provide me with your mkmf.log?

@decasia
Copy link

decasia commented Dec 30, 2014

have_header: checking for alloca.h... -------------------- yes

"gcc -o conftest -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static   -lpthread"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -E -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <alloca.h>
/* end */

--------------------

have_header: checking for ruby/version.h... -------------------- yes

"gcc -E -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby/version.h>
/* end */

--------------------

have_header: checking for ruby/io.h... -------------------- yes

"gcc -E -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby/io.h>
/* end */

--------------------

have_header: checking for ruby/thread.h... -------------------- yes

"gcc -E -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby/thread.h>
/* end */

--------------------

have_var: checking for ruby_version... -------------------- no

"gcc -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g   -c conftest.c"
conftest.c: In function ‘t’:
conftest.c:13:55: error: ‘ruby_version’ undeclared (first use in this function)
conftest.c:13:55: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:13:45: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10:
11:   return 0;
12: }
13: int t(void) { const volatile void *volatile p; p = &(&ruby_version)[0]; return 0; }
/* end */

--------------------

have_func: checking for rb_thread_io_blocking_region() in ruby/io.h... -------------------- no

"gcc -o conftest -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static   -lpthread"
conftest.c: In function ‘t’:
conftest.c:15:57: error: ‘rb_thread_io_blocking_region’ undeclared (first use in this function)
conftest.c:15:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:15:32: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <ruby/io.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_thread_io_blocking_region; return 0; }
/* end */

"gcc -o conftest -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static   -lpthread"
conftest.c: In function ‘t’:
conftest.c:15:1: warning: implicit declaration of function ‘rb_thread_io_blocking_region’ [-Wimplicit-function-declaration]
/usr/local/lib/libruby-static.a(bignum.o): In function `rb_big_pow':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/bignum.c:6305: undefined reference to `pow'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/bignum.c:6264: undefined reference to `round'
/usr/local/lib/libruby-static.a(gc.o): In function `getrusage_time':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(numeric.o): In function `ruby_float_step_size':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1907: undefined reference to `floor'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1911: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `flodivmod':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:901: undefined reference to `fmod'
/usr/local/lib/libruby-static.a(numeric.o): In function `ruby_float_step_size':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1911: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_floor':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1627: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_ceil':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1652: undefined reference to `ceil'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_floor':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1627: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_truncate':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_ceil':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1652: undefined reference to `ceil'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_prev_float':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1608: undefined reference to `nextafter'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_next_float':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1556: undefined reference to `nextafter'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_pow':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1035: undefined reference to `pow'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1033: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `fix_pow':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:3241: undefined reference to `round'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:3243: undefined reference to `pow'
/usr/local/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `fix_divide':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:3035: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_round':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1780: undefined reference to `pow'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1781: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_truncate':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/usr/local/lib/libruby-static.a(process.o): In function `rb_clock_gettime':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/process.c:7346: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(process.o): In function `rb_clock_getres':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/process.c:7485: undefined reference to `clock_getres'
/usr/local/lib/libruby-static.a(string.o): In function `rb_str_crypt':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/string.c:7678: undefined reference to `crypt'
/usr/local/lib/libruby-static.a(time.o): In function `time_init_0':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/time.c:1901: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(iseq.o): In function `rb_insn_operand_intern':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/iseq.c:1263: undefined reference to `dladdr'
/usr/local/lib/libruby-static.a(thread.o): In function `native_cond_timeout':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread_pthread.c:376: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(thread.o): In function `timeofday':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1132: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(thread.o): In function `getclockofday':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1059: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1059: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(thread.o): In function `timeofday':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1132: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(thread.o):/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1132: more undefined references to `clock_gettime' follow
/usr/local/lib/libruby-static.a(math.o): In function `math_log1':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:492: undefined reference to `log'
/usr/local/lib/libruby-static.a(math.o): In function `math_erfc':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:774: undefined reference to `erfc'
/usr/local/lib/libruby-static.a(math.o): In function `math_erf':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:753: undefined reference to `erf'
/usr/local/lib/libruby-static.a(math.o): In function `math_hypot':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:732: undefined reference to `hypot'
/usr/local/lib/libruby-static.a(math.o): In function `math_cbrt':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:675: undefined reference to `cbrt'
/usr/local/lib/libruby-static.a(math.o): In function `math_exp':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:422: undefined reference to `exp'
/usr/local/lib/libruby-static.a(math.o): In function `math_asinh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:369: undefined reference to `asinh'
/usr/local/lib/libruby-static.a(math.o): In function `math_acosh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:347: undefined reference to `acosh'
/usr/local/lib/libruby-static.a(math.o): In function `math_tanh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:321: undefined reference to `tanh'
/usr/local/lib/libruby-static.a(math.o): In function `math_sinh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:292: undefined reference to `sinh'
/usr/local/lib/libruby-static.a(math.o): In function `math_cosh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:263: undefined reference to `cosh'
/usr/local/lib/libruby-static.a(math.o): In function `math_atan':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:234: undefined reference to `atan'
/usr/local/lib/libruby-static.a(math.o): In function `math_asin':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:213: undefined reference to `asin'
/usr/local/lib/libruby-static.a(math.o): In function `math_acos':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:187: undefined reference to `acos'
/usr/local/lib/libruby-static.a(math.o): In function `math_tan':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:161: undefined reference to `tan'
/usr/local/lib/libruby-static.a(math.o): In function `math_sin':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:139: undefined reference to `sin'
/usr/local/lib/libruby-static.a(math.o): In function `math_cos':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:117: undefined reference to `cos'
/usr/local/lib/libruby-static.a(math.o): In function `math_sqrt':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:632: undefined reference to `sqrt'
/usr/local/lib/libruby-static.a(math.o): In function `math_log10':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:590: undefined reference to `log10'
/usr/local/lib/libruby-static.a(math.o): In function `math_log2':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:548: undefined reference to `log2'
/usr/local/lib/libruby-static.a(math.o): In function `math_lgamma':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:893: undefined reference to `lgamma_r'
/usr/local/lib/libruby-static.a(math.o): In function `math_atanh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:398: undefined reference to `atanh'
/usr/local/lib/libruby-static.a(math.o): In function `math_atan2':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:94: undefined reference to `atan2'
/usr/local/lib/libruby-static.a(math.o): In function `math_gamma':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:862: undefined reference to `tgamma'
/usr/local/lib/libruby-static.a(math.o): In function `math_cos':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:117: undefined reference to `cos'
/usr/local/lib/libruby-static.a(math.o): In function `math_cosh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:263: undefined reference to `cosh'
/usr/local/lib/libruby-static.a(math.o): In function `math_exp':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:422: undefined reference to `exp'
/usr/local/lib/libruby-static.a(math.o): In function `math_sin':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:139: undefined reference to `sin'
/usr/local/lib/libruby-static.a(math.o): In function `math_sinh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:292: undefined reference to `sinh'
/usr/local/lib/libruby-static.a(compile.o): In function `insn_data_to_s_detail':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/compile.c:5619: undefined reference to `dladdr'
/usr/local/lib/libruby-static.a(addr2line.o): In function `fill_lines':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/addr2line.c:569: undefined reference to `dlopen'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/addr2line.c:571: undefined reference to `dlsym'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/addr2line.c:573: undefined reference to `dladdr'
/usr/local/lib/libruby-static.a(addr2line.o): In function `rb_dump_backtrace_with_lines':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/addr2line.c:703: undefined reference to `dladdr'
/usr/local/lib/libruby-static.a(dln.o): In function `dln_load':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1329: undefined reference to `dlopen'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1334: undefined reference to `dlsym'
/usr/local/lib/libruby-static.a(dln.o): In function `dln_strerror':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1173: undefined reference to `dlerror'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1173: undefined reference to `dlerror'
/usr/local/lib/libruby-static.a(dln.o): In function `dln_load':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1337: undefined reference to `dlclose'
collect2: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <ruby/io.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { rb_thread_io_blocking_region(); return 0; }
/* end */

--------------------

have_func: checking for rb_thread_call_without_gvl() in ruby/thread.h... -------------------- no

"gcc -o conftest -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static   -lpthread"
conftest.c: In function ‘t’:
conftest.c:15:32: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
/usr/local/lib/libruby-static.a(bignum.o): In function `rb_big_pow':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/bignum.c:6305: undefined reference to `pow'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/bignum.c:6264: undefined reference to `round'
/usr/local/lib/libruby-static.a(gc.o): In function `getrusage_time':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/gc.c:7972: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(numeric.o): In function `ruby_float_step_size':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1907: undefined reference to `floor'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1911: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `flodivmod':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:901: undefined reference to `fmod'
/usr/local/lib/libruby-static.a(numeric.o): In function `ruby_float_step_size':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1911: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_floor':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1627: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_ceil':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1652: undefined reference to `ceil'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_floor':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1627: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_truncate':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_ceil':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1652: undefined reference to `ceil'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_prev_float':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1608: undefined reference to `nextafter'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_next_float':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1556: undefined reference to `nextafter'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_pow':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1035: undefined reference to `pow'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1033: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `fix_pow':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:3241: undefined reference to `round'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:3243: undefined reference to `pow'
/usr/local/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `fix_divide':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:3035: undefined reference to `floor'
/usr/local/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_round':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1780: undefined reference to `pow'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1781: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `dbl2ival':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:969: undefined reference to `round'
/usr/local/lib/libruby-static.a(numeric.o): In function `flo_truncate':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1801: undefined reference to `floor'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/numeric.c:1802: undefined reference to `ceil'
/usr/local/lib/libruby-static.a(process.o): In function `rb_clock_gettime':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/process.c:7346: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(process.o): In function `rb_clock_getres':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/process.c:7485: undefined reference to `clock_getres'
/usr/local/lib/libruby-static.a(string.o): In function `rb_str_crypt':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/string.c:7678: undefined reference to `crypt'
/usr/local/lib/libruby-static.a(time.o): In function `time_init_0':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/time.c:1901: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(iseq.o): In function `rb_insn_operand_intern':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/iseq.c:1263: undefined reference to `dladdr'
/usr/local/lib/libruby-static.a(thread.o): In function `native_cond_timeout':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread_pthread.c:376: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(thread.o): In function `timeofday':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1132: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(thread.o): In function `getclockofday':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1059: undefined reference to `clock_gettime'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1059: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(thread.o): In function `timeofday':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1132: undefined reference to `clock_gettime'
/usr/local/lib/libruby-static.a(thread.o):/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/thread.c:1132: more undefined references to `clock_gettime' follow
/usr/local/lib/libruby-static.a(math.o): In function `math_log1':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:492: undefined reference to `log'
/usr/local/lib/libruby-static.a(math.o): In function `math_erfc':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:774: undefined reference to `erfc'
/usr/local/lib/libruby-static.a(math.o): In function `math_erf':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:753: undefined reference to `erf'
/usr/local/lib/libruby-static.a(math.o): In function `math_hypot':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:732: undefined reference to `hypot'
/usr/local/lib/libruby-static.a(math.o): In function `math_cbrt':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:675: undefined reference to `cbrt'
/usr/local/lib/libruby-static.a(math.o): In function `math_exp':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:422: undefined reference to `exp'
/usr/local/lib/libruby-static.a(math.o): In function `math_asinh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:369: undefined reference to `asinh'
/usr/local/lib/libruby-static.a(math.o): In function `math_acosh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:347: undefined reference to `acosh'
/usr/local/lib/libruby-static.a(math.o): In function `math_tanh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:321: undefined reference to `tanh'
/usr/local/lib/libruby-static.a(math.o): In function `math_sinh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:292: undefined reference to `sinh'
/usr/local/lib/libruby-static.a(math.o): In function `math_cosh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:263: undefined reference to `cosh'
/usr/local/lib/libruby-static.a(math.o): In function `math_atan':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:234: undefined reference to `atan'
/usr/local/lib/libruby-static.a(math.o): In function `math_asin':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:213: undefined reference to `asin'
/usr/local/lib/libruby-static.a(math.o): In function `math_acos':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:187: undefined reference to `acos'
/usr/local/lib/libruby-static.a(math.o): In function `math_tan':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:161: undefined reference to `tan'
/usr/local/lib/libruby-static.a(math.o): In function `math_sin':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:139: undefined reference to `sin'
/usr/local/lib/libruby-static.a(math.o): In function `math_cos':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:117: undefined reference to `cos'
/usr/local/lib/libruby-static.a(math.o): In function `math_sqrt':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:632: undefined reference to `sqrt'
/usr/local/lib/libruby-static.a(math.o): In function `math_log10':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:590: undefined reference to `log10'
/usr/local/lib/libruby-static.a(math.o): In function `math_log2':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:548: undefined reference to `log2'
/usr/local/lib/libruby-static.a(math.o): In function `math_lgamma':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:893: undefined reference to `lgamma_r'
/usr/local/lib/libruby-static.a(math.o): In function `math_atanh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:398: undefined reference to `atanh'
/usr/local/lib/libruby-static.a(math.o): In function `math_atan2':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:94: undefined reference to `atan2'
/usr/local/lib/libruby-static.a(math.o): In function `math_gamma':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:862: undefined reference to `tgamma'
/usr/local/lib/libruby-static.a(math.o): In function `math_cos':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:117: undefined reference to `cos'
/usr/local/lib/libruby-static.a(math.o): In function `math_cosh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:263: undefined reference to `cosh'
/usr/local/lib/libruby-static.a(math.o): In function `math_exp':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:422: undefined reference to `exp'
/usr/local/lib/libruby-static.a(math.o): In function `math_sin':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:139: undefined reference to `sin'
/usr/local/lib/libruby-static.a(math.o): In function `math_sinh':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/math.c:292: undefined reference to `sinh'
/usr/local/lib/libruby-static.a(compile.o): In function `insn_data_to_s_detail':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/compile.c:5619: undefined reference to `dladdr'
/usr/local/lib/libruby-static.a(addr2line.o): In function `fill_lines':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/addr2line.c:569: undefined reference to `dlopen'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/addr2line.c:571: undefined reference to `dlsym'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/addr2line.c:573: undefined reference to `dladdr'
/usr/local/lib/libruby-static.a(addr2line.o): In function `rb_dump_backtrace_with_lines':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/addr2line.c:703: undefined reference to `dladdr'
/usr/local/lib/libruby-static.a(dln.o): In function `dln_load':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1329: undefined reference to `dlopen'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1334: undefined reference to `dlsym'
/usr/local/lib/libruby-static.a(dln.o): In function `dln_strerror':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1173: undefined reference to `dlerror'
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1173: undefined reference to `dlerror'
/usr/local/lib/libruby-static.a(dln.o): In function `dln_load':
/tmp/tmp.O0rMUJuRLh/ruby-2.2.0/dln.c:1337: undefined reference to `dlclose'
collect2: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <ruby/thread.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_thread_call_without_gvl; return 0; }
/* end */

"gcc -o conftest -I/usr/local/include/ruby-2.2.0/x86_64-linux -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I/usr/local/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -g conftest.c  -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static   -lpthread"
conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘rb_thread_call_without_gvl’
/usr/local/include/ruby-2.2.0/ruby/thread.h:28:7: note: declared here
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <ruby/thread.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { rb_thread_call_without_gvl(); return 0; }
/* end */

--------------------

@FooBarWidget
Copy link
Member Author

Hm, it does not appear to be possible to fix this issue without also breaking #168. :(

I've committed the final fix to the stable-4.0 and the master branch. Let's hope that #168 is no longer relevant nowadays with newer Ruby versions.

@decasia
Copy link

decasia commented Dec 31, 2014

Thanks very much, @FooBarWidget, the revised patch works perfectly on my Ubuntu 12.04/ruby-2.2.0-from-source system. Much appreciated.

Any chance of getting a gem release of 4.0.57?

@FooBarWidget
Copy link
Member Author

Yes, it will be released soon, probably on Friday.

@Ch4s3
Copy link

Ch4s3 commented Jan 2, 2015

@FooBarWidget Any word on whether or not this will get released today?

@FooBarWidget
Copy link
Member Author

That depends on QA results. If it's not today, probably Monday.

@Ch4s3
Copy link

Ch4s3 commented Jan 2, 2015

Awesome! Thanks @FooBarWidget

@scott-stewart
Copy link

I noticed that 4.0.57 was recently pushed to ruby gems and confirm that all is well now on a Heroku Ruby 2.2.0 app.

@FooBarWidget
Copy link
Member Author

Yes, 4.0.57 is released, though I'm still working on the release announcement.

@roydq
Copy link

roydq commented Mar 2, 2015

I just updated to 4.0.59 and for some reason this started showing up on one of my web servers again? Not sure what to make of it. All apps running on 2.2.0 via rbenv, installed with ruby-build. Passenger installed via apt-get on ubuntu 14.04.

symbol lookup error: /home/deploy/.passenger-enterprise/native_support/4.0.59/ruby-2.2.0-x86_64-linux/passenger_native_support.so: undefined symbol: rb_thread_blocking_region

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests