Question

I built Ruby 1.9.2-p320 on Fedora 16 with a vanilla ./configure command, installing in /usr/local

The include files are in /usr/local/include/ruby-1.9.1

This program says "no":

require 'mkmf'
puts have_func('rb_thread_blocking_region') ? "yes" : "no"

I think it's because the command-line to build conftest.c to see if rb_thread_blocking_region exists doesn't include a -I path to the various directories under /usr/local/include/ruby-1.9.1, so the build fails. I'm not sure though, because mkmf uses a custom logger, and anytime I try to add $stderr.puts statements to some of the methods, I either don't see output, or I get that error message telling me I need to install development tools. I'm on linux with a lot of dev tools in place, plus Ruby source, but if someone could tell me how to dump the headers variable in the try_func method that might be helpful.

The weird thing is I had no trouble building other binary gems up to now, including RMagick, but I'm stuck on mysql2, as it thinks that rb_thread_blocking_region doesn't exist, so it generates incorrect code.

Digging in a bit more, I can compile this program with the appropriate -I options, so rb_thread_blocking_region definitely exists.

$ cat conftest.c 
#include "ruby.h"
int main(int argc, char **argv) { return 1; }

int t() {
  void ((*volatile p)());
  p = (void ((*)())) rb_thread_blocking_region;
  return 0;
}

Ahh, here's the problem, from mkmf.log:

"gcc -o conftest -I/usr/local/include/ruby-1.9.1/i686-linux 
    -I/usr/local/include/ruby-1.9.1/ruby/backward  
    -I/usr/local/include/ruby-1.9.1 -I.  
    -I/usr/local/include/ruby-1.9.1/  -D_FILE_OFFSET_BITS=64    
    -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses  
    -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers  
    -Wno-long-long conftest.c  -L. -L/usr/local/lib -Wl,-R/usr/local/lib  
    -L.  -rdynamic -Wl,-export-dynamic     -Wl,-R -Wl,/usr/local/lib  
    -L/usr/local/lib -lruby-static  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/usr/lib/gcc/i686-redhat-linux/4.6.3/../../../libcrypt.a(md5-crypt.o):  
    In function `__md5_crypt_r':
(.text+0x96): undefined reference to `NSSLOW_Init'
/usr/lib/gcc/i686-redhat-linux/4.6.3/../../../libcrypt.a(md5-crypt.o):  
    In function `__md5_crypt_r':

I should've thought of that -- the crypt and openssl libraries have been a hassle on Fedora.

No correct solution

OTHER TIPS

Answer found by looking in mkmf.log. Still not working, but that's another problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top