Problem compiling ruby bindings for warc-tools

8 views
Skip to first unread message

Erik Hetzner

unread,
Jan 7, 2009, 6:11:40 PM1/7/09
to warc-...@googlegroups.com
Hi -

I am having a minor difficulty compiling the ruby bindings for
warc-tools. Here is some information.

egh@gales:~/software/warc-tools$ uname -a
Linux gales.cdlib.org 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686 GNU/Linux

egh@gales:~/software/warc-tools$ swig -version

SWIG Version 1.3.35

Compiled with g++ [i686-pc-linux-gnu]
Please see http://www.swig.org for reporting bugs and further information

egh@gales:~/software/warc-tools$ make ruby

[…]

cc -shared -o lib/private/plugin/ruby/warctools.so lib/private/plugin/ruby/warctools_wrap.o lib/private/plugin/ruby/wrbbless.o lib/private/plugin/ruby/payload.o lib/private/plugin/gzip/adler32.o lib/private/plugin/gzip/compress.o lib/private/plugin/gzip/crc32.o lib/private/plugin/gzip/deflate.o lib/private/plugin/gzip/infback.o lib/private/plugin/gzip/inffast.o lib/private/plugin/gzip/inflate.o lib/private/plugin/gzip/inftrees.o lib/private/plugin/gzip/trees.o lib/private/plugin/gzip/uncompr.o lib/private/wendian.o lib/private/plugin/gzip/wgzipbit.o lib/private/plugin/gzip/zutil.o lib/private/wgzip.o lib/private/plugin/tiger/tiger.o lib/private/wstring.o lib/private/wlist.o lib/private/wclass.o lib/private/os/wmktmp.o lib/private/whash.o lib/private/wkv.o lib/private/os/wcsafe.o lib/private/wuuid.o lib/private/wrecord.o lib/private/wheader.o lib/private/wanvl.o lib/private/wfsmanvl.o lib/private/wfile.o lib/private/wregexp.o lib/private/wbloc.o lib/private/wversion.o \
-L. -L/usr/lib -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/usr/lib -L/usr/lib -L/usr/lib -L/usr/local/lib -lruby -lpthread -ldl -lcrypt -lm -lc
/usr/bin/ld: cannot find -lruby
collect2: ld returned 1 exit status
make[1]: *** [rbshared_unix] Error 1
make[1]: Leaving directory `/home/egh/software/warc-tools'
make: *** [ruby] Error 2

If I patch makefile as follows to hardcode the libruby version:

egh@gales:~/software/warc-tools$ svn diff makefile
Index: makefile
===================================================================
--- makefile (revision 241)
+++ makefile (working copy)
@@ -267,7 +267,7 @@
EV_LIB = -lrt
#-lnsl -lresolv
VERS_RUBY =
- LIB_RUBY += -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,$(LIB_RUBY_PATH) -L$(LIB_RUBY_PATH) -L/usr/lib -L/usr/local/lib -lruby$(VERS_RUBY) -lpthread -ldl -lcrypt -lm -lc
+ LIB_RUBY += -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,$(LIB_RUBY_PATH) -L$(LIB_RUBY_PATH) -L/usr/lib -L/usr/local/lib -lruby1.8 -lpthread -ldl -lcrypt -lm -lc
endif
ifeq ($(UNAME_S),FreeBSD)
MAKE = gmake

the build works.

best,
Erik Hetzner

WARC

unread,
Jan 7, 2009, 7:37:39 PM1/7/09
to warc-...@googlegroups.com
Hi Erik,

Thanks for reporting Erik.

> I am having a minor difficulty compiling the ruby bindings for
> warc-tools. Here is some information.
>

> lib/private/wfsmanvl.o lib/private/wfile.o lib/private/

> wregexp.o lib/private/wbloc.o lib/private/wversion.o \
> -L. -L/usr/lib -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/
> usr/lib -L/usr/lib -L/usr/lib -L/usr/local/lib -lruby -lpthread -
> ldl -lcrypt -lm -lc
> /usr/bin/ld: cannot find -lruby
> collect2: ld returned 1 exit status
> make[1]: *** [rbshared_unix] Error 1
> make[1]: Leaving directory `/home/egh/software/warc-tools'
> make: *** [ruby] Error 2
>


This bug appears only under certain Linux distributions when Ruby is
shipped
with it's "version number" appended to it's shared library name.
In you case, it's "libruby1.8".

Under Mac OSX, Fedora, FreeBSD and some source based distribs, we have
a symlink:

/usr/lib/libruby.so -> /usr/lib/libruby1.8.so

and the dependecies is resolved. So, if you want, you can add this
symlink in your system.

