カーネルランド: debian jessie i386、ユーザランド: debian jessie i386
コンパイル済みバイナリをダウンロードして試してみる。単純に起動しただけだはダメっぽい。
$ wget --quiet 'https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-i686.tar.bz2' $ echo '0396e8249e082f72c1e39d33fc9d8de6 phantomjs-2.1.1-linux-i686.tar.bz2' | md5sum --check phantomjs-2.1.1-linux-i686.tar.bz2: OK $ echo '80e03cfeb22cc4dfe4e73b68ab81c9fdd7c78968cfd5358e6af33960464f15e3 phantomjs-2.1.1-linux-i686.tar.bz2' | sha256sum --check phantomjs-2.1.1-linux-i686.tar.bz2: OK $ tar xf phantomjs-2.1.1-linux-i686.tar.bz2 $ ./phantomjs-2.1.1-linux-i686/bin/phantomjs --version PhantomJS has crashed. Please read the bug reporting guide at <http://phantomjs.org/bug-reporting.html> and file a bug report. Illegal instruction
リポジトリからソースコードをダウンロードして手元でコンパイルしてみる。
$ git clone git://github.com/ariya/phantomjs.git Cloning into 'phantomjs'... remote: Counting objects: 63851, done. remote: Compressing objects: 100% (22/22), done. remote: Total 63851 (delta 4), reused 0 (delta 0), pack-reused 63829 Receiving objects: 100% (63851/63851), 124.93 MiB | 63.00 KiB/s, done. Resolving deltas: 100% (33194/33194), done. Checking connectivity... done. $ cd phantomjs/ $ git checkout 2.1.1 Note: checking out '2.1.1'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b new_branch_name HEAD is now at d9cda3d... Set version to "2.1.1" $ git submodule init Submodule '3rdparty-win' (https://github.com/Vitallium/phantomjs-3rdparty-win.git) registered for path 'src/qt/3rdparty' Submodule 'qtbase' (https://github.com/Vitallium/qtbase.git) registered for path 'src/qt/qtbase' Submodule 'qtwebkit' (https://github.com/Vitallium/qtwebkit.git) registered for path 'src/qt/qtwebkit' $ git submodule update Cloning into 'src/qt/3rdparty'... remote: Counting objects: 1402, done. remote: Total 1402 (delta 0), reused 0 (delta 0), pack-reused 1402 Receiving objects: 100% (1402/1402), 138.24 MiB | 36.00 KiB/s, done. Resolving deltas: 100% (647/647), done. Checking connectivity... done. Submodule path 'src/qt/3rdparty': checked out '19051aa97cecdcd3ef8c8862e36a3cb4cd3471fc' Cloning into 'src/qt/qtbase'... remote: Counting objects: 359631, done. remote: Compressing objects: 100% (3/3), done. remote: Total 359631 (delta 1), reused 0 (delta 0), pack-reused 359628 Receiving objects: 100% (359631/359631), 231.75 MiB | 36.00 KiB/s, done. Resolving deltas: 100% (276367/276367), done. Checking connectivity... done. Submodule path 'src/qt/qtbase': checked out 'b5cc0083a5766e773885e8dd624c51a967c17de0' Cloning into 'src/qt/qtwebkit'... remote: Counting objects: 102877, done. remote: Total 102877 (delta 0), reused 0 (delta 0), pack-reused 102877 Receiving objects: 100% (102877/102877), 130.00 MiB | 75.00 KiB/s, done. Resolving deltas: 100% (79302/79302), done. Checking connectivity... done. Submodule path 'src/qt/qtwebkit': checked out 'e7b74331d695bfa8b77e39cdc50fc2d84a49a22a'
ビルドする。build.py だけだと"Illegal instruction"と言われて失敗。バイナリをダウンロードして起動した時と同じ。
$ python build.py ---------------------------------------- WARNING ---------------------------------------- Building PhantomJS from source takes a very long time, anywhere from 30 minutes to several hours (depending on the machine configuration). It is recommended to use the premade binary packages on supported operating systems. For details, please go the the web site: http://phantomjs.org/download.html. Do you want to continue (Y/n)? Y (snip) ... (snip) make[2]: Entering directory '/home/******************************/phantomjs/src/qt/qtbase/src/widgets' QT_PLUGIN_PATH=/home/******************************/phantomjs/src/qt/qtbase/plugins LD_LIBRARY_PATH=/home/******************************/phantomjs/src/qt/qtbase/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} /home/******************************/phantomjs/src/qt/qtbase/bin/uic dialogs/qfiledialog.ui -o .uic/ui_qfiledialog.h Illegal instruction Makefile:1824: recipe for target '.uic/ui_qfiledialog.h' failed make[2]: *** [.uic/ui_qfiledialog.h] Error 132 make[2]: Leaving directory '/home/******************************/phantomjs/src/qt/qtbase/src/widgets' Makefile:471: recipe for target 'sub-widgets-make_first' failed make[1]: *** [sub-widgets-make_first] Error 2 make[1]: Leaving directory '/home/******************************/phantomjs/src/qt/qtbase/src' Makefile:44: recipe for target 'sub-src-make_first' failed make: *** [sub-src-make_first] Error 2 ERROR: Failed to build PhantomJS! Building Qt Base failed.
build.py -hを見ながらそれっぽいオプションを設定。それでも失敗。
$ python build.py --skip-qtbase ---------------------------------------- WARNING ---------------------------------------- Building PhantomJS from source takes a very long time, anywhere from 30 minutes to several hours (depending on the machine configuration). It is recommended to use the premade binary packages on supported operating systems. For details, please go the the web site: http://phantomjs.org/download.html. Do you want to continue (Y/n)? Y (snip) ... (snip) make[2]: Entering directory '/home/******************************/phantomjs/src/qt/qtwebkit/Source' make[2]: *** No rule to make target '/home/******************************/phantomjs/src/qt/qtbase/lib/libQt5Widgets.a', needed by '/home/******************************/phantomjs/src/qt/qtbase/lib/libQt5WebKitWidgets.a'. Stop. make[2]: Leaving directory '/home/******************************/phantomjs/src/qt/qtwebkit/Source' Makefile.QtWebKit:71: recipe for target 'sub-widgetsapi-pri-make_first-ordered' failed make[1]: *** [sub-widgetsapi-pri-make_first-ordered] Error 2 make[1]: Leaving directory '/home/******************************/phantomjs/src/qt/qtwebkit/Source' Makefile:263: recipe for target 'sub-Source-QtWebKit-pro-make_first-ordered' failed make: *** [sub-Source-QtWebKit-pro-make_first-ordered] Error 2 ERROR: Failed to build PhantomJS! Building Qt WebKit failed.
build.py -hを見ながらそれっぽいオプションを設定。やっぱり失敗。
$ python build.py --skip-qtbase --skip-qtwebkit make[1]: Entering directory '/home/******************************/phantomjs/src' make[1]: *** No rule to make target '/home/******************************/phantomjs/src/qt/qtbase/lib/libQt5WebKitWidgets.a', needed by '../bin/phantomjs'. Stop. make[1]: Leaving directory '/home/******************************/phantomjs/src' Makefile:42: recipe for target 'sub-src-phantomjs-pro-make_first-ordered' failed make: *** [sub-src-phantomjs-pro-make_first-ordered] Error 2 ERROR: Failed to build PhantomJS! Building PhantomJS failed.
git log --show-signature --color --stat --pretty=fuller --date=local 2.1.1..master 的なことをしてログを眺めてみるも、修正されたようなコミットログは見つからず。debian の2.1.1に対する変更履歴を見る。結構いろいろ修正入ってるのでパッチを見るけどやっぱりそれっぽい修正は見つからず。まずはdebian/controlからbuild-dependsヘッダを確認してビルドに必要なものが含まれているか確認。必要そうなものを全部入れてみたけれど、解決せず。debian のバイナリパッケージを入れたほうがいいんじゃないかというきになる。debian/rules を見てコンパイルオプションを確認。--skip-qtbase --skip-qtwebkit をつけるのは先人の知恵と同じ。
# apt-get install libjs-coffeescript libfreetype6-dev libjpeg-dev libpng-dev libsqlite3-dev libssl-dev libz-dev libfontconfig1-dev libx11-dev libxext-dev libqt5webkit5-dev python qt5-qmake qtchooser gtk-vector-screenshot libatk-adaptor xvfb xauth libgl1-mesa-dri
$ git clean -x -d -f Removing Makefile Removing bin/ Removing src/Makefile.phantomjs
カーネルランド: debian jessie amd64、ユーザランド: debian jessie amd64 (minibase + libfontconfig1)
コンパイル済みバイナリをダウンロードして、チェックサムを検証して、展開。
$ wget --quiet 'https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2' $ echo '1c947d57fce2f21ce0b43fe2ed7cd361 phantomjs-2.1.1-linux-x86_64.tar.bz2' | md5sum --check phantomjs-2.1.1-linux-x86_64.tar.bz2: OK $ echo '86dd9a4bf4aee45f1a84c9f61cf1947c1d6dce9b9e8d2a907105da7852460d2f phantomjs-2.1.1-linux-x86_64.tar.bz2' | sha256sum --check phantomjs-2.1.1-linux-x86_64.tar.bz2: OK $ tar xf phantomjs-2.1.1-linux-x86_64.tar.bz2
debootstrap の minibase でサンドボックス環境を作って実行すると失敗。
$ ./phantomjs-2.1.1-linux-x86_64/bin/phantomjs --version ./phantomjs-2.1.1-linux-x86_64/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
libfontconfig.so.1 を提供するパッケージは libfontconfig1 なのでこれをサンドボックス環境にインストール (この点はダウンロードページにも書いてある)。その後に実行すると成功。
# apt-get install libfontconfig1 (snip) $ ./phantomjs-2.1.1-linux-x86_64/bin/phantomjs --version 2.1.1
カーネルランド: debian jessie amd64、ユーザランド: debian jessie i386 (minibase + libfontconfig1)
debootstrap の minibase でサンドボックス環境を作って実行すると失敗。
$ ./phantomjs-2.1.1-linux-i686/bin/phantomjs --version ./phantomjs-2.1.1-linux-i686/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
libfontconfig.so.1 を提供するパッケージは libfontconfig1 なのでこれをサンドボックス環境にインストール (この点はダウンロードページにも書いてある)。その後に実行すると成功。
# apt-get install libfontconfig1 (snip) $ ./phantomjs-2.1.1-linux-i686/bin/phantomjs --version 2.1.1
先の環境でIllegal instructionが出た理由が追い切れないなぁ。