@ledsun blog

無味の味は佳境に入らざればすなわち知れず

Rubyからsimstringを使うにはSWIGが必要です。

GitHub - chokkan/simstring: SimString という文字列を検索するライブラリーがあります。 Rubyから使うことができます。 というわけでインストールしてみたのですが次のエラーが起きました。

ledsun@MSI:~/pubdictionaries►ruby -e 'require "simstring"'
<internal:/home/ledsun/.rbenv/versions/3.0.1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': /home/ledsun/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/x86_64-linux/simstring.so: undefined symbol: Init_simstring - /home/ledsun/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/x86_64-linux/simstring.so (LoadError)

undefined symbol: Init_simstringとでているので、Gemのビルドに失敗しているようです。

インストール手順

インストールの仕方がおかしいと思います。 手順を振り返ってみましょう。

類似文字列検索ライブラリSimStringをRubyから使う | EasyRamble を参考にしてインストールしました。 環境はWSL2上のUbuntuです。

最新版を使う為に、GitHubからcloneします。

git clone git@github.com:chokkan/simstring.git

./configureがないので、autoreconfします。

> autoreconf -i
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:31: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.in:31: https://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.in:22: installing './compile'
configure.in:21: installing './config.guess'
configure.in:21: installing './config.sub'
configure.in:31: installing './install-sh'
configure.in:31: installing './missing'
configure.in:110: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Makefile.am: installing './INSTALL'
frontend/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
frontend/Makefile.am: installing './depcomp'
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:110: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
sample/Makefile.am:10: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
configure.in:110: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

warningはよくわからないので、無視します。 実は-iオプションの意味もわかっていません。 ./configureします。

> ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for library containing strerror... none required
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of gcc... gcc3
checking whether to enable maintainer-specific portions of Makefiles... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking whether ln -s works... yes
checking for ANSI C header files... (cached) yes
checking for stdint.h... (cached) yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking for an ANSI C-conforming const... yes
checking size of ... 0
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for uint32_t... yes
checking for sqrt in -lm... yes
checking for mmap in -lmmap... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating frontend/Makefile
config.status: creating sample/Makefile
config.status: creating swig/Makefile
config.status: creating swig/python/setup.py
config.status: creating swig/ruby/extconf.rb
config.status: creating swig/perl/Makefile.PL
config.status: creating config.h
config.status: executing depfiles commands

makeします。

> make
make  all-recursive
make[1]: Entering directory '/home/ledsun/pubdictionaries/work/simstring'
Making all in include
make[2]: Entering directory '/home/ledsun/pubdictionaries/work/simstring/include'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ledsun/pubdictionaries/work/simstring/include'
Making all in frontend
make[2]: Entering directory '/home/ledsun/pubdictionaries/work/simstring/frontend'
g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../include   -O3  -O3  -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cpp
mv -f .deps/main.Tpo .deps/main.Po
g++ -O3  -O3    -o simstring main.o  -lm
make[2]: Leaving directory '/home/ledsun/pubdictionaries/work/simstring/frontend'
Making all in sample
make[2]: Entering directory '/home/ledsun/pubdictionaries/work/simstring/sample'
g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../include   -O3  -O3  -MT sample.o -MD -MP -MF .deps/sample.Tpo -c -o sample.o sample.cpp
mv -f .deps/sample.Tpo .deps/sample.Po
g++ -O3  -O3    -o sample sample.o  -lm
g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../include   -O3  -O3  -MT sample_unicode.o -MD -MP -MF .deps/sample_unicode.Tpo -c -o sample_unicode.o sample_unicode.cpp
mv -f .deps/sample_unicode.Tpo .deps/sample_unicode.Po
g++ -O3  -O3    -o sample_unicode sample_unicode.o  -lm
make[2]: Leaving directory '/home/ledsun/pubdictionaries/work/simstring/sample'
Making all in swig
make[2]: Entering directory '/home/ledsun/pubdictionaries/work/simstring/swig'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ledsun/pubdictionaries/work/simstring/swig'
make[2]: Entering directory '/home/ledsun/pubdictionaries/work/simstring'
make[2]: Nothing to be done for 'all-am'.
make[2]: Leaving directory '/home/ledsun/pubdictionaries/work/simstring'
make[1]: Leaving directory '/home/ledsun/pubdictionaries/work/simstring'
> frontend/simstring --version
SimString 1.1 Copyright (c) 2009-2011 Naoaki Okazaki

ビルドできているようです。

> swig

Command 'swig' not found, but can be installed with:

sudo apt install swig

SWIGが入っていないみたいです。 sudo apt install swigします。

> swig -version

SWIG Version 4.0.1

Compiled with g++ [x86_64-pc-linux-gnu]

Configured options: +pcre

Please see http://www.swig.org for reporting bugs and further information

入りました。 Gemをビルドします。

