kuroの覚え書き

96の個人的覚え書き

ラズパイでタイムラプスカメラ

研究絡みで植物のタイムラプスムービーをつくりたいという話があったので、それならWEBカメラとラズパイでちょちょいでしょ、ということになってやってみた。

まずは参考にしたサイトから
RaspberryPiとUSBWebカメラでタイムラプス | Foolean – 備忘録風雑記ブログ
ラズパイでタイムラプス撮影 - Qiita
このへん。

カメラは手持ちにあったUSBカメラを使用。
https://www.amazon.co.jp/gp/product/B008AO4KXG/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1
3年ほど前に買ったカメラ。

Raspberry Piは3+を使用。
OSはraspbian

使用ソフトは

$ sudo apt-get install fswebcam libav-tools -y

でインストール。

USBカメラを差したら

$ fswebcam -F 10 ./tmp.jpg

これで画像が撮れることを確認。
ちなみにfswebcamのオプションは

-r 1920x1080 解像度
-d 5 ディレイ(カメラに露出やフォーカスの調節を自動でさせるための時間を与える)
-F 10
--jpeg 85 (JPEGで85%画質で撮るとき)
--line-colour '#FF000000' --banner-colour '#FF000000'  タイムスタンプなどの文字色など

ほかにもあると思う。

今回は

#!/bin/bash
FILENAME=`date +%Y%m%d%H%M%S`
fswebcam -r 1280x720 --line-colour '#FF000000' --banner-colour '#FF000000' -F 1$

こんな感じのスクリプトを書いてcamera.shとした。

これをcronで定時実行もしくは間隔を決めて実行すれば画像がどんどん溜まっていく。

$ crontab -e
00 * * * * * /home/pi/camera.sh

こうすれば毎時0分に定時撮影となる。

*/10 * * * * /home/pi/camera.sh

こうしておけば10分間隔で撮れる。

ある程度画像が溜まったらパラパラ漫画の要領でムービーに仕立てる。
今回は

#!/bin/sh

find ./img/ -name '*.jpg' | sort -n | awk 'BEGIN{ a=0 }{ printf "mv \"%s\" ./img/%05d.jpg\n", $0,a++}' | bash
avconv -y -f image2 -r 10 -i ./img/%05d.jpg -aspect 16:9 -s '1280x720' ./img/output.mp4

こういうスクリプトを作ってみた。
名前が連番でないといかんらしいので、名前を変更し、それをoutput.mp4という名前のムービーにする。

特に困ったこともなくあっけなく完成。


しいていうなら、このままではフレーミングを決めるために何度もスクリプトを実行して撮ってみて、画像確認してまた撮って・・・と繰り返さなければならない点かな。

これはmotionもインストールしておいてストリーミングで画像を見れるようにしておくのが良いかもしれない。
k-kuro.hatenadiary.jp


RaspberryPiでWebカメラを使ってストリーミング動画を配信させてみた - 水菜巻のメモ的ななにか。
こっちのほうがお手軽かな。

最後にこのタイムラプスカメラシステムをいくつもクローンで作りたいので
SDカードの複製(for Mac) | Make.
SDカードのまるごとコピー

Pythonの環境を一旦リセットする

どうもややこしくていけないのだが、systemに入っているpython は2.6とかなりふるい目。なので自前でpython3を入れて使いたいわけだが
バージョンの使い分けにpyenvというものがある。更にはvirtualenvというものもある。
しかしよく考えると、バージョンを細かく使い分けるようなことはしていないので、単純にbrewで最新のpython3を入れてしまって、それだけ使うようにしても何ら困ることはないということに今更ながら気づく。

どうやらpyenvで入れたpython3.6.1とbrewで入れた3.7.1がうまく折り合いをつけてくれずにトラブっていたらしく、一旦全部クリアしてbrewだけにしたらすんなりとinternal server errorは解決した。

うん、pyenvやめよ。

あとはflaskのmanage.pyをきちんとcgi経由で動くようにしないとな。

value serverでレンタルサーバー

某大学内でサーバを建ててあれこれやっているが、外部からアクセスできるようには、なかなかさせてもらえないので、学外にサーバを建てることにした。
といっても、物理サーバを管理することもできないので、レンタルサーバお茶を濁す
とにかく料金が安く、sshでそこそこ自由度の高いvalue serverに白羽の矢を立て、早速お試し開始。

とにかくpython3が走らないとお話にならないのだが、一応いんすとーるされてはいるようだ。
でもpip3が使えなくてライブラリが入れられないので、pyenv-virtualenvを入れよう・・・なんかドツボにハマっていきそうな予感。

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
Initialized empty Git repository in /virtual/hoge/.pyenv/.git/
remote: Enumerating objects: 63, done.
remote: Counting objects: 100% (63/63), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 16547 (delta 25), reused 46 (delta 20), pack-reused 16484
Receiving objects: 100% (16547/16547), 3.21 MiB | 2.81 MiB/s, done.
Resolving deltas: 100% (11217/11217), done.
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ source .bashrc
$ pyenv --version
pyenv 1.2.8-5-gec9fb54
$ pyenv install 3.6.1
Downloading Python-3.6.1.tar.xz...
-> https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
Installing Python-3.6.1...
Installed Python-3.6.1 to /virtual/hoge/.pyenv/versions/3.6.1

$ pyenv global 3.6.1
$ pyenv rehash
$ python
Python 3.6.1 (default, Nov 26 2018, 19:58:29) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

ここまではまあなんとか。
virtualenvを入れよう。そのために今後のことも考えてhomebrewを入れちゃおう。

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
==> Select the Linuxbrew installation directory
- Enter your password to install to /home/linuxbrew/.linuxbrew (recommended)
- Press Control-D to install to /virtual/hoge/.linuxbrew
- Press Control-C to cancel installation
Sorry, user hoge may not run sudo on s2.
==> This script will install:
......

......
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh
Warning: /virtual/hoge/.linuxbrew/bin is not in your PATH.

なんとも不穏な終わり方。

とりあえず

