zookeeper icon indicating copy to clipboard operation
zookeeper copied to clipboard

native extension doesn't compile on Fedora Core 11, 64bit

Open gregretkowski opened this issue 15 years ago • 1 comments

When trying to install the gem on FC11/64 I get the following error while building the native extensions:

    gcc -shared -o zookeeper_c.so zookeeper_c.o -L/usr/lib/ruby/gems/1.8/gems/zookeeper-0.2.2/ext/lib -L/usr/lib/ruby/gems/1.8/gems/zookeeper-0.2.2/ext/lib -L.  -rdynamic -Wl,-export-dynamic -L.  -rdynamic -Wl,-export-dynamic    -lruby  -lpthread -lrt -ldl -lcrypt -lm   -lc -lzookeeper_mt_gem
/usr/bin/ld: /usr/lib/ruby/gems/1.8/gems/zookeeper-0.2.2/ext/lib/libzookeeper_mt_gem.a(libzkmt_la-zk_log.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/ruby/gems/1.8/gems/zookeeper-0.2.2/ext/lib/libzookeeper_mt_gem.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

Applying this change to extconf.rb allowed it to build:

    --- ext/extconf.rb.orig 2010-07-01 15:25:56.460951524 -0700
    +++ ext/extconf.rb  2010-07-01 16:38:26.343882722 -0700
    @@ -33,7 +33,7 @@
         raise "'#{cmd}' failed" unless system(cmd)
     
         Dir.chdir(BUNDLE_PATH) do        
    -      puts(cmd = "env CFLAGS='-fPIC #{$CFLAGS}' LDFLAGS='-fPIC #{$LDFLAGS}' ./configure --prefix=#{HERE} --without-cppunit --disable-shared --disable-dependency-tracking #{$EXTRA_CONF} 2>&1")
    +      puts(cmd = "env CFLAGS='-fPIC #{$CFLAGS}' LDFLAGS='-fPIC #{$LDFLAGS}' ./configure --prefix=#{HERE} --without-cppunit --disable-dependency-tracking #{$EXTRA_CONF} 2>&1")
       raise "'#{cmd}' failed" unless system(cmd)
       puts(cmd = "make CXXFLAGS='#{$CXXFLAGS}' || true 2>&1")
       raise "'#{cmd}' failed" unless system(cmd)

... However now the unit tests fail with:

let's try using a lock
/usr/lib/ruby/gems/1.8/gems/zookeeper-0.2.2/test/../lib/zookeeper.rb:46:in `try_acquire': undefined method `ls' for #<0x7f9d013ba3d0>

gregretkowski avatar Jul 01 '10 23:07 gregretkowski

This patch fixes the unit test btw.

--- lib/zookeeper.rb.orig   2010-07-01 16:58:18.446991572 -0700
+++ lib/zookeeper.rb    2010-07-01 16:58:36.949845912 -0700
@@ -43,7 +43,7 @@
     # see if we got it
     serial = /lock-(\d+)$/.match(realpath).captures[0].to_i
     have_lock = true
-    ls(path).each do |child|
+    get_children(path).each do |child|
       if m = /lock-(\d+)$/.match(child)
         if m.captures[0].to_i 

gregretkowski avatar Jul 02 '10 00:07 gregretkowski