つれづれなるまゝに

単なる作業メモ。主に、Linux, arduino, raspberry piとか?

QNAPでruby on rails その2

2013-11-23 20:14:12 | linux
いろいろ調べてみるが、まだ解決策が見つからない。

単純に/home/slug/optware/cs08q1armel/toolchain/arm-2008q1/bin/arm-none-linux-gnueabi-gccのシンボリックリンクを作成すれば動く気もするが、急ぐものでもないので少し勉強してみようと思う。

問題個所はjsonの拡張ライブラリを作成している個所。
extconf.rbはmkmfを使ってMakefileを使っている。
その際に、RbConfig::ConfigにあるCCの情報を使っているというのは理解したが、このCCの情報をどこからとってきてるのかがまだわからない。。。

以下余談。うちのQNAPはTS110だが

# cat /proc/cpuinfo
Processor name : Feroceon 88F6281 rev 1 (v5l) @
BogoMIPS : 799.53
Features : swp half thumb fastmult edsp
CPU implementer : 0x56
CPU architecture: 5TE
CPU variant : 0x2
CPU part : 0x131
CPU revision : 1

Hardware : Feroceon-KW ARM
Revision : 0000
Serial : 0000000000000000

ということで、CPU自体は先日ポイした玄箱のCPUと同じでクロック違いのようだ。

そろそろ新しいのに替えたい。TS-421くらいが欲しいなぁ。

QNAPでruby on rails

2013-11-17 22:08:26 | linux
自作機のRailsを4.0にしたいので、QNAP側にredmineを移せないかを検討。

AppCenterをみるとRailsがあったので、インストール
-> /opt/binの配下に,ruby,gem,rakeはインストールされる

# ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [arm-linux-eabi]

# gem -v
1.3.1

さて、railsはどこに???