$ test -d ~/.linuxbrew && PATH="$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin:$PATH"
$ test -d /home/linuxbrew/.linuxbrew && PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH"
$ test -r ~/.bash_profile && echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.bash_profile
$ echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.profile
$ brew install hello
==> Installing dependencies for curl: patchelf, zlib, binutils, linux-headers, glibc, m4, gmp, mpfr, libmpc, isl@0.18, gcc, openssl and pkg-config
==> Installing curl dependency: patchelf
==> Downloading https://linuxbrew.bintray.com/bottles/patchelf-0.9_1.x86_64_linu
Updating Homebrew...
######################################################################## 100.0%
==> Pouring patchelf-0.9_1.x86_64_linux.bottle.tar.gz
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall patchelf`
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/patchelf/0.9_1: 6 files, 1.2MB
==> Installing curl dependency: zlib
==> Downloading https://linuxbrew.bintray.com/bottles/zlib-1.2.11.x86_64_linux.b
######################################################################## 100.0%
==> Pouring zlib-1.2.11.x86_64_linux.bottle.tar.gz
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall zlib`
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/zlib/1.2.11: 12 files, 423.5KB
==> Installing curl dependency: binutils
==> Downloading https://linuxbrew.bintray.com/bottles/binutils-2.31.1_2.x86_64_l
######################################################################## 100.0%
==> Pouring binutils-2.31.1_2.x86_64_linux.bottle.tar.gz
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall binutils`
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/binutils/2.31.1_2: 4,638 files, 294MB
==> Installing curl dependency: linux-headers
==> Downloading https://linuxbrew.bintray.com/bottles/linux-headers-4.4.80.x86_6
######################################################################## 100.0%
==> Pouring linux-headers-4.4.80.x86_64_linux.bottle.tar.gz
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall linux-headers`
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/linux-headers/4.4.80: 772 files, 3.7MB
==> Installing curl dependency: glibc
==> Downloading https://ftp.gnu.org/gnu/glibc/glibc-2.23.tar.gz
######################################################################## 100.0%
==> ../configure --disable-debug --disable-dependency-tracking --disable-silent-
Last 15 lines from /virtual/hoge/.cache/Homebrew/Logs/glibc/01.configure:
checking version of gmake... 3.81, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.17, ok
checking for makeinfo... no
checking for sed... sed
checking version of sed... 4.2.1, ok
checking for gawk... gawk
checking version of gawk... 3.1.7, ok
checking if gcc -B/virtual/hoge/.linuxbrew/opt/binutils/bin/ is sufficient to build libc... no
checking for nm... nm
configure: error: 
*** These critical programs are missing or too old: compiler
*** Check the INSTALL file for required versions.
Error: parent directory is world writable but not sticky
Please report this bug:
  https://github.com/Linuxbrew/brew/wiki/troubleshooting
/usr/local/rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/tmpdir.rb:93:in `ensure in mktmpdir'
/usr/local/rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/tmpdir.rb:95:in `mktmpdir'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/utils/fork.rb:28:in `safe_fork'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:744:in `build'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:318:in `install'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:595:in `install_dependency'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:549:in `block in install_dependencies'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:549:in `each'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:549:in `install_dependencies'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:256:in `install'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:329:in `install_formula'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:259:in `block in install'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:257:in `each'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:257:in `install'
/virtual/hoge/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:89:in `<main>'
以下繰り返し・・・

きたきた。
Error: parent directory is world writable but not sticky
ってなんなんよ。

どうやらインストールに使うtmpディレクトリに -t属性をつけとけってことらしいのだが、
$ sudo chmod +t /private/tmp
というような処置をしろという記述はあちらこちらで見かけるがsudoできんし。

$ brew doctor
というコマンドで調べると

Warning: /export/tmp is world-writable but does not have the sticky bit set.
Please execute `sudo chmod +t /export/tmp` in your Terminal.
If you don't have administrative privileges on this machine,
create a directory and set the HOMEBREW_TEMP environment variable,
for example:
  install -d -m 1755 ~/tmp
  echo 'export HOMEBREW_TEMP=~/tmp' >> ~/.bash_profile

と出ている。これやっとけばいいのか。

$  install -d -m 1755 ~/tmp
$  echo 'export HOMEBREW_TEMP=~/tmp' >> ~/.bash_profile
$ source .bash_profile

こうすると、今度は

$ brew install hello
==> Installing dependencies for curl: glibc, m4, gmp, mpfr, libmpc, isl@0.18, gcc, openssl and pkg-config
==> Installing curl dependency: glibc
==> Downloading https://ftp.gnu.org/gnu/glibc/glibc-2.23.tar.gz
Already downloaded: /virtual/hoge/.cache/Homebrew/downloads/3c17421daad583cfd4fad587b8e1260f19385344f309d7ae11e0c2bb6b75d801--glibc-2.23.tar.gz
Updating Homebrew...
==> ../configure --disable-debug --disable-dependency-tracking --disable-silent-rules --prefix=/virtual/hoge/.linuxbrew/Cellar/
Last 15 lines from /virtual/hoge/.cache/Homebrew/Logs/glibc/01.configure:
checking version of gmake... 3.81, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.17, ok
checking for makeinfo... no
checking for sed... sed
checking version of sed... 4.2.1, ok
checking for gawk... gawk
checking version of gawk... 3.1.7, ok
checking if gcc -B/virtual/hoge/.linuxbrew/opt/binutils/bin/ is sufficient to build libc... no
checking for nm... nm
configure: error: 
*** These critical programs are missing or too old: compiler
*** Check the INSTALL file for required versions.

gccが古いぞゴルァ。
開発環境 - Heavy Watal
まずglibc抜きでgccを入れてそのgccglibcコンパイルなんだと。

$ HOMEBREW_BUILD_FROM_SOURCE=1 brew install gcc --without-glibc
==> Installing dependencies for curl: openssl and pkg-config
==> Installing curl dependency: openssl
==> Downloading https://www.openssl.org/source/openssl-1.0.2p.tar.gz
Already downloaded: /virtual/hoge/.cache/Homebrew/downloads/6d2f0aa30538560efe2aae756229a9ced40e636a70083696fb1bceb6c1a7564c--openssl-1.0.2p.tar.gz
==> perl ./Configure --prefix=/virtual/hoge/.linuxbrew/Cellar/openssl/1.0.2p --openssldir=/virtual/hoge/.linuxbrew/etc/ope
Updating Homebrew...
==> make depend
==> make
==> make test
==> make install MANDIR=/virtual/hoge/.linuxbrew/Cellar/openssl/1.0.2p/share/man MANSUFFIX=ssl
==> Downloading https://curl.haxx.se/ca/cacert-2017-01-18.pem
######################################################################## 100.0%
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /virtual/hoge/.linuxbrew/etc/openssl/certs

and run
  /virtual/hoge/.linuxbrew/opt/openssl/bin/c_rehash
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/openssl/1.0.2p: 1,792 files, 14.1MB, built in 5 minutes 34 seconds
==> Installing curl dependency: pkg-config
==> Downloading https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
Already downloaded: /virtual/hoge/.cache/Homebrew/downloads/5bdbf3b3fdadaf72744884b98b74a2ff887bd63a20b246f811a222a146ad7b64--pkg-config-0.29.2.tar.gz
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/pkg-config/0.29.2_1 --disable-host-tool --with-internal-glib --with-pc
==> make
==> make check
==> make install
🍺  /virtual/hoge/.linuxbrew/Cellar/pkg-config/0.29.2_1: 11 files, 727.0KB, built in 58 seconds
==> Installing curl
==> Downloading https://curl.haxx.se/download/curl-7.62.0.tar.bz2
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/virtual/hoge/.linuxbrew/Cellar/curl/7.62.0 --with-ssl=/virtual/hoge/.linu
==> make install
🍺  /virtual/hoge/.linuxbrew/Cellar/curl/7.62.0: 445 files, 3.6MB, built in 1 minute 16 seconds
==> Caveats
==> openssl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /virtual/hoge/.linuxbrew/etc/openssl/certs

and run
  /virtual/hoge/.linuxbrew/opt/openssl/bin/c_rehash
==> Installing dependencies for git: gpatch, ncurses, gettext, bzip2, pcre2, libbsd and expat
==> Installing git dependency: gpatch
==> Downloading https://ftp.gnu.org/gnu/patch/patch-2.7.6.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/gpatch/2.7.6
==> make install
🍺  /virtual/hoge/.linuxbrew/Cellar/gpatch/2.7.6: 10 files, 373.5KB, built in 1 minute 7 seconds
==> Installing git dependency: ncurses
==> Downloading https://ftp.gnu.org/gnu/ncurses/ncurses-6.1.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/ncurses/6.1 --enable-pc-files --with-pkg-config-libdir=/virtual/notagu
==> make install
🍺  /virtual/hoge/.linuxbrew/Cellar/ncurses/6.1: 3,878 files, 9MB, built in 1 minute 2 seconds
==> Installing git dependency: gettext
==> Downloading https://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.xz
######################################################################## 100.0%
==> Downloading http://xmlsoft.org/sources/libxml2-2.9.7.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/gettext/0.19.8.1_1/libexec --without-python --without-lzma
==> make install
==> ./configure --disable-silent-rules --prefix=/virtual/hoge/.linuxbrew/Cellar/gettext/0.19.8.1_1  --with-included-glib --with
==> make
==> make install
==> Caveats
Emacs Lisp files have been installed to:
  /virtual/hoge/.linuxbrew/share/emacs/site-lisp/gettext
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/gettext/0.19.8.1_1: 2,204 files, 28.9MB, built in 4 minutes 55 seconds
==> Installing git dependency: bzip2
==> Downloading https://ftp.osuosl.org/pub/clfs/conglomeration/bzip2/bzip2-1.0.6.tar.gz
######################################################################## 100.0%
==> make install PREFIX=/virtual/hoge/.linuxbrew/Cellar/bzip2/1.0.6_1
==> make -f Makefile-libbz2_so clean
==> make -f Makefile-libbz2_so
🍺  /virtual/hoge/.linuxbrew/Cellar/bzip2/1.0.6_1: 30 files, 551.5KB, built in 8 seconds
==> Installing git dependency: pcre2
==> Downloading https://ftp.pcre.org/pub/pcre/pcre2-10.32.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/pcre2/10.32 --enable-pcre2-16 --enable-pcre2-32 --enable-pcre2grep-lib
==> make
==> make install
🍺  /virtual/hoge/.linuxbrew/Cellar/pcre2/10.32: 228 files, 6.1MB, built in 31 seconds
==> Installing git dependency: libbsd
==> Downloading https://libbsd.freedesktop.org/releases/libbsd-0.8.3.tar.xz
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/virtual/hoge/.linuxbrew/Cellar/libbsd/0.8.3
==> make install
Last 15 lines from /virtual/hoge/.cache/Homebrew/Logs/libbsd/02.make:
make[1]: *** [nlist.lo] Error 1
make[1]: *** [pidfile.lo] Error 1
make[1]: *** [progname.lo] Error 1
In file included from ../include/bsd/libutil.h:46,
                 from ../include/bsd/stdlib.h:37,
                 from radixsort.c:57:
../include/bsd/stdio.h:52: error: wrong number of arguments specified for ‘deprecated’ attribute
In file included from ../include/bsd/libutil.h:46,
                 from ../include/bsd/stdlib.h:37,
                 from reallocf.c:30:
../include/bsd/stdio.h:52: error: wrong number of arguments specified for ‘deprecated’ attribute
make[1]: *** [radixsort.lo] Error 1
make[1]: *** [reallocf.lo] Error 1
make[1]: Leaving directory `/virtual/hoge/tmp/libbsd-20181126-45023-81u4p4/libbsd-0.8.3/src'
make: *** [install-recursive] Error 1