> cd swig/ruby/
> ./prepare.sh --swig
export.h:19: Warning 801: Wrong constant name (corrected to `Exact')
export.h:21: Warning 801: Wrong constant name (corrected to `Dice')
export.h:23: Warning 801: Wrong constant name (corrected to `Cosine')
export.h:25: Warning 801: Wrong constant name (corrected to `Jaccard')
export.h:27: Warning 801: Wrong constant name (corrected to `Overlap')
export.h:34: Warning 801: Wrong class name (corrected to `Writer')
export.h:34: Warning 801: Wrong class name (corrected to `Writer')
export.h:88: Warning 801: Wrong class name (corrected to `Reader')
export.h:88: Warning 801: Wrong class name (corrected to `Reader')
> ruby extconf.rb
creating Makefile

makeします。

> make
compiling export.cpp
export.cpp: In destructor ‘virtual writer::~writer()’:
export.cpp:112:41: warning: throw will always call terminate() [-Wterminate]
  112 |         throw std::runtime_error(message);
      |                                         ^
export.cpp:112:41: note: in C++11 destructors default to noexcept
export.cpp:126:41: warning: throw will always call terminate() [-Wterminate]
  126 |         throw std::runtime_error(message);
      |                                         ^
export.cpp:126:41: note: in C++11 destructors default to noexcept
compiling export_wrap.cpp
export_wrap.cpp: In function ‘void SWIG_RubyInitializeTrackings()’:
export_wrap.cpp:1277:82: warning: ‘void ruby::backward::cxxanyargs::rb_define_virtual_variable(const char*, VALUE (*)(...), void (*)(...))’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 1277 |                              SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL));
      |                                                                                  ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:73:1: note: declared here
   73 | rb_define_virtual_variable(const char *q, type *w, void_type *e)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
export_wrap.cpp:1277:82: warning: ‘void ruby::backward::cxxanyargs::rb_define_virtual_variable(const char*, VALUE (*)(...), void (*)(...))’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 1277 |                              SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL));
      |                                                                                  ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:73:1: note: declared here
   73 | rb_define_virtual_variable(const char *q, type *w, void_type *e)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
export_wrap.cpp: In function ‘void SWIG_RubyIterateTrackings(void (*)(void*, VALUE))’:
export_wrap.cpp:1334:29: warning: ‘int ruby::backward::cxxanyargs::rb_st_foreach(st_table*, int (*)(...), st_data_t)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 1334 |              (st_data_t)meth);
      |                             ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/intern/hash.h:25,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:16,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/st.h:142:20: note: declared here
  142 | #define st_foreach rb_st_foreach
      |                    ^~~~~~~~~~~~~
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:430:1: note: in expansion of macro ‘st_foreach’
  430 | st_foreach(st_table *q, int_type *w, st_data_t e)
      | ^~~~~~~~~~
export_wrap.cpp:1334:29: warning: ‘int ruby::backward::cxxanyargs::rb_st_foreach(st_table*, int (*)(...), st_data_t)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 1334 |              (st_data_t)meth);
      |                             ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/intern/hash.h:25,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:16,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/st.h:142:20: note: declared here
  142 | #define st_foreach rb_st_foreach
      |                    ^~~~~~~~~~~~~
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:430:1: note: in expansion of macro ‘st_foreach’
  430 | st_foreach(st_table *q, int_type *w, st_data_t e)
      | ^~~~~~~~~~
export_wrap.cpp: In member function ‘bool swig::GC_VALUE::relational_equal_op(const swig::GC_VALUE&, const ID&, bool (*)(const VALUE&, const VALUE&)) const’:
export_wrap.cpp:2071:62: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2071 |                        (VALUEFUNC(swig_rescue_swallow)), Qnil);
      |                                                              ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp:2071:62: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2071 |                        (VALUEFUNC(swig_rescue_swallow)), Qnil);
      |                                                              ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp: In member function ‘swig::GC_VALUE swig::GC_VALUE::unary_op(const ID&) const’:
export_wrap.cpp:2111:60: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2111 |                      (VALUEFUNC(swig_rescue_swallow)), Qnil);
      |                                                            ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp:2111:60: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2111 |                      (VALUEFUNC(swig_rescue_swallow)), Qnil);
      |                                                            ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp: In member function ‘swig::GC_VALUE swig::GC_VALUE::binary_op(const swig::GC_VALUE&, const ID&) const’:
export_wrap.cpp:2130:60: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2130 |                      (VALUEFUNC(swig_rescue_swallow)), Qnil);
      |                                                            ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp:2130:60: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2130 |                      (VALUEFUNC(swig_rescue_swallow)), Qnil);
      |                                                            ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp: In function ‘int SWIG_AsVal_unsigned_SS_long(VALUE, long unsigned int*)’:
export_wrap.cpp:2471:90: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2471 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                          ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp:2471:90: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2471 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                          ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp: In function ‘int SWIG_AsVal_unsigned_SS_long_SS_long(VALUE, long long unsigned int*)’:
export_wrap.cpp:2517:88: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2517 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                        ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp:2517:88: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2517 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                        ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp: In function ‘int SWIG_AsVal_long(VALUE, long int*)’:
export_wrap.cpp:2576:89: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2576 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                         ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp:2576:89: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2576 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                         ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp: In function ‘int SWIG_AsVal_long_SS_long(VALUE, long long int*)’:
export_wrap.cpp:2607:87: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2607 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                       ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp:2607:87: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 2607 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                       ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp: In function ‘int SWIG_AsVal_double(VALUE, double*)’:
export_wrap.cpp:4679:88: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 4679 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2DBL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                        ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
export_wrap.cpp:4679:88: warning: ‘VALUE ruby::backward::cxxanyargs::rb_rescue(VALUE (*)(...), VALUE, VALUE (*)(...), VALUE)’ is deprecated: Use of ANYARGS in this function is deprecated [-Wdeprecated-declarations]
 4679 |     if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2DBL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
      |                                                                                        ^
In file included from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/ruby.h:24,
                 from /home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby.h:38,
                 from export_wrap.cpp:880:
/home/ledsun/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:258:1: note: declared here
  258 | rb_rescue(type *q, VALUE w, type *e, VALUE r)
      | ^~~~~~~~~
linking shared-object simstring.so

warningはよくわからないので、無視します。 インストールします。

> make install
/usr/bin/install -c -m 0755 simstring.so /home/ledsun/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/x86_64-linux
ruby -e 'require "simstring"'

あ!うごきました!SWIGをインストールしてないのがいけなかったみたいです。

参考