tyler / trie

A super fast, efficiently stored Trie for Ruby. Uses libdatrie.
http://rubydoc.info/gems/fast_trie/0.5.0/frames
MIT License
247 stars 36 forks source link

Error installing fast_trie on Ubuntu #17

Open troelskn opened 9 years ago

troelskn commented 9 years ago

I get the following error on Ubuntu - It works fine on my osx machine though. Any ideas?

$ gem install fast_trie -v '0.5.0'
Fetching: fast_trie-0.5.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing fast_trie:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 -r ./siteconf20141218-31181-dlm1t7.rb extconf.rb
creating Makefile

make  clean

make
compiling tail.c
tail.c: In function ‘tail_read’:
tail.c:111:9: warning: passing argument 2 of ‘file_read_int32’ from incompatible pointer type [enabled by default]
         file_read_int32 (file, &t->tails[i].data);
         ^
In file included from tail.c:13:0:
fileutils.h:20:8: note: expected ‘int32 *’ but argument is of type ‘TrieData *’
 Bool   file_read_int32 (FILE *file, int32 *o_val);
        ^
compiling darray.c
compiling trie.c
trie.c: In function ‘raise_ioerror’:
trie.c:24:5: error: format not a string literal and no format arguments [-Werror=format-security]
     rb_raise(rb_eIOError, message);
     ^
trie.c: In function ‘rb_trie_has_key’:
trie.c:84:5: warning: implicit declaration of function ‘trie_has_key’ [-Wimplicit-function-declaration]
     if(trie_has_key(trie, (TrieChar*)RSTRING_PTR(key)))
     ^
trie.c: In function ‘walk_all_paths’:
trie.c:180:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
trie.c: In function ‘walk_all_paths_with_values’:
trie.c:258:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
In file included from trie.c:2:0:
trie.c: At top level:
trie.h:25:13: warning: ‘trie_branch_in_branch’ declared ‘static’ but never defined [-Wunused-function]
 static Bool trie_branch_in_branch (Trie *trie, TrieIndex sep_node, const TrieChar *suffix, TrieData data);
             ^
trie.h:26:13: warning: ‘trie_branch_in_tail’ declared ‘static’ but never defined [-Wunused-function]
 static Bool trie_branch_in_tail(Trie *trie, TrieIndex sep_node, const TrieChar *suffix, TrieData data);
             ^
trie.h:31:20: warning: ‘trie_state_new’ declared ‘static’ but never defined [-Wunused-function]
 static TrieState * trie_state_new (const Trie *trie, TrieIndex index, short suffix_idx, short is_suffix);
                    ^
cc1: some warnings being treated as errors
make: *** [trie.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/fast_trie-0.5.0 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/extensions/x86_64-linux/1.9.1/fast_trie-0.5.0/gem_make.out
hickford commented 9 years ago

Thanks. Looks like some Linux distros have turned on an extra compiler warning.

format not a string literal and no format arguments [-Werror=format-security]

hickford commented 9 years ago

Fixed by https://github.com/tyler/trie/pull/15 . @tyler would you be able to publish to Rubygems?

cosmtrek commented 9 years ago

Oops... I've got this problem too.

I add the following line in Gemfile:

gem 'fast_trie', :git => 'https://github.com/tyler/trie.git', :ref => '616ccf2412a9efd983962069faa931e998d13e67'

Thanks @hickford !