wiedii's memo

色々メモリます。

MavericksでHomebrew使ってGaucheインストールした

Gaucheは手動でインストールしたけど、せっかくなのでHomebrewでGauche入れ直しました。

プログラミングGauche

まずGaucheをアンインストールします。
Gaucheソースコードがあるディレクトリに移動して…

$ make uninstall
cd src; /Applications/Xcode.app/Contents/Developer/usr/bin/make uninstall
for f in gosh gauche-config gauche-install gauche-package gauche-cesconv; do rm -f /usr/local/bin/$f; done
for f in libgauche-0.9.dylib; do rm -f /usr/local/lib/$f; done
rm -rf /usr/local/lib/gauche-0.9/0.9.3.3 /usr/local/share/gauche-0.9/0.9.3.3 /usr/local/lib/gauche-0.9/site/0.9.3.3
cd ext; /Applications/Xcode.app/Contents/Developer/usr/bin/make uninstall
for d in gauche util srfi threads uvector charconv binary net termios fcntl file sxml syslog dbm mt-random bcrypt digest vport text zlib sparse peg windows tls; do (cd $d; /Applications/Xcode.app/Contents/Developer/usr/bin/make uninstall); done
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
make[2]: Nothing to be done for `uninstall'.
for f in template.Makefile.in template.configure.ac template.extension.h template.extension.c template.extensionlib.stub template.module.scm template.test.scm template.DIST; do \
	  rm -f /usr/local/share/gauche-0.9/0.9.3.3/$f; \
	done
cd lib; /Applications/Xcode.app/Contents/Developer/usr/bin/make uninstall
make[1]: Nothing to be done for `uninstall'.
rm -f /usr/local/share/gauche-0.9/0.9.3.3//aclocal.m4
rm -f /usr/local/share/aclocal/gauche.m4

その後Homebrewのお決まりのコマンドを打っておきます。

$ brew doctor
Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours, this is a long time in brewland!
To update Homebrew, run `brew update`.
$ brew update
Updated Homebrew from f6ec5528 to 2c82712c.
==> New Formulae
cppi	  jvmtop    libestr
==> Updated Formulae
afflib		    gfortran		libp11		    riak
android-sdk	    graphicsmagick	libvirt		    rsyslog
autoconf-archive    imagemagick		mariadb		    ruby-build
automake	    isync		mpdscribble	    sane-backends
botan		    jsawk		mutt		    sysbench
cadaver		    ledger		ncdc		    uwsgi
elasticsearch	    libextractor	plowshare	    v8
elixir		    libgphoto2		postgres-xc	    valgrind
ffmpeg		    libmpd		qrencode	    wine
==> Deleted Formulae
gtkglextmm

というわけでGaucheをインストールする準備が出来ました。多分。

インストールする前に下調べをした結果

$ brew install --use-llvm gauche

のようなオプションを付けなければいけないと書いてあったので、その通りやっていましたが下記のようなエラーが。

$ brew install --use-llvm gauche
==> Downloading http://downloads.sourceforge.net/gauche/Gauche/Gauche-0.9.3.3.tg
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gauche/0.9.3.3 --enable-multibyte=utf
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/private/tmp/gauche-hKQU/Gauche-0.9.3.3/gc':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
configure: error: ./configure failed for gc

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

結局、

$ brew install gauche
==> Downloading http://downloads.sourceforge.net/gauche/Gauche/Gauche-0.9.3.3.tg
Already downloaded: /Library/Caches/Homebrew/gauche-0.9.3.3.tgz
==> ./configure --prefix=/usr/local/Cellar/gauche/0.9.3.3 --enable-multibyte=utf
==> make
==> make check
==> make install
Warning: Could not link gauche. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link gauche'

Possible conflicting files are:
/usr/local/share/man/man1/gosh.1
/usr/local/share/man/man1/gauche-package.1
/usr/local/share/man/man1/gauche-install.1
/usr/local/share/man/man1/gauche-config.1
/usr/local/share/man/man1/gauche-cesconv.1
==> Summary
🍺  /usr/local/Cellar/gauche/0.9.3.3: 316 files, 11M, built in 3.4 minutes
wiedii-no-MacBook-Pro:Gauche-0.9.3.3 wiedii$ brew update
Updated Homebrew from 2c82712c to 6ab3c1e8.
==> Updated Formulae
dub	  lilypond

で通りました:)
Mavericksとそれ以前(Lion, Mountain Lion等)では何か違うんですかね:)

で、またドクターを呼びました。

$ brew doctor
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:

    gauche
$ gosh
-bash: gosh: command not found

リンクが切れてるみたいなこと言われてますね。

$ brew link
This command requires a keg argument
$ brew link gauche
Linking /usr/local/Cellar/gauche/0.9.3.3... Warning: Could not link gauche. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/gauche/0.9.3.3/share/man/man1/gosh.1
Target /usr/local/share/man/man1/gosh.1 already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
  brew link --overwrite formula_name

To list all files that would be deleted:
  brew link --overwrite --dry-run formula_name
$

"man pageがあるぜ"みたいなこと言われてますね。
その後にコマンドが2つ示されてますが、自分の英語力じゃ理解不能でした。
こういう時は直感で行くしかないですね。

$ brew link --overwrite gauche
Linking /usr/local/Cellar/gauche/0.9.3.3... 14 symlinks created
$ gosh
gosh> (+ 1 2)
3
gosh> (exit)
$

動きましたね(なぜか)。

Land of Lisp

ちなみに

$ brew install gauche

というコマンドを実行する前に、

$ brew install --universal gdbm

というコマンドを実行していました。
gdbm, gaucheをアンインストールして再度、

$ brew install gauche

と実行しても、正常に動きました。

Dr. Homebrew

OS X Mavericksで外付けHDDデータ消失の恐れ -INTERNET Watch
ちなみにMavericksにしてからというもの、しょっちゅうクラッシュしてます。
Mavericksの場合、クラッシュしても黒い幕が上から降りてくるのでなく、白い画面に遷移した後強制的に再起動されるんですね:)