# gem install rails
/opt/lib/ruby/1.9.1/rubygems/digest/md5.rb:8:in `require': libcrypto.so.0.9.8: cannot open shared object file: No such file or directory - /opt/lib/ruby/1.9.1/arm-linux-eabi/digest/md5.so (LoadError)
from /opt/lib/ruby/1.9.1/rubygems/digest/md5.rb:8:in `<top (required)>'
from /opt/lib/ruby/1.9.1/rubygems/package.rb:12:in `require'
from /opt/lib/ruby/1.9.1/rubygems/package.rb:12:in `<top (required)>'
from /opt/lib/ruby/1.9.1/rubygems/format.rb:9:in `require'
from /opt/lib/ruby/1.9.1/rubygems/format.rb:9:in `<top (required)>'
from /opt/lib/ruby/1.9.1/rubygems/installer.rb:11:in `require'
from /opt/lib/ruby/1.9.1/rubygems/installer.rb:11:in `<top (required)>'
from /opt/lib/ruby/1.9.1/rubygems/dependency_installer.rb:3:in `require'
from /opt/lib/ruby/1.9.1/rubygems/dependency_installer.rb:3:in `<top (required)>'
from /opt/lib/ruby/1.9.1/rubygems/commands/install_command.rb:4:in `require'
from /opt/lib/ruby/1.9.1/rubygems/commands/install_command.rb:4:in `<top (required)>'
from /opt/lib/ruby/1.9.1/rubygems/command_manager.rb:140:in `require'
from /opt/lib/ruby/1.9.1/rubygems/command_manager.rb:140:in `rescue in load_and_instantiate'
from /opt/lib/ruby/1.9.1/rubygems/command_manager.rb:132:in `load_and_instantiate'
from /opt/lib/ruby/1.9.1/rubygems/command_manager.rb:65:in `[]'
from /opt/lib/ruby/1.9.1/rubygems/command_manager.rb:118:in `find_command'
from /opt/lib/ruby/1.9.1/rubygems/command_manager.rb:104:in `process_args'
from /opt/lib/ruby/1.9.1/rubygems/command_manager.rb:75:in `run'
from /opt/lib/ruby/1.9.1/rubygems/gem_runner.rb:39:in `run'
from /opt/bin/gem:24:in `<main>'

とおこられるので、インストールに失敗している模様。
ここに解決策が書いてある。
が、

gem install openssl

だと、同じエラーが。これipkg install opensslじゃね?と思って実行。

# ipkg install openssl
Installing openssl (0.9.8v-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/openssl_0.9.8v-2_arm.ipk
Configuring openssl
Successfully terminated.

やっぱりw

でもって、

# gem install rails --version "3.2.4"

・・・
なかなか応答がかえってこない(1時間くらい???)。で、結果が、、、

ERROR: Error installing rails:
bundler requires RubyGems version >= 1.3.6
Updating class cache with 0 classes...

ぐはっ。ではと、

# gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-2.1.11
:0:Warning: Gem::SourceIndex#search support for String patterns is deprecated
Updating RubyGems to 2.1.11
Installing RubyGems 2.1.11
RubyGems 2.1.11 installed
Installing ri documentation for rubygems-2.1.11
/opt/lib/ruby/1.9.1/rdoc/rdoc.rb:275: warning: conflicting chdir during another chdir block
/opt/lib/ruby/1.9.1/rdoc/rdoc.rb:282: warning: conflicting chdir during another chdir block

=== 2.1.10 / 2013-10-24
・・・

If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.

# gem -v
2.1.11

とアップデート成功。ドキュメントのインストールなしでもよかったなと後で思う。

さて、再度railsを。

・・・
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

/opt/bin/ruby extconf.rb
creating Makefile

make
sh: make: command not found

なるほど。
ここを参考に必要そうなものをipkgでインストール。


# ipkg install make
Installing make (3.82-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/make_3.82-1_arm.ipk
Configuring make
Successfully terminated.

# ipkg install gcc
Installing gcc (4.2.3-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/gcc_4.2.3-1_arm.ipk
Installing binutils (2.19.1-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/binutils_2.19.1-1_arm.ipk
Installing libc-dev (2.5-5) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/libc-dev_2.5-5_arm.ipk
Installing libnsl (2.5-4) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/libnsl_2.5-4_arm.ipk
Configuring binutils
update-alternatives: Linking //opt/bin/strings to /opt/bin/binutils-strings
Configuring gcc
Configuring libc-dev
Configuring libnsl
Successfully terminated.

以下の2つは必要かは不明

# ipkg install gawk
Installing gawk (4.0.1-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/gawk_4.0.1-1_arm.ipk
Configuring gawk
update-alternatives: Linking //opt/bin/awk to /opt/bin/gawk
Successfully terminated.
# ipkg install sed
Installing sed (4.2.2-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/sed_4.2.2-1_arm.ipk
Configuring sed
update-alternatives: Linking //opt/bin/sed to /opt/bin/gnu-sed
Successfully terminated.


で、再度railsを。

ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

/opt/bin/ruby extconf.rb
creating Makefile

make
/home/slug/optware/cs08q1armel/toolchain/arm-2008q1/bin/arm-none-linux-gnueabi-gcc -I. -I/opt/include/ruby-1.9.1/arm-linux-eabi -I/opt/include/ruby-1.9.1/ruby/backward -I/opt/include/ruby-1.9.1 -I. -DJSON_GENERATOR -O2 -pipe -I/home/slug/optware/cs08q1armel/staging/opt/include -D_FILE_OFFSET_BITS=64 -fPIC -O2 -g -Wall -Wno-parentheses -fPIC -O3 -Wall -O0 -ggdb -o generator.o -c generator.c
make: /home/slug/optware/cs08q1armel/toolchain/arm-2008q1/bin/arm-none-linux-gnueabi-gcc: Command not found
make: *** [generator.o] Error 127


Gem files will remain installed in /opt/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to /opt/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

んー、makefileのパスがおかしい。。。

今夜はここまで。

LS-CH500Lの処遇

2013-11-17 21:12:09 | 日記
最近、NASはQNAP一本化したため、以前つかっていたLS-CH500Lが遊休状態。

なので、分解してHDDはnasneの録画用にしようかと思う。

NASとしてはくそ遅いのだが、何か使い道はないかちょいと調べてみた。

まず、分解。方法は、こちらにあった。

HDDはHITACHIのDeskstarのSATAなので、これは流用決定。

CPUは、Marvelの88F6-B1A2。kirkwoodとよばれるarmv5teベースのシリーズのようです。arm系のdebianが動作しそうですが、このスペックならラズパイでよいので出番はないですね。

ということで基盤はリサイクルボックスにポイします。

ホテルからスマートサーブできるか

2013-11-17 20:14:33 | スマートサーブ
出張で都内のホテルに宿泊。

ホテルのLANにwifiコンバータつなげてVPNを試してみる。

結果は、NG。たぶん、ホテルのLANだとVPN関連のポートが開いてないんでしょうねぇ。。。

auのwifiだと繋がった。こちらは考慮されてるみたい。
ただ、ちょっと遅いんですよね、キャリアさんのwifi。

先日、wifi版のiPad Airを衝動買い(汗)したのだがLTE版にすればwifi使えたのでよかったかなぁ。
まぁ、それだけに本体が1万以上高くなるなら、通信料無制限のwimaxを契約する方がいろいろ便利かと思って、引きとどまったのですが。


rails アプリ編 はじめてのアプリ

2013-11-07 23:09:13 | linux
こちらを参考に、まずはViewとControlerだけの簡単なアプリをつくってみる。

バージョンの関係か、記載の通りでは動かない。以下に、異なる点を列記。

1) コマンド名
 ruby script/xxx となってるが、rails xxx と読み替える。

2) ビューの作成
作成するビューの拡張子がrhtmlとなっているが、htmlでよい。

3) ルーティング設定
 参考元ではなにも記載ないが、以下の対応が必要。

 config/routes.rbを編集
 → match ':controller(/:action(/:id))(.:format)'のコメント外す

以上の差分で動作した