Opened 10 years ago

Closed 10 years ago

#634 closed defect (fixed)

Fail compiling Ruby bindings Windows MinGW RubyInstaller 1.9.3

Reported by: adenis Owned by:
Priority: normal Milestone: 1.2.18
Component: Xapian-bindings (Ruby) Version: 1.2.17
Severity: major Keywords:
Cc: Blocked By:
Blocking: Operating System: Microsoft Windows

Description

I am trying to compile xapian, omega and xapian Ruby bindings 1.2.17 on Windows using the MinGW environment and Ruby 1.9.3 (installed using the Ruby installer). The Win32 files are not an option because Ruby is compiled with MinGW as of 1.9 version. Xapian compiles out of the box. Omega is giving me some grief about unixperm.cxx. The ruby bindings simply don't link the so file. I tried to link it with libmsvcrt-ruby191-static.a and it linked but it failed to load with a memory error (during require 'xapian').

Link errors:

libtool: link: g++ -shared -nostdlib ..../lib/dllcrt2.o ..../lib/gcc/mingw32/4.5.2/crtbegin.o .libs/xapian_wrap.o   /usr/local/lib/libxapian.dll.a -lz -lws2_32 -lrpcrt4 -lstdc++ -L..../lib/gcc/mingw32/4.5.2 -L..../lib/gcc -L..../mingw32/lib -L..../lib -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt ..../lib/gcc/mingw32/4.5.2/crtend.o  -O2 -Wl,--enable-runtime-pseudo-reloc   -o .libs/_xapian.so -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/_xapian.dll.a

.libs/xapian_wrap.o: In function `SWIG_Ruby_ErrorType':
....\xapian\xapian-bindings-1.2.17\ruby/xapian_wrap.cc:1098: undefined reference to `rb_eRuntimeError'
....\xapian\xapian-bindings-1.2.17\ruby/xapian_wrap.cc:1065: undefined reference to `rb_eIndexError'
.....

Change History (7)

comment:1 by Olly Betts, 10 years ago

It'll need linking against the ruby shared library as symbols need to be resolved at link time on that platform.

In your existing build tree, try:

make RUBY_LIBS=-lmsvcrt-ruby191

The library name is a bit of an informed guess (191 should be correct for 1.9.3, confusing as that may seem). If that isn't right, then you should be able to get the correct name with:

ruby -rrbconfig -e 'print RbConfig::CONFIG["LIBRUBYARG"]'

If that works, I can easily fix configure to get this right by itself.

comment:2 by adenis, 10 years ago

It worked like a charm. I was able to require 'xapian' and to run the smoketest.rb with all test passing. Thanks for the fast and accurate support.

comment:3 by Olly Betts, 10 years ago

Milestone: 1.2.18

Fixed in trunk r17865, needs backporting for 1.2.18.

comment:4 by adenis, 10 years ago

Worked great. I had to regenerate the configuration file using

autoconf configure.ac > configure

and it all compiled out of the box. If you want I can keep on building new versions using my configuration (Windows 7 64bit, MinGW, Ruby 1.9.3) to see if it breaks in the future. You can close the issue.

comment:5 by adenis, 10 years ago

Resolution: fixed
Status: newclosed

comment:6 by Olly Betts, 10 years ago

Resolution: fixed
Status: closedreopened

Thanks, but our workflow is to leave the ticket open if it's still to be backported.

comment:7 by Olly Betts, 10 years ago

Resolution: fixed
Status: reopenedclosed

Backported in r17877.

Note: See TracTickets for help on using tickets.