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

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

Open
gregretkowski opened this issue Jul 1, 2010 · 1 comment
Open

Comments

@gregretkowski
Copy link

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 # (NoMethodError)
    from ./test/test_basic.rb:55
@gregretkowski
Copy link
Author

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 < serial
           have_lock = false

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

No branches or pull requests

1 participant