« 2011年08月 | メイン | 2011年11月 »

2011年10月 アーカイブ

2011年10月09日

「org.bluestemsoftware.open.maven.plugin」の「launch4j-plugin」をLion(OS X 10.7)で実行する方法

某チャットでの話。
コンパイルするために、ちょっと前まで使っていたメインマシンを分解してた。
mavenのリリースプラグインを実行
リリースプラグインで使っているexe化ツールがLionに未対応
旧マシン(Leopard)でコンパイルを試みる
熱暴走でコンパイル中に落ちる
ファンがまわらないのが原因と思われたので分解して掃除
風が吹くと桶屋が儲かる式な何か。
言葉遊びをしていたらujihisa氏が問題を解決してくれたのでメモ。
実際はもっと紆余曲折あったんだけど、本筋の時間軸を入れ替えて整理した。
問題
Javaで書いたアプリケーションをWindowsで簡単に実行できるようにする「Launch4j」というツールがある。
「Launch4j」を「Maven」で使えるようにする「org.bluestemsoftware.open.maven.plugin:launch4j-plugin(以下、launch4j-plugin)」というプラグインがある。
「launch4j-plugin」の最新バージョンである1.5.0.0がLionで動作しない。
症状の詳細
「launch4j-plugin」を実行すると以下のようなエラーが発生する。
[INFO] --- launch4j-plugin:1.5.0.0:launch4j (default) @ WSBroadcaster ---
[INFO] Platform-specific work directory already exists: /Users/[user id]/.m2/repository/org/bluestemsoftware/open/maven/plugin/launch4j-plugin/1.5.0.0
[INFO] launch4j: Compiling resources
[ERROR] 
net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: Exec failed(2): [Ljava.lang.String;@64b37089
(以下略)
同時にアラートが開き、「PowerPC アプリケーションは現在サポートされていないため、アプリケーション windres を開けません。」と表示される。
原因
「launch4j-plugin」が内部に持っているコマンド「windres」と「ld」が、PowerPCにしか対応していない。
% cd ~/.m2/repository/org/bluestemsoftware/open/maven/plugin/launch4j-plugin/1.5.0.0/launch4j-plugin-1.5.0.0-workdir-mac/bin/
% ls
COPYING    ld         readme.txt windres
% cat readme.txt 
The MinGW binutils were built on Mac OS X 10.4 by Peter Centgraf
% ./windres --version
Launch of "windres" failed: the PowerPC architecture is no longer supported.
% ./ld --version     
Launch of "ld" failed: the PowerPC architecture is no longer supported.
解決方法
「~/.m2/repository/org/bluestemsoftware/open/maven/plugin/launch4j-plugin/1.5.0.0/launch4j-plugin-1.5.0.0-workdir-mac/bin/」配下にある「windres」と「ld」を入れ替える。
「windres」と「ld」は、「binutils」のものを使う。
詳細は後述。
注意点
「Homebrew」で「binutils」をインストールできるが「windres」が含まれない。
「ld」はLionに標準で含まれるが、「launch4j-plugin」が使っている「-mi386pe」というオプションに対応していない。
詳細な解決方法
まず、既存のコマンドを退避する。
% cd ~/.m2/repository/org/bluestemsoftware/open/maven/plugin/launch4j-plugin/1.5.0.0/launch4j-plugin-1.5.0.0-workdir-mac/bin
% mkdir old
% mv ld old
% mv windres old
次に、以下のURLから「binutils」をダウンロードする。
当エントリ執筆時の最新は「binutils-2.21.1.tar.bz2」だった。
「binutils-2.21.1a.tar.bz2」というものもあったが、hashは「binutils-2.21.1.tar.bz2」と同じだった。
「binutils-2.21.1.tar.bz2」をダウンロードしたディレクトリに移動し、以下のコマンドを実行。
% tar -xjvf binutils-2.21.1.tar.bz2
(略)
% cd binutils-2.21.1
% ./configure --target=i686-pc-mingw32
(略)
% make
(略)
実行ファイルだけ必要なので、「make install」は不要。
「windres」は「binutils」ディレクトリ直下に、「ld」は「ld」直下に「ls-new」という名前でできているはず。
以下のコマンドを実行し、コマンドを複製する。
% cp binutils/windres ~/.m2/repository/org/bluestemsoftware/open/maven/plugin/launch4j-plugin/1.5.0.0/launch4j-plugin-1.5.0.0-workdir-mac/bin
% cp ld/ld-new ~/.m2/repository/org/bluestemsoftware/open/maven/plugin/launch4j-plugin/1.5.0.0/launch4j-plugin-1.5.0.0-workdir-mac/bin/ld
これで解決。
thx! ujihisa!
参考URL
windresについての説明
「Launch4j」がLionで動作しないことのバグ報告

2011年10月22日

Androidアプリのパーミッションを一覧表示するPermissionCheckerというツール作った

大したことはしていない。
インストールされているアプリのパーミッションを取得し、一覧表示しているだけ。
一応、アプリケーション別とパーミッション別で表示できる。
ソースはGitHubに公開。
MITライセンスなので、使いやすく改良したり適当にどうぞ。
2011/10/22 追記
パーミッションを確認したり一覧するツールは他にもあったけど、パーミッション別に確認できるものがなかったので作成。

2011年10月29日

「プログラマに半角全角の入り乱れた数字を見せ続けると死ぬ。」で死にたくないのでブックマークレット書いた

上記のサイトに行って、下記のブックマークレットを実行。

(
    function(){
        var e = document.getElementById("sine");
        var d = {
            "0":"0",
            "1":"1",
            "2":"2",
            "3":"3",
            "4":"4",
            "5":"5",
            "6":"6",
            "7":"7",
            "8":"8",
            "9":"9"
        };
        setInterval(
            function(){
                e.innerHTML=e.innerHTML.replace(
                        /[0-9]/g,
                    function(a){
                        return (Math.random()<0.05)?d[a]:a;
                    }
                );
            },
            100
        );
    }
)();
Google

タグ クラウド