> If I patch makefile as follows to hardcode the libruby version:
>
> egh@gales:~/software/warc-tools$ svn diff makefile
> Index: makefile
> ===================================================================
> --- makefile (revision 241)
> +++ makefile (working copy)
> @@ -267,7 +267,7 @@
> EV_LIB = -lrt
> #-lnsl -lresolv
> VERS_RUBY =
> - LIB_RUBY += -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,$
> (LIB_RUBY_PATH) -L$(LIB_RUBY_PATH) -L/usr/lib -L/usr/local/lib -lruby
> $(VERS_RUBY) -lpthread -ldl -lcrypt -lm -lc
> + LIB_RUBY += -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,$
> (LIB_RUBY_PATH) -L$(LIB_RUBY_PATH) -L/usr/lib -L/usr/local/lib -
> lruby1.8 -lpthread -ldl -lcrypt -lm -lc
> endif
> ifeq ($(UNAME_S),FreeBSD)
> MAKE = gmake

Thanks for the patch. It will be integrated soon with an automatic
detection of Ruby version.

Regards
Younès

Erik Hetzner

unread,
Jan 7, 2009, 8:00:27 PM1/7/09
to warc-...@googlegroups.com
Hi Younès -

At Thu, 8 Jan 2009 01:37:39 +0100,


WARC <voidp...@gmail.com> wrote:
> Hi Erik,
>
> Thanks for reporting Erik.

my pleasure!

> This bug appears only under certain Linux distributions when Ruby is
> shipped with it's "version number" appended to it's shared library
> name. In you case, it's "libruby1.8".
>
> Under Mac OSX, Fedora, FreeBSD and some source based distribs, we
> have a symlink:
>
> /usr/lib/libruby.so -> /usr/lib/libruby1.8.so
>
> and the dependecies is resolved. So, if you want, you can add this
> symlink in your system.

It looks like the makefile is trying to init the VERS_RUBY variable to
represent the 1.8 so that it uses -lruby1.8 or -lruby1.9 depending on
the ruby version. But for some reason (I don’t understand makefiles)
this variable is not working properly.

> Thanks for the patch. It will be integrated soon with an automatic
> detection of Ruby version.

Not sure if this is a good idea, since it breaks support on linux for
ruby 1.9, if I understand correctly.

-Erik

WARC

unread,
Jan 7, 2009, 8:38:01 PM1/7/09
to warc-...@googlegroups.com
Hi Erik

>> Thanks for the patch. It will be integrated soon with an automatic
>> detection of Ruby version.
>
> Not sure if this is a good idea, since it breaks support on linux for
> ruby 1.9, if I understand correctly.
>

A generic fix will come. This why we create the RUBY_VERSION varibale
in the Makefile and
didn't use it yet ;-).


> -Erik
> ;; Erik Hetzner, California Digital Library
> ;; gnupg key id: 1024D/01DB07E3

Regards
Younès

Erik Hetzner

unread,
Jan 7, 2009, 8:48:26 PM1/7/09
to warc-...@googlegroups.com
At Thu, 8 Jan 2009 02:38:01 +0100,

WARC <voidp...@gmail.com> wrote:
> A generic fix will come. This why we create the RUBY_VERSION varibale
> in the Makefile and
> didn't use it yet ;-).

Hi Younès -

Okay, another fix then, to keep the value of the VERS_RUBY variable
from being cleared (it is defined twice) - I missed this first time
around. The VERS_RUBY variable is defined correctly earlier in the
makefile.


egh@gales:~/software/warc-tools$ svn diff


Index: makefile
===================================================================
--- makefile (revision 241)
+++ makefile (working copy)

@@ -266,7 +266,6 @@
EVENT_CONFIG = $(EV_OS)/config.h $(EV_OS)/event-config.h


EV_LIB = -lrt
#-lnsl -lresolv

- VERS_RUBY =
LIB_RUBY += -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,$(LIB_RUBY_PATH) -L$(LIB_RUBY_PATH) -L/usr/lib -L/usr/local/lib -lruby$(VERS_RUBY) -lpthread -ldl -lcrypt -lm -lc
endif
ifeq ($(UNAME_S),FreeBSD)

best, Erik

WARC

unread,
Jan 7, 2009, 9:01:20 PM1/7/09
to warc-...@googlegroups.com
HI Erik,


Okay, another fix then, to keep the value of the VERS_RUBY variable
from being cleared (it is defined twice) - I missed this first time
around. The VERS_RUBY variable is defined correctly earlier in the
makefile.


egh@gales:~/software/warc-tools$ svn diff
Index: makefile
===================================================================
--- makefile (revision 241)
+++ makefile (working copy)
@@ -266,7 +266,6 @@
EVENT_CONFIG = $(EV_OS)/config.h $(EV_OS)/event-config.h
EV_LIB = -lrt
#-lnsl -lresolv
- VERS_RUBY    =
LIB_RUBY    += -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,$(LIB_RUBY_PATH) -L$(LIB_RUBY_PATH) -L/usr/lib -L/usr/local/lib -lruby$(VERS_RUBY)  -lpthread -ldl -lcrypt -lm -lc
endif
ifeq ($(UNAME_S),FreeBSD)


Done. Thanks!!!

best, Erik

;; Erik Hetzner, California Digital Library
;; gnupg key id: 1024D/01DB07E3


Regards
Younès
Reply all
Reply to author
Forward
0 new messages