dbalmain / ferret

Ferret: the extensible information retrieval library for ruby.
http://ferret.davebalmain.com
MIT License
279 stars 59 forks source link

Cannot install on Ruby 3.0 #14

Open DannyBen opened 3 years ago

DannyBen commented 3 years ago
$ gem install ferret
Building native extensions. This could take a while...
ERROR:  Error installing ferret:
        ERROR: Failed to build gem native extension.

followed by many errors related to BZLIB:

current directory: /usr/share/rvm/gems/ruby-3.0.0/gems/ferret-0.11.8.7/ext
/usr/share/rvm/rubies/ruby-3.0.0/bin/ruby -I /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0 -r ./siteconf20201231-19724-cqie8u.rb extconf.rb
creating Makefile

current directory: /usr/share/rvm/gems/ruby-3.0.0/gems/ferret-0.11.8.7/ext
make "DESTDIR=" clean

current directory: /usr/share/rvm/gems/ruby-3.0.0/gems/ferret-0.11.8.7/ext
make "DESTDIR="
compiling BZLIB_blocksort.c
compiling BZLIB_bzlib.c
BZLIB_bzlib.c: In function ‘BZ2_bz__AssertH__fail’:
BZLIB_bzlib.c:41:6: warning: function might be candidate for attribute ‘noreturn’ [-Wsuggest-attribute=noreturn]
 void BZ2_bz__AssertH__fail ( int errcode )
      ^~~~~~~~~~~~~~~~~~~~~
BZLIB_bzlib.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-cast-function-type’
compiling BZLIB_compress.c
BZLIB_compress.c: In function ‘BZ2_compressBlock’:
BZLIB_compress.c:391:54: warning: ‘cost[5]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
                                                      ^~
BZLIB_compress.c:256:11: note: ‘cost[5]’ was declared here
    UInt16 cost[BZ_N_GROUPS];
           ^~~~
BZLIB_compress.c:401:21: warning: ‘cost[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             if (cost[t] < bc) { bc = cost[t]; bt = t; };
                 ~~~~^~~
BZLIB_compress.c:256:11: note: ‘cost[3]’ was declared here
    UInt16 cost[BZ_N_GROUPS];
           ^~~~
BZLIB_compress.c:401:21: warning: ‘cost[2]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             if (cost[t] < bc) { bc = cost[t]; bt = t; };
                 ~~~~^~~
BZLIB_compress.c:256:11: note: ‘cost[2]’ was declared here
    UInt16 cost[BZ_N_GROUPS];
           ^~~~
BZLIB_compress.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-cast-function-type’
compiling BZLIB_crctable.c
compiling BZLIB_decompress.c
compiling BZLIB_huffman.c
compiling BZLIB_randtable.c
compiling STEMMER_api.c
compiling STEMMER_libstemmer.c
compiling STEMMER_stem_ISO_8859_1_danish.c
compiling STEMMER_stem_ISO_8859_1_dutch.c
compiling STEMMER_stem_ISO_8859_1_english.c
compiling STEMMER_stem_ISO_8859_1_finnish.c
compiling STEMMER_stem_ISO_8859_1_french.c
compiling STEMMER_stem_ISO_8859_1_german.c
compiling STEMMER_stem_ISO_8859_1_hungarian.c
compiling STEMMER_stem_ISO_8859_1_italian.c
compiling STEMMER_stem_ISO_8859_1_norwegian.c
compiling STEMMER_stem_ISO_8859_1_porter.c
compiling STEMMER_stem_ISO_8859_1_portuguese.c
compiling STEMMER_stem_ISO_8859_1_spanish.c
compiling STEMMER_stem_ISO_8859_1_swedish.c
compiling STEMMER_stem_ISO_8859_2_romanian.c
compiling STEMMER_stem_KOI8_R_russian.c
compiling STEMMER_stem_UTF_8_danish.c
compiling STEMMER_stem_UTF_8_dutch.c
compiling STEMMER_stem_UTF_8_english.c
compiling STEMMER_stem_UTF_8_finnish.c
compiling STEMMER_stem_UTF_8_french.c
compiling STEMMER_stem_UTF_8_german.c
compiling STEMMER_stem_UTF_8_hungarian.c
compiling STEMMER_stem_UTF_8_italian.c
compiling STEMMER_stem_UTF_8_norwegian.c
compiling STEMMER_stem_UTF_8_porter.c
compiling STEMMER_stem_UTF_8_portuguese.c
compiling STEMMER_stem_UTF_8_romanian.c
compiling STEMMER_stem_UTF_8_russian.c
compiling STEMMER_stem_UTF_8_spanish.c
compiling STEMMER_stem_UTF_8_swedish.c
compiling STEMMER_stem_UTF_8_turkish.c
compiling STEMMER_utilities.c
compiling analysis.c
compiling array.c
compiling bitvector.c
In file included from bitvector.c:1:0:
bitvector.h: In function ‘frt_bv_scan_next_from’:
bitvector.h:280:16: warning: left shift of negative value [-Wshift-negative-value]
     word &= ~0 << (bit & 31);
                ^~
bitvector.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-cast-function-type’
compiling compound_io.c
In file included from index.h:16:0,
                 from compound_io.c:1:
bitvector.h: In function ‘frt_bv_scan_next_from’:
bitvector.h:280:16: warning: left shift of negative value [-Wshift-negative-value]
     word &= ~0 << (bit & 31);
                ^~
In file included from compound_io.c:1:0:
index.h: At top level:
index.h:595:25: error: width of ‘is_compressed’ exceeds its type
     bool                is_compressed : 2; /* set to 2 after all data is loaded */
                         ^~~~~~~~~~~~~
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-cast-function-type’
Makefile:244: recipe for target 'compound_io.o' failed
make: *** [compound_io.o] Error 1

make failed, exit code 2
boutil commented 3 years ago

We have the same issue in Debian. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996227

boutil commented 3 years ago

As I understand, the problem comes from the fact that starting from ruby3.0, bool is considered as a type on 1 bit, and not as an alias for (unsigned) int. And ferret was using a trick to be able to use a bool with three values: 0, 1, 2, which does not work anymore with the new restriction.

dleidert commented 3 years ago

There is a possible patch by the NetBSD community: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/textproc/ruby-ferret/patches/

akimd commented 2 years ago

Ping. This is really a problem when migrating to newer versions of Ruby, 3.1 included.

DannyBen commented 2 years ago

Since this is a year old issue, and last commit was four years ago - I believe it is safe to say this gem is abandoned.