READ THIS: https://github.com/Linuxbrew/brew/wiki/troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core,
which support macOS only."

Initialized empty Git repository in /virtual/hoge/.linuxbrew/Homebrew/.git/
usage: git ls-remote [--heads] [--tags]  [-u <exec> | --upload-pack <exec>] <repository> <refs>...
error: unknown option `shallow-since='
usage: git fetch [<options>] [<repository> [<refspec>...]]
   or: git fetch [<options>] <group>
   or: git fetch --multiple [<options>] [<repository> | <group>]...
   or: git fetch --all [<options>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --all                 fetch from all remotes
    -a, --append          append to .git/FETCH_HEAD instead of overwriting
    --upload-pack <PATH>  path to upload pack on remote end
    -f, --force           force overwrite of local branch
    -m, --multiple        fetch from multiple remotes
    -t, --tags            fetch all tags and associated objects
    -n                    do not fetch all tags (--no-tags)
    -p, --prune           prune tracking branches no longer on remote
    --dry-run             dry run
    -k, --keep            keep downloaded pack
    -u, --update-head-ok  allow updating of HEAD ref
    --progress            force progress reporting
    --depth <DEPTH>       deepen history of shallow clone

==> Installing dependencies for gcc: m4, gmp, mpfr, libmpc and isl@0.18
==> Installing gcc dependency: m4
==> Downloading https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz
Already downloaded: /virtual/hoge/.cache/Homebrew/downloads/bb74c92bda9bdc32be0653ca50751920ff35cfe8f329499d0bea86fbe66ce580--m4-1.4.18.tar.xz
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/m4/1.4.18
==> make
==> make install
🍺  /virtual/hoge/.linuxbrew/Cellar/m4/1.4.18: 13 files, 633.6KB, built in 1 minute
==> Installing gcc dependency: gmp
==> Downloading https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/gmp/6.1.2_2 --enable-cxx --with-pic
==> make
==> make check
==> make install
🍺  /virtual/hoge/.linuxbrew/Cellar/gmp/6.1.2_2: 20 files, 3.7MB, built in 2 minutes 3 seconds
==> Installing gcc dependency: mpfr
==> Downloading https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.1.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/mpfr/4.0.1 --disable-silent-rules
==> make
==> make check
==> make install
🍺  /virtual/hoge/.linuxbrew/Cellar/mpfr/4.0.1: 29 files, 5MB, built in 50 seconds
==> Installing gcc dependency: libmpc
==> Downloading https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/libmpc/1.1.0 --with-gmp=/virtual/hoge/.linuxbrew/opt/gmp --with-m
==> make
==> make check
==> make install
🍺  /virtual/hoge/.linuxbrew/Cellar/libmpc/1.1.0: 13 files, 489.3KB, built in 26 seconds
==> Installing gcc dependency: isl@0.18
==> Downloading http://isl.gforge.inria.fr/isl-0.18.tar.xz
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/virtual/hoge/.linuxbrew/Cellar/isl@0.18/0.18 --with-gmp=system --with-gmp-pref
==> make check
==> make install
==> Caveats
isl@0.18 is keg-only, which means it was not symlinked into /virtual/hoge/.linuxbrew,
because this is an alternate version of another formula.

For compilers to find isl@0.18 you may need to set:
  export LDFLAGS="-L/virtual/hoge/.linuxbrew/opt/isl@0.18/lib"
  export CPPFLAGS="-I/virtual/hoge/.linuxbrew/opt/isl@0.18/include"

For pkg-config to find isl@0.18 you may need to set:
  export PKG_CONFIG_PATH="/virtual/hoge/.linuxbrew/opt/isl@0.18/lib/pkgconfig"

==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/isl@0.18/0.18: 81 files, 5.1MB, built in 59 seconds
==> Installing gcc --without-glibc
==> Downloading https://ftp.gnu.org/gnu/gcc/gcc-5.5.0/gcc-5.5.0.tar.xz
######################################################################## 100.0%
==> ../configure --with-isl=/virtual/hoge/.linuxbrew/opt/isl@0.18 --with-bugurl=https://github.com/Linuxbrew/homebrew-core/issu
==> make
==> make install-strip
==> Creating the GCC specs file: /virtual/hoge/.linuxbrew/Cellar/gcc/5.5.0_4/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/specs
🍺  /virtual/hoge/.linuxbrew/Cellar/gcc/5.5.0_4: 1,352 files, 167.5MB, built in 18 minutes 18 seconds
==> Caveats
==> isl@0.18
isl@0.18 is keg-only, which means it was not symlinked into /virtual/hoge/.linuxbrew,
because this is an alternate version of another formula.

For compilers to find isl@0.18 you may need to set:
  export LDFLAGS="-L/virtual/hoge/.linuxbrew/opt/isl@0.18/lib"
  export CPPFLAGS="-I/virtual/hoge/.linuxbrew/opt/isl@0.18/include"

For pkg-config to find isl@0.18 you may need to set:
  export PKG_CONFIG_PATH="/virtual/hoge/.linuxbrew/opt/isl@0.18/lib/pkgconfig"

まだなんかエラー出てるな。
ここでためにしなんかインストールしてみる。

$ brew install samtools
==> Downloading https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.xz
Already downloaded: /virtual/hoge/.cache/Homebrew/downloads/6d97b8dc5e65b0074703493a78fad9f1118ea2438a9112e32d3e727a5e52685a--git-2.19.1.tar.xz
Updating Homebrew...
==> make install prefix=/virtual/hoge/.linuxbrew/Cellar/git/2.19.1 sysconfdir=/virtual/hoge/.linuxbrew/etc CC=gcc-5 CFLAGS
Last 15 lines from /virtual/hoge/.cache/Homebrew/Logs/git/01.make:
gcc-5   -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"x86_64\"" -DUSE_LIBPCRE2 -I/virtual/hoge/.linuxbrew/opt/pcre2/include -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -I/virtual/hoge/.linuxbrew/opt/openssl/include -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"' -o t/helper/test-fake-ssh   t/helper/test-fake-ssh.o common-main.o libgit.a xdiff/lib.a libgit.a xdiff/lib.a  -lpcre2-8 -L/virtual/hoge/.linuxbrew/opt/pcre2/lib -Wl,-rpath,/virtual/hoge/.linuxbrew/opt/pcre2/lib -lz -lpthread -lrt
gcc-5   -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"x86_64\"" -DUSE_LIBPCRE2 -I/virtual/hoge/.linuxbrew/opt/pcre2/include -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -I/virtual/hoge/.linuxbrew/opt/openssl/include -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"' -o t/helper/test-line-buffer   t/helper/test-line-buffer.o common-main.o libgit.a xdiff/lib.a vcs-svn/lib.a libgit.a xdiff/lib.a  -lpcre2-8 -L/virtual/hoge/.linuxbrew/opt/pcre2/lib -Wl,-rpath,/virtual/hoge/.linuxbrew/opt/pcre2/lib -lz -lpthread -lrt
gcc-5   -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"x86_64\"" -DUSE_LIBPCRE2 -I/virtual/hoge/.linuxbrew/opt/pcre2/include -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -I/virtual/hoge/.linuxbrew/opt/openssl/include -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"' -o t/helper/test-parse-options   t/helper/test-parse-options.o common-main.o libgit.a xdiff/lib.a libgit.a xdiff/lib.a  -lpcre2-8 -L/virtual/hoge/.linuxbrew/opt/pcre2/lib -Wl,-rpath,/virtual/hoge/.linuxbrew/opt/pcre2/lib -lz -lpthread -lrt
gcc-5   -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"x86_64\"" -DUSE_LIBPCRE2 -I/virtual/hoge/.linuxbrew/opt/pcre2/include -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -I/virtual/hoge/.linuxbrew/opt/openssl/include -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"' -o t/helper/test-pkt-line   t/helper/test-pkt-line.o common-main.o libgit.a xdiff/lib.a libgit.a xdiff/lib.a  -lpcre2-8 -L/virtual/hoge/.linuxbrew/opt/pcre2/lib -Wl,-rpath,/virtual/hoge/.linuxbrew/opt/pcre2/lib -lz -lpthread -lrt
gcc-5   -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"x86_64\"" -DUSE_LIBPCRE2 -I/virtual/hoge/.linuxbrew/opt/pcre2/include -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -I/virtual/hoge/.linuxbrew/opt/openssl/include -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"' -o t/helper/test-svn-fe   t/helper/test-svn-fe.o common-main.o libgit.a xdiff/lib.a vcs-svn/lib.a libgit.a xdiff/lib.a  -lpcre2-8 -L/virtual/hoge/.linuxbrew/opt/pcre2/lib -Wl,-rpath,/virtual/hoge/.linuxbrew/opt/pcre2/lib -lz -lpthread -lrt
gcc-5   -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"x86_64\"" -DUSE_LIBPCRE2 -I/virtual/hoge/.linuxbrew/opt/pcre2/include -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -I/virtual/hoge/.linuxbrew/opt/openssl/include -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"' -o t/helper/test-tool   t/helper/test-tool.o common-main.o t/helper/test-chmtime.o t/helper/test-config.o t/helper/test-ctype.o t/helper/test-date.o t/helper/test-delta.o t/helper/test-drop-caches.o t/helper/test-dump-cache-tree.o t/helper/test-dump-split-index.o t/helper/test-example-decorate.o t/helper/test-genrandom.o t/helper/test-hashmap.o t/helper/test-index-version.o t/helper/test-json-writer.o t/helper/test-lazy-init-name-hash.o t/helper/test-match-trees.o t/helper/test-mergesort.o t/helper/test-mktemp.o t/helper/test-online-cpus.o t/helper/test-path-utils.o t/helper/test-prio-queue.o t/helper/test-read-cache.o t/helper/test-ref-store.o t/helper/test-regex.o t/helper/test-repository.o t/helper/test-revision-walking.o t/helper/test-run-command.o t/helper/test-scrap-cache-tree.o t/helper/test-sha1-array.o t/helper/test-sha1.o t/helper/test-sigchain.o t/helper/test-strcmp-offset.o t/helper/test-string-list.o t/helper/test-submodule-config.o t/helper/test-subprocess.o t/helper/test-urlmatch-normalization.o t/helper/test-wildmatch.o t/helper/test-write-cache.o libgit.a xdiff/lib.a libgit.a xdiff/lib.a  -lpcre2-8 -L/virtual/hoge/.linuxbrew/opt/pcre2/lib -Wl,-rpath,/virtual/hoge/.linuxbrew/opt/pcre2/lib -lz -lpthread -lrt
/virtual/hoge/.linuxbrew/bin/ld: //virtual/hoge/.linuxbrew/lib/libbsd.so.0: undefined reference to `getauxval@GLIBC_2.16'
/virtual/hoge/.linuxbrew/bin/ld: /virtual/hoge/.linuxbrew/lib/libexpat.so: undefined reference to `memcpy@GLIBC_2.14'
collect2: error: ld returned 1 exit status
make: *** [git-http-push] Error 1
make: *** Waiting for unfinished jobs....
/virtual/hoge/.linuxbrew/bin/ld: //virtual/hoge/.linuxbrew/lib/libbsd.so.0: undefined reference to `getauxval@GLIBC_2.16'
/virtual/hoge/.linuxbrew/bin/ld: /virtual/hoge/.linuxbrew/lib/libexpat.so: undefined reference to `memcpy@GLIBC_2.14'
collect2: error: ld returned 1 exit status
make: *** [git-remote-http] Error 1

READ THIS: https://github.com/Linuxbrew/brew/wiki/troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core,
which support macOS only."

These open issues may also help:
git: add caveat explaining Net::SMTP::SSL module https://github.com/Homebrew/homebrew-core/pull/33557
Initialized empty Git repository in /virtual/hoge/.linuxbrew/Homebrew/.git/
usage: git ls-remote [--heads] [--tags]  [-u <exec> | --upload-pack <exec>] <repository> <refs>...
error: unknown option `shallow-since='
usage: git fetch [<options>] [<repository> [<refspec>...]]
   or: git fetch [<options>] <group>
   or: git fetch --multiple [<options>] [<repository> | <group>]...
   or: git fetch --all [<options>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --all                 fetch from all remotes
    -a, --append          append to .git/FETCH_HEAD instead of overwriting
    --upload-pack <PATH>  path to upload pack on remote end
    -f, --force           force overwrite of local branch
    -m, --multiple        fetch from multiple remotes
    -t, --tags            fetch all tags and associated objects
    -n                    do not fetch all tags (--no-tags)
    -p, --prune           prune tracking branches no longer on remote
    --dry-run             dry run
    -k, --keep            keep downloaded pack
    -u, --update-head-ok  allow updating of HEAD ref
    --progress            force progress reporting
    --depth <DEPTH>       deepen history of shallow clone

==> Installing dependencies for samtools: xz and htslib
==> Installing samtools dependency: xz
==> Downloading https://linuxbrew.bintray.com/bottles/xz-5.2.4.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring xz-5.2.4.x86_64_linux.bottle.tar.gz
🍺  /virtual/hoge/.linuxbrew/Cellar/xz/5.2.4: 99 files, 3.3MB
==> Installing samtools dependency: htslib
==> Downloading https://linuxbrew.bintray.com/bottles/htslib-1.9.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring htslib-1.9.x86_64_linux.bottle.tar.gz
🍺  /virtual/hoge/.linuxbrew/Cellar/htslib/1.9: 163 files, 21.2MB
==> Installing samtools
==> Downloading https://linuxbrew.bintray.com/bottles/samtools-1.9.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring samtools-1.9.x86_64_linux.bottle.tar.gz
🍺  /virtual/hoge/.linuxbrew/Cellar/samtools/1.9: 29 files, 837.5KB
[hoge@s2 ~]$ samtools
samtools: /lib64/libm.so.6: version `GLIBC_2.23' not found (required by /virtual/hoge/.linuxbrew/lib/libhts.so.2)
samtools: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by /virtual/hoge/.linuxbrew/lib/libhts.so.2)
samtools: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /virtual/hoge/.linuxbrew/lib/libhts.so.2)
samtools: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /virtual/hoge/.linuxbrew/lib/liblzma.so.5)
samtools: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /virtual/hoge/.linuxbrew/lib/liblzma.so.5)

なんかインストールはできたがやはりGLIBC_2.23が無いと言って走らない。

$ brew install glibc
==> Downloading https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.xz
Already downloaded: /virtual/hoge/.cache/Homebrew/downloads/6d97b8dc5e65b0074703493a78fad9f1118ea2438a9112e32d3e727a5e52685a--git-2.19.1.tar.xz
Updating Homebrew...
==> make install prefix=/virtual/hoge/.linuxbrew/Cellar/git/2.19.1 sysconfdir=/virtual/hoge/.linuxbrew/etc CC=gcc-5 CFLAGS
Last 15 lines from /virtual/hoge/.cache/Homebrew/Logs/git/01.make:
	ln -s git git-bisect--helper 2>/dev/null || \
	cp git git-bisect--helper
/virtualrm -f git-blame && \
	ln git git-blame 2>/dev/null || \
	ln -s git git-blame 2>/dev/null || \
/	cp git git-blame
hoge/.linuxbrew/bin/ld: //virtual/hoge/.linuxbrew/lib/libbsd.so.0: undefined reference to `getauxval@GLIBC_2.16'
/virtual/hoge/.linuxbrew/bin/ld: /virtual/hoge/.linuxbrew/lib/libexpat.so: undefined reference to `memcpy@GLIBC_2.14'
collect2: error: ld returned 1 exit status
/virtual/hoge/.linuxbrew/bin/ld: //virtual/hoge/.linuxbrew/lib/libbsd.so.0: undefined reference to `getauxval@GLIBC_2.16'
/virtual/hoge/.linuxbrew/bin/ld: /virtual/hoge/.linuxbrew/lib/libexpat.so: undefined reference to `memcpy@GLIBC_2.14'
collect2: error: ld returned 1 exit status
make: *** [git-http-push] Error 1
make: *** Waiting for unfinished jobs....
make: *** [git-remote-http] Error 1

READ THIS: https://github.com/Linuxbrew/brew/wiki/troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core,
which support macOS only."

These open issues may also help:
git: add caveat explaining Net::SMTP::SSL module https://github.com/Homebrew/homebrew-core/pull/33557
Initialized empty Git repository in /virtual/hoge/.linuxbrew/Homebrew/.git/
usage: git ls-remote [--heads] [--tags]  [-u <exec> | --upload-pack <exec>] <repository> <refs>...
error: unknown option `shallow-since='
usage: git fetch [<options>] [<repository> [<refspec>...]]
   or: git fetch [<options>] <group>
   or: git fetch --multiple [<options>] [<repository> | <group>]...
   or: git fetch --all [<options>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --all                 fetch from all remotes
    -a, --append          append to .git/FETCH_HEAD instead of overwriting
    --upload-pack <PATH>  path to upload pack on remote end
    -f, --force           force overwrite of local branch
    -m, --multiple        fetch from multiple remotes
    -t, --tags            fetch all tags and associated objects
    -n                    do not fetch all tags (--no-tags)
    -p, --prune           prune tracking branches no longer on remote
    --dry-run             dry run
    -k, --keep            keep downloaded pack
    -u, --update-head-ok  allow updating of HEAD ref
    --progress            force progress reporting
    --depth <DEPTH>       deepen history of shallow clone

==> Downloading https://ftp.gnu.org/gnu/glibc/glibc-2.23.tar.gz
Already downloaded: /virtual/hoge/.cache/Homebrew/downloads/3c17421daad583cfd4fad587b8e1260f19385344f309d7ae11e0c2bb6b75d801--glibc-2.23.tar.gz
==> ../configure --disable-debug --disable-dependency-tracking --disable-silent-rules --prefix=/virtual/hoge/.linuxbrew/Cellar/
==> make
==> make install
==> Installing locale data for en_US.UTF-8
==> /virtual/hoge/.linuxbrew/Cellar/glibc/2.23/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
🍺  /virtual/hoge/.linuxbrew/Cellar/glibc/2.23: 1,405 files, 42.2MB, built in 4 minutes 48 seconds

glibcをインストールするのにglibcがないと言われてもなあ。
しかし、これでglibcは更新できたようで

$ samtools

Program: samtools (Tools for alignments in the SAM format)
Version: 1.9 (using htslib 1.9)

Usage:   samtools <command> [options]

Commands:
  -- Indexing
     dict           create a sequence dictionary file
     faidx          index/extract FASTA
     fqidx          index/extract FASTQ
     index          index alignment

  -- Editing
     calmd          recalculate MD/NM tags and '=' bases
     fixmate        fix mate information
     reheader       replace BAM header
     targetcut      cut fosmid regions (for fosmid pool only)
     addreplacerg   adds or replaces RG tags
     markdup        mark duplicates

  -- File operations
     collate        shuffle and group alignments by name
     cat            concatenate BAMs
     merge          merge sorted alignments
     mpileup        multi-way pileup
     sort           sort alignment file
     split          splits a file by read group
     quickcheck     quickly check if SAM/BAM/CRAM file appears intact
     fastq          converts a BAM to a FASTQ
     fasta          converts a BAM to a FASTA

  -- Statistics
     bedcov         read depth per BED region
     depth          compute the depth
     flagstat       simple stats
     idxstats       BAM index stats
     phase          phase heterozygotes
     stats          generate stats (former bamcheck)

  -- Viewing
     flags          explain BAM flags
     tview          text alignment viewer
     view           SAM<->BAM<->CRAM conversion
     depad          convert padded BAM to unpadded BAM

ちゃんと走るようになった。
さて、gccもバージョンを上げておくか。

$ brew remove gcc
Uninstalling /virtual/hoge/.linuxbrew/Cellar/gcc/5.5.0_4... (1,352 files, 167.5MB)
$ brew install gcc
==> Installing dependencies for git: gcc
==> Installing git dependency: gcc
==> Downloading https://linuxbrew.bintray.com/bottles/gcc-5.5.0_4.x86_64_linux.bottle.2.tar.gz
Updating Homebrew...
######################################################################## 100.0%
==> Pouring gcc-5.5.0_4.x86_64_linux.bottle.2.tar.gz
==> Creating the GCC specs file: /virtual/hoge/.linuxbrew/Cellar/gcc/5.5.0_4/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.5.0/spec
🍺  /virtual/hoge/.linuxbrew/Cellar/gcc/5.5.0_4: 1,361 files, 169.8MB
==> Installing git
==> Downloading https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.xz
Already downloaded: /virtual/hoge/.cache/Homebrew/downloads/6d97b8dc5e65b0074703493a78fad9f1118ea2438a9112e32d3e727a5e52685a--git-2.19.1.tar.xz
==> make install prefix=/virtual/hoge/.linuxbrew/Cellar/git/2.19.1 sysconfdir=/virtual/hoge/.linuxbrew/etc CC=gcc-5 CFLAGS
==> make
==> make test
==> make CC=gcc-5 CFLAGS= LDFLAGS=
==> Downloading https://www.kernel.org/pub/software/scm/git/git-manpages-2.19.1.tar.xz
==> Downloading from https://mirrors.edge.kernel.org/pub/software/scm/git/git-manpages-2.19.1.tar.xz
######################################################################## 100.0%
==> Downloading https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.19.1.tar.xz
==> Downloading from https://mirrors.edge.kernel.org/pub/software/scm/git/git-htmldocs-2.19.1.tar.xz
######################################################################## 100.0%
==> Caveats
Bash completion has been installed to:
  /virtual/hoge/.linuxbrew/etc/bash_completion.d

Emacs Lisp files have been installed to:
  /virtual/hoge/.linuxbrew/share/emacs/site-lisp/git
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/git/2.19.1: 1,439 files, 42.8MB, built in 35 seconds
==> Caveats
==> git
Bash completion has been installed to:
  /virtual/hoge/.linuxbrew/etc/bash_completion.d

Emacs Lisp files have been installed to:
  /virtual/hoge/.linuxbrew/share/emacs/site-lisp/git
Initialized empty Git repository in /virtual/hoge/.linuxbrew/Homebrew/.git/
remote: Enumerating objects: 233, done.
remote: Counting objects: 100% (233/233), done.
remote: Compressing objects: 100% (152/152), done.
remote: Total 125562 (delta 149), reused 115 (delta 78), pack-reused 125329
Receiving objects: 100% (125562/125562), 28.79 MiB | 15.12 MiB/s, done.
Resolving deltas: 100% (92006/92006), done.
From https://github.com/Linuxbrew/brew
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      master     -> origin/master
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
 * [new tag]             1.0.0      -> 1.0.0
 * [new tag]             1.0.1      -> 1.0.1
 * [new tag]             1.0.2      -> 1.0.2
 * [new tag]             1.0.3      -> 1.0.3
 * [new tag]             1.0.4      -> 1.0.4
 * [new tag]             1.0.5      -> 1.0.5
 * [new tag]             1.0.6      -> 1.0.6
 * [new tag]             1.0.7      -> 1.0.7
 * [new tag]             1.0.8      -> 1.0.8
 * [new tag]             1.0.9      -> 1.0.9
 * [new tag]             1.1.0      -> 1.1.0
 * [new tag]             1.1.0.1    -> 1.1.0.1
 * [new tag]             1.1.1      -> 1.1.1
 * [new tag]             1.1.10     -> 1.1.10
 * [new tag]             1.1.11     -> 1.1.11
 * [new tag]             1.1.12     -> 1.1.12
 * [new tag]             1.1.13     -> 1.1.13
 * [new tag]             1.1.2      -> 1.1.2
 * [new tag]             1.1.2.1    -> 1.1.2.1
 * [new tag]             1.1.3      -> 1.1.3
 * [new tag]             1.1.4      -> 1.1.4
 * [new tag]             1.1.5      -> 1.1.5
 * [new tag]             1.1.6      -> 1.1.6
 * [new tag]             1.1.7      -> 1.1.7
 * [new tag]             1.1.8      -> 1.1.8
 * [new tag]             1.1.9      -> 1.1.9
 * [new tag]             1.2.0      -> 1.2.0
 * [new tag]             1.2.1      -> 1.2.1
 * [new tag]             1.2.2      -> 1.2.2
 * [new tag]             1.2.3      -> 1.2.3
 * [new tag]             1.2.4      -> 1.2.4
 * [new tag]             1.2.5      -> 1.2.5
 * [new tag]             1.2.6      -> 1.2.6
 * [new tag]             1.2.7      -> 1.2.7
 * [new tag]             1.2.8      -> 1.2.8
 * [new tag]             1.3.0      -> 1.3.0
 * [new tag]             1.3.1      -> 1.3.1
 * [new tag]             1.3.2      -> 1.3.2
 * [new tag]             1.3.3      -> 1.3.3
 * [new tag]             1.3.4      -> 1.3.4
 * [new tag]             1.3.5      -> 1.3.5
 * [new tag]             1.3.6      -> 1.3.6
 * [new tag]             1.3.7      -> 1.3.7
 * [new tag]             1.3.8      -> 1.3.8
 * [new tag]             1.3.9      -> 1.3.9
 * [new tag]             1.4.0      -> 1.4.0
 * [new tag]             1.4.1      -> 1.4.1
 * [new tag]             1.4.2      -> 1.4.2
 * [new tag]             1.4.3      -> 1.4.3
 * [new tag]             1.5.0      -> 1.5.0
 * [new tag]             1.5.1      -> 1.5.1
 * [new tag]             1.5.10     -> 1.5.10
 * [new tag]             1.5.11     -> 1.5.11
 * [new tag]             1.5.12     -> 1.5.12
 * [new tag]             1.5.13     -> 1.5.13
 * [new tag]             1.5.14     -> 1.5.14
 * [new tag]             1.5.2      -> 1.5.2
 * [new tag]             1.5.3      -> 1.5.3
 * [new tag]             1.5.4      -> 1.5.4
 * [new tag]             1.5.5      -> 1.5.5
 * [new tag]             1.5.6      -> 1.5.6
 * [new tag]             1.5.7      -> 1.5.7
 * [new tag]             1.5.8      -> 1.5.8
 * [new tag]             1.5.9      -> 1.5.9
 * [new tag]             1.6.0      -> 1.6.0
 * [new tag]             1.6.1      -> 1.6.1
 * [new tag]             1.6.10     -> 1.6.10
 * [new tag]             1.6.11     -> 1.6.11
 * [new tag]             1.6.12     -> 1.6.12
 * [new tag]             1.6.13     -> 1.6.13
 * [new tag]             1.6.14     -> 1.6.14
 * [new tag]             1.6.15     -> 1.6.15
 * [new tag]             1.6.16     -> 1.6.16
 * [new tag]             1.6.17     -> 1.6.17
 * [new tag]             1.6.2      -> 1.6.2
 * [new tag]             1.6.3      -> 1.6.3
 * [new tag]             1.6.4      -> 1.6.4
 * [new tag]             1.6.5      -> 1.6.5
 * [new tag]             1.6.6      -> 1.6.6
 * [new tag]             1.6.7      -> 1.6.7
 * [new tag]             1.6.8      -> 1.6.8
 * [new tag]             1.6.9      -> 1.6.9
 * [new tag]             1.7.0      -> 1.7.0
 * [new tag]             1.7.1      -> 1.7.1
 * [new tag]             1.7.2      -> 1.7.2
 * [new tag]             1.7.3      -> 1.7.3
 * [new tag]             1.7.4      -> 1.7.4
 * [new tag]             1.7.5      -> 1.7.5
 * [new tag]             1.7.6      -> 1.7.6
 * [new tag]             1.7.7      -> 1.7.7
 * [new tag]             1.8.0      -> 1.8.0
 * [new tag]             1.8.1      -> 1.8.1
 * [new tag]             1.8.2      -> 1.8.2
 * [new tag]             1.8.3      -> 1.8.3
HEAD is now at 571347fa6 Merge tag Homebrew/1.8.4 into Linuxbrew/master
Initialized empty Git repository in /virtual/hoge/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/.git/
remote: Enumerating objects: 4911, done.
remote: Counting objects: 100% (4911/4911), done.
remote: Compressing objects: 100% (4707/4707), done.
remote: Total 4911 (delta 49), reused 332 (delta 11), pack-reused 0
Receiving objects: 100% (4911/4911), 4.22 MiB | 8.56 MiB/s, done.
Resolving deltas: 100% (49/49), done.
From https://github.com/Linuxbrew/homebrew-core
 * [new branch]      master     -> origin/master
HEAD is now at 8935061 amazon-ecs-cli: update 1.12.0 bottle for Linuxbrew.
Warning: gcc 5.5.0_4 is already installed and up-to-date
To reinstall 5.5.0_4, run `brew reinstall gcc`

warningはあるもののようやくエラーが無くなったね。
やっと本来やりたかったところに戻ってきたよ。

$ brew install pyenv-virtualenv
==> Installing dependencies for pyenv-virtualenv: autoconf, readline and pyenv
==> Installing pyenv-virtualenv dependency: autoconf
==> Downloading https://linuxbrew.bintray.com/bottles/autoconf-2.69.x86_64_linux.bottle.4.tar.gz
######################################################################## 100.0%
==> Pouring autoconf-2.69.x86_64_linux.bottle.4.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /virtual/hoge/.linuxbrew/share/emacs/site-lisp/autoconf
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/autoconf/2.69: 70 files, 3MB
==> Installing pyenv-virtualenv dependency: readline
==> Downloading https://linuxbrew.bintray.com/bottles/readline-7.0.5.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-7.0.5.x86_64_linux.bottle.tar.gz
🍺  /virtual/hoge/.linuxbrew/Cellar/readline/7.0.5: 46 files, 3.5MB
==> Installing pyenv-virtualenv dependency: pyenv
==> Installing dependencies for pyenv: gdbm, sqlite, libffi and python
==> Installing pyenv dependency: gdbm
==> Downloading https://linuxbrew.bintray.com/bottles/gdbm-1.18.1.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gdbm-1.18.1.x86_64_linux.bottle.tar.gz
🍺  /virtual/hoge/.linuxbrew/Cellar/gdbm/1.18.1: 40 files, 1MB
==> Installing pyenv dependency: sqlite
==> Downloading https://linuxbrew.bintray.com/bottles/sqlite-3.25.3.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring sqlite-3.25.3.x86_64_linux.bottle.tar.gz
🍺  /virtual/hoge/.linuxbrew/Cellar/sqlite/3.25.3: 12 files, 4.4MB
==> Installing pyenv dependency: libffi
==> Downloading https://linuxbrew.bintray.com/bottles/libffi-3.2.1.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libffi-3.2.1.x86_64_linux.bottle.tar.gz
🍺  /virtual/hoge/.linuxbrew/Cellar/libffi/3.2.1: 17 files, 362.4KB
==> Installing pyenv dependency: python
==> Downloading https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/virtual/hoge/.linuxbrew/Cellar/python/3.7.1 --enable-ipv6 --datarootdir=/virtual/hoge/.linuxbrew
==> make
==> make install PYTHONAPPSDIR=/virtual/hoge/.linuxbrew/Cellar/python/3.7.1
==> Downloading https://files.pythonhosted.org/packages/26/e5/9897eee1100b166a61f91b68528cb692e8887300d9cbdaa1a349f6304b79/setuptool
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/45/ae/8a0ad77defb7cc903f09e551d88b443304a9bd6e6f124e75c0fbbf6de8f7/pip-18.1.
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/c2/00/21e3ecc8a9d484f9de995471c061aa3d8f02ae54bdfd9cbdddb59138c809/wheel-0.3
######################################################################## 100.0%
==> /virtual/hoge/.linuxbrew/Cellar/python/3.7.1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scri
==> /virtual/hoge/.linuxbrew/Cellar/python/3.7.1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scri
==> /virtual/hoge/.linuxbrew/Cellar/python/3.7.1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scri
==> Caveats
Python has been installed as
  /virtual/hoge/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /virtual/hoge/.linuxbrew/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install python@2

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /virtual/hoge/.linuxbrew/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/python/3.7.1: 8,084 files, 123.8MB, built in 3 minutes 18 seconds
==> Installing pyenv
==> Downloading https://linuxbrew.bintray.com/bottles/pyenv-1.2.8.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pyenv-1.2.8.x86_64_linux.bottle.tar.gz
🍺  /virtual/hoge/.linuxbrew/Cellar/pyenv/1.2.8: 612 files, 2.9MB
==> Installing pyenv-virtualenv
==> Downloading https://github.com/pyenv/pyenv-virtualenv/archive/v1.1.3.tar.gz
==> Downloading from https://codeload.github.com/pyenv/pyenv-virtualenv/tar.gz/v1.1.3
#=#=-#  #                                                                     
==> ./install.sh
==> Caveats
To enable auto-activation add to your profile:
  if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
==> Summary
🍺  /virtual/hoge/.linuxbrew/Cellar/pyenv-virtualenv/1.1.3: 20 files, 96.9KB, built in 5 seconds
==> Caveats
==> autoconf
Emacs Lisp files have been installed to:
  /virtual/hoge/.linuxbrew/share/emacs/site-lisp/autoconf
==> python
Python has been installed as
  /virtual/hoge/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /virtual/hoge/.linuxbrew/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install python@2

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /virtual/hoge/.linuxbrew/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> pyenv-virtualenv
To enable auto-activation add to your profile:
  if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi

よしよし。

redmineのインストールでつまづく

redmineをインストールしようとして
Redmineが依存するgemパッケージをインストールのため
# bundle install --without development test --path vendor/bundle
としようとすると、途中で
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
というエラーが出て、最終的に

An error occurred while installing rmagick (2.16.0), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.16.0' --source 'https://rubygems.org/'` succeeds
before bundling.
というエラーで止まってしまう。
この原因はrmagick(2.16.0)がimagemagick (version7)に対応していないためで、imagemagickをversion6にダウンしなければならない模様。

rmagickのインストールにハマった - Qiita
ここで対処法が書かれているがMacのHomebrewでの話。
Linuxbrewだと
$ cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/
の部分を
$ cd /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/
と読み替えないとならない。

とまあ、うまくインストールできず今の所頓挫中・・・

NETGEAR GS716Tv3でVLAN その2 自作LANケーブルを疑え

とりあえずの設定ができて2つのVLANにclusterとLANを分離したのだが、なにやら挙動が安定しない。
LANから外のウェブにアクセスしようとするとどういうわけかpublicではなくinternalの方から接続しようとして
つながらなかったり、逆にネットにはつながるのに外からアクセスできなかったり。

もとのアンマネージスイッチと無線LAN 子機などをとっかえひっかえ入れ替えてみるも全然再現しないし。

途方に暮れかけたところで、ふとケーブルを自作カテ6からカテ5Eの既成品に戻してみたところ、何事もなかったようにつながるじゃないの。

NETGEAR GS716Tv3でVLAN

なかなか設定に苦労した。
最終的に一番参考になったサイトは
beginners-network.com

若干機種が違うのでメニュー項目が違っているのだが

まず
Switching>VLAN>Advanced>VLAN Configuration
で、分けたい分のポートのためのVLANを作る。2つに分けたいならとりあえず1個はDefaultをそのまま使っておくのが良さそう。
VLAN IDに4、VLAN Nameは適当にわかるような名前をつけて右下のADDボタンを押す。
次は
Switching>VLAN>Advanced>VLAN Membership
で、VLAN IDに4を選び、Unit1を開いて分けたいポートをUにする。Tは違う。
VLAN ID1も開いて、4で選んだポートのUを消す。
最後に
Switching>VLAN>Advanced>Port PVID Configuration
で、VLAN ID=4に変えたInterfaceにチェックを入れてConfigured PVIDを4に、VLAN Memberも4に書き換えてAPPLY

以上でとりあえずVLANを2つに分けてcluster側と、LAN側を分離することができた。

Torqueのerror/outputをリアルタイムにチェックする

Torqueでジョブを投げると、errorとoutputが処理がすべて終わった後に書き出される。
しかし、何時間もかかる処理が果たしてちゃんと走っているのか心配になるので、できれば普通にスクリプトを走らせるときのように画面にstdoutを出しておきたいこともある。
そんなときは

#!/bin/sh

#PBS -k oe

と入れておくといい。
そうするとhome directoryに
スクリプト名.oジョブID
スクリプト名.eジョブID
と2つファイルが生成され、随時追記されていくので、tail -f やless +Fでモニタしてやる。