Synology DiskStation DS216j でいくつかの Ruby スクリプトを実行しようとしています。OPKG/Entware-ng経由で Ruby 2.3.1 を正常にインストールできましたが、ネイティブ拡張機能を使用して gem をインストールしようとすると、エラーが発生します。
$ sudo gem install io-console
Building native extensions. This could take a while...
ERROR: Error installing io-console:
ERROR: Failed to build gem native extension.
current directory: /volume1/@entware-ng/opt/lib/ruby/gems/2.3/gems/io-console-0.4.6
/opt/bin/ruby -r ./siteconf20161113-31591-ucvjgl.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/bin/$(RUBY_BASE_NAME)
/opt/lib/ruby/2.3/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/lib/ruby/2.3/mkmf.rb:571:in `block in try_compile'
from /opt/lib/ruby/2.3/mkmf.rb:524:in `with_werror'
from /opt/lib/ruby/2.3/mkmf.rb:571:in `try_compile'
from /opt/lib/ruby/2.3/mkmf.rb:835:in `macro_defined?'
from extconf.rb:7:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/opt/lib/ruby/gems/2.3/extensions/arm-linux/2.3/io-console-0.4.6/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /opt/lib/ruby/gems/2.3/gems/io-console-0.4.6 for inspection.
Results logged to /opt/lib/ruby/gems/2.3/extensions/arm-linux/2.3/io-console-0.4.6/gem_make.out
の内容/opt/lib/ruby/gems/2.3/extensions/arm-linux/2.3/io-console-0.4.6/mkmf.log
:
"arm-openwrt-linux-gnueabi-gcc -o conftest -I/opt/include/ruby-2.3/arm-linux-gnu -I/opt/include/ruby-2.3/ruby/backward -I/opt/include/ruby-2.3 -I. -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/include -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/include -I/media/ware3/Entware-ng.2016.08/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_glibc-2.23_eabi/usr/include -I/media/ware3/Entware-ng.2016.08/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_glibc-2.23_eabi/include -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libiconv-full/include -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libintl-full/include -D_FILE_OFFSET_BITS=64 -O2 -pipe -march=armv7-a -mtune=cortex-a9 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=soft -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libiconv-full/include -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libintl-full/include -fPIC conftest.c -L. -L/opt/lib -L. -L/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib -L/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/lib -Wl,-rpath,/opt/lib -Wl,-rpath-link=/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib -Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -L/media/ware3/Entware-ng.2016.08/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_glibc-2.23_eabi/usr/lib -L/media/ware3/Entware-ng.2016.08/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_glibc-2.23_eabi/lib -L/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libiconv-full/lib -Wl,-rpath-link=/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libiconv-full/lib -L/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libintl-full/lib -Wl,-rpath-link=/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libintl-full/lib -L/media/ware3/Entware-ng.2016.08/build_dir/target-arm_cortex-a9_glibc-2.23_eabi/ruby-2.3.1 -fstack-protector -rdynamic -Wl,-export-dynamic -lruby -lpthread -lgmp -ldl -lcrypt -lm -lc"
/opt/bin/ld: cannot find -lruby
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
/opt/bin/ld: cannot find -lruby
ここで本当のエラーのようです。
これをグーグルで検索すると、私が行ったRubyソースコード/ヘッダーをインストールするための推奨事項が表示されます:
$ wget -qO- http://pkg.entware.net/binaries/armv7/include/include.tar.gz | tar xvz -C /opt/include
[snip]
$ ls -lah /opt/include/ruby-2.3/
drwxr-xr-x 4 1000 1000 4.0K Aug 19 12:42 .
drwxr-xr-x 179 root root 20.0K Oct 10 09:32 ..
drwxr-xr-x 3 1000 1000 4.0K Aug 19 12:42 arm-linux-gnu
drwxr-xr-x 3 1000 1000 4.0K Aug 19 12:42 ruby
-rw-r--r-- 1 1000 1000 868 Jul 11 2012 ruby.h
本当の問題は/opt/bin/ld
、Ruby ヘッダー ファイルが にあることをどのように確認できるかということだと思います/opt/include/ruby-2.3/
。
ヘルプやヒントをいただければ幸いです。