尝试在 Synology DiskStation DS216j 上安装 Ruby 个 gem,找不到 Ruby 个头文件
Trying to install Ruby gems on Synology DiskStation DS216j, cannot find Ruby header files
我正尝试在我的 Synology DiskStation DS216j 上 运行 一些 Ruby 脚本。我成功地通过 OPKG/Entware-ng 安装了 Ruby 2.3.1,但是当我尝试安装带有本机扩展的 gems 时,出现错误:
$ 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 源 code/headers which I did:
$ 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/
?
感谢任何帮助或提示,谢谢!
/opt/bin/ld: cannot find -lruby
表示链接器找不到 Ruby 库 ,而不是 headers。您需要 /opt/lib/libruby.so
或静态库 /opt/lib/libruby-static.a
.
处的已编译共享 object 库
我正尝试在我的 Synology DiskStation DS216j 上 运行 一些 Ruby 脚本。我成功地通过 OPKG/Entware-ng 安装了 Ruby 2.3.1,但是当我尝试安装带有本机扩展的 gems 时,出现错误:
$ 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 源 code/headers which I did:
$ 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/
?
感谢任何帮助或提示,谢谢!
/opt/bin/ld: cannot find -lruby
表示链接器找不到 Ruby 库 ,而不是 headers。您需要 /opt/lib/libruby.so
或静态库 /opt/lib/libruby-static.a
.