・2017/10/20
Raspberry Pi Raspbian Stretchで PhantomJS 2.1.1をビルドする方法、OpenSSL 1.1の罠
(ラズパイに Phantom.js 2.1.1の最新版をコンパイルしてインストールして Webサイトをスクレイピング)
Tags: [Raspberry Pi], [電子工作]
● Raspberry Pi 3 Model Bを遂に購入
Raspberry Pi3 Model B RPI2 RPI3
大人気の CPUボードの Raspberry Piに WiFiと Bluetoothが搭載されたモデルが新発売となりました。
以前から Raspberry Pi 2を買おうかどうか迷っていましたが、Raspberry Pi 3 Model Bの発売を機に購入を決意してラズベリアンになる事にしました。
※ ラズパイの OS Raspbianはバージョンが上がる毎に過去の版と OSの内部の作りが変わり、過去に書かれた製作記事(例えば Raspbian Wheezyの時代の記事)がそのままではエラーが出たりして動かない事が有ります。
※ 当方のホームページのラズパイ記事は全て Raspberry Pi 3 Model Bと Raspbian Jessieの組み合わせで動作確認をしております。
(ただし、将来的に新しい Raspbian OSが出た場合に、当方の Raspbian Jessieを基にした内容がそのままでは動かない可能性が有ります。)
※ 2017/08/16から Raspbian OSは Raspbian Jessieから Raspbian Stretchに変わりました。
※ 2019/06/20から Raspbian OSは Raspbian Stretchから Raspbian Busterに変わりました。
Download Raspbian for Raspberry Pi
ちなみに、歴代のバージョンと名称は
Debian | コードネーム | 年月 | 備考 | (参考)Ubuntuでの該当名称 |
Debian 11 | Bullseye | 2021/08/14~ | 2021/11からラズパイにリリース | Focal Fossa 20.04 LTS ? |
Debian 10 | Buster | 2019/06/20~ | 2019/06からラズパイ4対応 | Bionic 18.04 LTS |
Debian 9 | Stretch | 2017/08/16~ | 2018/03からラズパイ3B+対応 | Xenial 16.04 LTS |
Debian 8 | Jessie | 2015~ | 2016/02からラズパイ3対応 | Trusty 14.04 LTS |
Debian 7 | Wheezy | 2013~2016 | | |
Debian 6.0 | Squeeze | 2011~2014 | | |
Debian GNU/Linux 5.0 | Lenny | 2009~2012 | | |
● PhantomJS 2.1.1
スクレイピングやら Webの自動巡回やらが可能。JavaScriptで記述する。
PhantomJS
PhantomJS is a headless WebKit scriptable with a JavaScript API.
It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
● PhantomJS関連アプリ
SlimerJS - A scriptable browser for Web developers
npm install slimerjs
/home/pi
└── slimerjs@0.10.3
CasperJS - Navigation scripting & testing for PhantomJS and SlimerJS
npm install casperjs
/home/pi
└── casperjs@1.1.4
● PhantomJS 2.1.1のビルドが面倒な人用にバイナリをアップロードしました。
Raspberry Piで動く PhantomJS 2.1.1のバイナリを GitHubにアップロードしました。面倒なコンパイルが不要で、すぐに PhantomJSを動作させる事ができます。
FREEWING-JP/phantomjs - PhantomJS 2.1.1 for Raspberry Pi
詳しくは下記にまとめました。
・2017/10/20
Raspbianで最新版の Phantom.js 2.1.1のビルド済みバイナリを導入して速攻で簡単に動かす方法
ラズパイで PhantomJS 2.1.1のバイナリをインストールする方法、ビルド不要で簡単導入
● Raspberry Pi 3の Raspbian Stretchで PhantomJS 2.1.1をビルドする方法
このページの内容は 2017年 9月版 Raspbian Stretchで動作を確認しています。
$ uname -a
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.1 (stretch)
Release: 9.1
Codename: stretch
● PhantomJS 2.1.1をビルドするには SDカード容量が 16GB以上の物が必要
SDカード容量が 8GBの場合は最初のソースリストのダウンロード時に「ディスクフル」で駄目です。
SDカードのオススメはこちら。
Raspberry Piで安定して使える相性の無い microSDカードのまとめ
・2016/09/10
Raspberry Pi 3で安定して使える相性の無い最適な microSDカードの種類のまとめ
ラズパイ3で安定して使える microSDカードを購入する Teamと SanDiskは絶対に買わない
● Raspbianと OpenSSLのバージョンの関係
Raspbian Jessie = OpenSSL 1.0.1t、3 May 2016
Debian jessie - パッケージ: openssl (1.0.1t-1+deb8u6)
パッケージ: libssl1.0.0 (1.0.1t-1+deb8u6)
Raspbian Stretch = OpenSSL 1.1.0f、25 May 2017
Debian stretch - パッケージ: openssl (1.1.0f-3)
パッケージ: libssl1.1 (1.1.0f-3)
ソースパッケージ: openssl1.0 (1.0.2l-2)
※ PhantomJSのコンパイルには OpenSSL 1.0.2以下が必要です。
※ OpenSSLの 1.0.2までと 1.1以降とは中身がかなり違うので Raspbian Stretch = OpenSSL 1.1.0fの場合は通常の手順ではビルドできません。
※ PhantomJS以外のアプリでも OpenSSL 1.1.0の非互換性により「ビルドができない」問題が有ります。
● How to build PhantomJS 2.1.1 on Raspberry Pi 3 with Raspbian Jessie 2017-07
How to build PhantomJS 2.1.1 on Raspberry Pi 3 with Raspbian Jessie 2017-07
ラズパイ3の Raspbian JessieでPhantomJS 2.1.1をソースファイルからビルドする方法。
・2017/10/20
Raspberry Pi Raspbian Jessieで PhantomJS 2.1.1をビルドする方法、OpenSSL 1.0.1t
ラズパイに Phantom.js 2.1.1の最新版をコンパイルしてインストールして Webサイトをスクレイピング
● How to build PhantomJS 2.1.1 on Raspberry Pi 3 with Raspbian Stretch 2017-09
Raspbian Stretch = OpenSSL 1.1.0f 25 May 2017
ラズパイ3の Raspbian StretchでPhantomJS 2.1.1をソースファイルからビルドする方法
Phantom JSのビルド手順
※最新の Raspbian Stretch版でもビルドができました。
free -h
# total used free shared buff/cache available
# Mem: 927M 94M 638M 25M 195M 758M
# Swap: 99M 0B 99M
# ラズパイの仮想メモリの SWAP領域を 2GBに広げる
sudo sed -i -e "s/^CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/g" /etc/dphys-swapfile
cat /etc/dphys-swapfile | grep CONF_SWAPSIZE
sudo service dphys-swapfile restart
# VRAMのサイズを 64MBから 16MBに減らす
sudo bash -c "echo gpu_mem=16>> /boot/config.txt"
sudo sed -i -e "s/^gpu_mem=.*/gpu_mem=16/g" /boot/config.txt
# ラズパイの X Window Systemを無効化してメモリ使用量を減らす
sudo systemctl set-default multi-user.target
systemctl list-units | grep lightdm
sudo systemctl disable lightdm
# 緑色の ACT LEDの動作がハートビート(心臓の鼓動)になり一定間隔で点滅する。
# ハングした場合は点滅しなくなるので考えているのかハングしているのかの区別がつく。
sudo bash -c "echo dtparam=act_led_trigger=heartbeat >> /boot/config.txt"
# 再起動で設定を反映させる
sudo reboot
● PhantomJSのビルドに必要な依存関係のあるライブラリを apt-getでインストールする
#---
free -h
# total used free shared buff/cache available
# Mem: 976M 31M 754M 12M 190M 884M
# Swap: 2.0G 0B 2.0G
openssl version
# OpenSSL 1.1.0f 25 May 2017
apt-cache search libssl
# お決まりの手順
sudo apt-get update
# Raspberry Pi 3 BCM2837 ARM Cortex A53 ARMv8 - armhf ARM hard-float ハードウェア浮動小数演算 FPU
# https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837/README.md
# armhf
# libssl1.1.0 -> libssl1.0.2
# https://packages.debian.org/stretch/libssl1.0.2
# /usr/lib/arm-linux-gnueabihf/libssl.so.1.0.2
# libssl-dev -> libssl1.0-dev
# https://packages.debian.org/stretch/libssl1.0-dev
# /usr/include/openssl/opensslv.h
# define OPENSSL_VERSION_NUMBER 0x100020cfL
# define SHLIB_VERSION_NUMBER "1.0.2"
# apt-getする時に明示的に libssl1.0.2と libssl1.0-devを指定します。
sudo apt-get -y install wget git build-essential g++ flex bison gperf ruby perl libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl1.0-dev libssl1.0.2 libpng-dev libjpeg-dev
● Gitから PhantomJSのソースファイルを取得(その1 通常フル版)
cd
git clone git://github.com/ariya/phantomjs.git -b master --single-branch --depth=1
cd phantomjs
# https://github.com/ariya/phantomjs/releases
git fetch origin 1.4:refs/remotes/origin/1.4
git fetch origin 1.6.0:refs/remotes/origin/1.6.0
git fetch origin 1.9.0:refs/remotes/origin/1.9.0
# ハングするので細切れ追加(それでも止まりましたが、何回かやり直しました)
git fetch origin 1.9.6:refs/remotes/origin/1.9.6
git fetch origin 1.9.8:refs/remotes/origin/1.9.8
git fetch origin 2.0.0:refs/remotes/origin/2.0.0
git fetch origin 2.1.0:refs/remotes/origin/2.1.0
git fetch origin 2.1.1:refs/remotes/origin/2.1.1
● Gitから PhantomJSのソースファイルを取得(その2 時間短縮版)
cd
git clone git://github.com/ariya/phantomjs.git -b 2.1.1 --single-branch --depth=1
cd phantomjs
●以下は共通手順
git checkout 2.1.1
git fetch
git submodule init
git submodule update
● PhantomJSを build.pyでビルドする
date >BUILD_START
time python ./build.py -c --jobs 2
date >BUILD_END
cat BUILD_START
cat BUILD_END
# SWAP領域を 100MBに戻す
sudo sed -i -e "s/^CONF_SWAPSIZE=.*/CONF_SWAPSIZE=100/g" /etc/dphys-swapfile
※最新の Raspbian Stretch版でもビルドができました。
Jessieとの違いは apt-getする時に明示的に libssl1.0.2と libssl1.0-devを指定します。
● --jobs 2で無事にビルド完了
261分の 4時間 21分で完了しました。
make[1]: Leaving directory '/home/pi/phantomjs/src'
real 261m31.827s
user 477m13.530s
sys 19m27.570s
pi@raspberrypi:~/phantomjs $ date >BUILD_END
pi@raspberrypi:~/phantomjs $ cat BUILD_START
Tue 31 Oct 15:14:30 UTC 2017
pi@raspberrypi:~/phantomjs $ cat BUILD_END
Tue 31 Oct 19:36:01 UTC 2017
pi@raspberrypi:~/phantomjs $
pi@raspberrypi:~/phantomjs $ free -h
total used free shared buff/cache available
Mem: 976M 24M 553M 448K 399M 896M
Swap: 2.0G 25M 2.0G
pi@raspberrypi:~/phantomjs $ ls -l ./bin/phantomjs
-rwxr-xr-x 1 pi pi 50179436 Oct 31 19:36 ./bin/phantomjs
pi@raspberrypi:~/phantomjs $ ./bin/phantomjs -v
2.1.1
● Raspberry Pi 3 Model B+の場合
228分
make[1]: Leaving directory '/home/pi/phantomjs/src'
real 228m48.390s
user 418m31.150s
sys 16m24.650s
pi@raspberrypi:~/phantomjs $ date >BUILD_END
pi@raspberrypi:~/phantomjs $ cat BUILD_START
Fri 23 Mar 13:06:34 UTC 2018
pi@raspberrypi:~/phantomjs $ cat BUILD_END
Fri 23 Mar 16:55:22 UTC 2018
pi@raspberrypi:~/phantomjs $ ls -l ./bin/
total 49004
-rwxr-xr-x 1 pi pi 50179444 Mar 23 16:55 phantomjs
pi@raspberrypi:~/phantomjs $ free -h
total used free shared buff/cache available
Mem: 976M 24M 572M 508K 379M 895M
Swap: 2.0G 36M 2.0G
pi@raspberrypi:~/phantomjs $ uname -a
Linux raspberrypi 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux
● Raspberry Pi 3 Model B+で --jobs 3で 3コアでビルドした場合
206分
make[1]: Leaving directory '/home/pi/phantomjs/src'
real 206m49.091s
user 464m57.010s
sys 19m4.150s
pi@raspberrypi:~/phantomjs $ date >BUILD_END
pi@raspberrypi:~/phantomjs $ cat BUILD_START
Fri 23 Mar 21:11:01 UTC 2018
pi@raspberrypi:~/phantomjs $ cat BUILD_END
Sat 24 Mar 00:37:50 UTC 2018
pi@raspberrypi:~/phantomjs $ uname -a
Linux raspberrypi 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux
● PhantomJSで Web画面をキャプチャする JavaScriptのサンプル
PhantomJS Screen Capture
github.js
var page = require('webpage').create();
page.open('https://github.com/', function() {
page.render('github.png');
phantom.exit();
});
./phantomjs github.js
ReferenceError: Can't find variable: Promise
https://assets-cdn.github.com/assets/frameworks-2c7ebd50a82ff30d2d8aa46dcc8b3fa389884c97ba59a7a1b819e7f8d1d0c631.js:1 in o
ReferenceError: Can't find variable: Promise
https://assets-cdn.github.com/assets/frameworks-2c7ebd50a82ff30d2d8aa46dcc8b3fa389884c97ba59a7a1b819e7f8d1d0c631.js:1 in o
PhantomJSでキャプチャした Web画像
・github.png、PhantomJSでキャプチャした Web画像
※ 減色、リサイズ、トリミングをしています。元画像は 360KB 1304x6880dot 24bit
● PhantomJSで Web画面をキャプチャする JavaScriptのサンプル2
画像の読み込みにサーバ負荷軽減用の処理をホームページ側に JavaScriptで入れているので 8秒待ってからキャプチャをします。(いわゆる Lazy Load処理)
でも、PhantomJS側にスクロールの処理が入っていないので画像(コンテンツのアイコン画像)が表示されません。。。
freewing_web_8s.js
var page = require('webpage').create();
page.open('http://www.neko.ne.jp/~freewing/', function(status) {
setTimeout(function() {
if (status === "success") {
page.render('freewing_web_8s.png');
}
phantom.exit();
}, 8000);
});
freewing_web_8s.png、PhantomJSでキャプチャした Web画像(キャプチャ状態のままだと超長いのでトリミングしました。クリックで画像を表示)
● window.scrollTo(x, y);
● window.scrollBy(dx, dy);
window.scrollTo(x, y); の JavaScript関数でスクロールをする方法
この処理を入れたらコンテンツのアイコン画像が正常に表示される様になりました。
How to scroll down with Phantomjs to load dynamic content
./phantomjs freewing_web_lazy.js
freewing_web_lazy.js
var page = require('webpage').create();
page.open('http://www.neko.ne.jp/~freewing/', function () {
var count = 0;
window.setInterval(function() {
if (++count < 5) {
page.evaluate(function() {
window.document.body.scrollTop = document.body.scrollHeight;
});
}
else {
page.render('freewing_web_lazy.png');
phantom.exit();
}
}, 1000);
});
freewing_web_lazy.png、PhantomJSでキャプチャした Web画像(キャプチャ状態のままだと超長いのでトリミングしました。クリックで画像を表示)
● --jobs 4で 4コアでコンパイルのしてみるテスト
239分の 約4時間で完了しました。
※ SWAPが発生する状況では 2コア以上のビルドは劇的な効果が無い感じです。
make[1]: Leaving directory '/home/pi/phantomjs/src'
real 239m44.367s
user 618m57.690s
sys 27m11.930s
pi@raspberrypi:~/phantomjs $ date >BUILD_END
pi@raspberrypi:~/phantomjs $ cat BUILD_START
Wed 1 Nov 09:25:22 UTC 2017
pi@raspberrypi:~/phantomjs $ cat BUILD_END
Wed 1 Nov 13:25:07 UTC 2017
pi@raspberrypi:~/phantomjs $ ls -l ./bin/phantomjs
-rwxr-xr-x 1 pi pi 50179436 Nov 1 13:25 ./bin/phantomjs
pi@raspberrypi:~/phantomjs $ ./bin/phantomjs -v
2.1.1
ビルド中の様子
pi@raspberrypi:~ $ top
top - 12:38:46 up 3:33, 3 users, load average: 5.90, 5.62, 5.33
Tasks: 143 total, 1 running, 142 sleeping, 0 stopped, 0 zombie
%Cpu(s): 69.1 us, 3.4 sy, 0.0 ni, 16.5 id, 10.9 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 1000304 total, 29492 free, 934748 used, 36064 buff/cache
KiB Swap: 2097148 total, 718892 free, 1378256 used. 22728 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16517 pi 20 0 8100 3312 2832 R 12.5 0.3 0:00.10 top
16465 pi 20 0 687248 180172 7240 D 6.2 18.0 4:10.83 cc1plus
16421 pi 20 0 556288 276284 7512 D 3.1 27.6 2:36.86 cc1plus
1 root 20 0 27040 3132 2744 S 0.0 0.3 0:02.09 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.21 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:07.99 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:+
7 root 20 0 0 0 0 S 0.0 0.0 0:18.78 rcu_sched
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
9 root rt 0 0 0 0 S 0.0 0.0 0:00.08 migration/0
10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 lru-add-dr+
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/1
13 root rt 0 0 0 0 S 0.0 0.0 0:00.08 migration/1
14 root 20 0 0 0 0 S 0.0 0.0 0:08.41 ksoftirqd/1
16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:+
17 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/2
pi@raspberrypi:~ $ free -h
total used free shared buff/cache available
Mem: 976M 907M 33M 444K 35M 27M
Swap: 2.0G 1.3G 696M
● これより下は Raspbian Stretchで PhantomJS 2.1.1をビルドしようとして悪戦苦戦した記録(ごみメモ)
Raspbian Stretch = OpenSSL 1.1.0f 25 May 2017
ラズパイ3の Raspbian StretchでPhantomJS 2.1.1をソースファイルからビルドする方法??
Removing libssl-dev:armhf (1.1.0f-3) ...
でコンパイルできると思いきや、、、
$ apt-cache search libssl1.0.2
$ apt-cache show libssl1.0.2
pi@raspberrypi:~ $ apt-cache search libssl
cl-plus-ssl - Common Lisp interface to OpenSSL
dcmtk - OFFIS DICOM toolkit command line utilities
dlang-openssl - D version of the C headers for openssl
libdcmtk-dev - OFFIS DICOM toolkit development libraries and headers
libdcmtk8 - OFFIS DICOM toolkit runtime libraries
libssl-dev - Secure Sockets Layer toolkit - development files
libssl-doc - Secure Sockets Layer toolkit - development documentation
libssl-ocaml - OCaml bindings for OpenSSL (runtime)
libssl-ocaml-dev - OCaml bindings for OpenSSL
libssl1.0-dev - Secure Sockets Layer toolkit - development files
libssl1.0.2 - Secure Sockets Layer toolkit - shared libraries
libssl1.1 - Secure Sockets Layer toolkit - shared libraries
perl-openssl-defaults - version compatibility baseline for Perl OpenSSL packages
r-cran-openssl - GNU R toolkit for encryption, signatures and certificates based on OpenSSL
# OpenSSL 1.1.0f -> libssl1.0.2
# libssl-dev -> libssl1.0-dev
sudo apt-get -y install wget git build-essential g++ flex bison gperf ruby perl libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl1.0-dev libssl1.0.2 libpng-dev libjpeg-dev
$ sudo apt-get install libssl1.0.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl1.0.2 is already the newest version (1.0.2l-2).
0 upgraded, 0 newly installed, 0 to remove and 105 not upgraded.
$ sudo apt-get install libssl1.0-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libssl-doc
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
libssl-dev
The following NEW packages will be installed:
libssl1.0-dev
0 upgraded, 1 newly installed, 1 to remove and 105 not upgraded.
Need to get 1,149 kB of archives.
After this operation, 79.9 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian stretch/main armhf libssl1.0-dev armhf 1.0.2l-2 [1,149 kB]
Fetched 1,149 kB in 6s (171 kB/s)
(Reading database ... 126959 files and directories currently installed.)
Removing libssl-dev:armhf (1.1.0f-3) ...
Selecting previously unselected package libssl1.0-dev:armhf.
(Reading database ... 126873 files and directories currently installed.)
Preparing to unpack .../libssl1.0-dev_1.0.2l-2_armhf.deb ...
Unpacking libssl1.0-dev:armhf (1.0.2l-2) ...
Setting up libssl1.0-dev:armhf (1.0.2l-2) ...
● PhantomJSの build.py途中の Qt Configの出力内容
Running configuration tests...
WARNING: Using static linking will disable the WebKit module.
Configure summary
Build type: linux-g++ (arm, CPU features: none detected)
Platform notes:
- Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
Build options:
Configuration .......... accessibility c++11 clock-gettime clock-monotonic compile_examples concurrent enable_new_dtags eventfd full-config getaddrinfo getifaddrs gif harfbuzz iconv icu inotify ipv6ifname jpeg large-config largefile medium-config minimal-config mremap nis openssl-linked pcre png posix_fallocate precompile_header qpa qpa reduce_exports release rpath small-config static system-freetype use_gold_linker zlib
Build parts ............ libs
Mode ................... release
Using sanitizer(s)...... none
Using C++11 ............ yes
Using gold linker....... yes
Using new DTAGS ........ yes
Using PCH .............. yes
Target compiler supports:
Neon ................. no
Qt modules and options:
Qt D-Bus ............... no
Qt Concurrent .......... yes
Qt GUI ................. yes
Qt Widgets ............. yes
Large File ............. yes
QML debugging .......... no
Use system proxies ..... no
Support enabled for:
Accessibility .......... yes
ALSA ................... no
CUPS ................... no
Evdev .................. no
FontConfig ............. no
FreeType ............... yes (system library)
Glib ................... no
GStreamer .............. no
GTK theme .............. no
HarfBuzz ............... yes (bundled copy)
Iconv .................. yes
ICU .................... yes
Image formats:
GIF .................. yes (in QtGui, using bundled copy)
JPEG ................. yes (in QtGui, using bundled copy)
PNG .................. yes (in QtGui, using bundled copy)
journald ............... no
libinput................ no
mtdev .................. no
Networking:
getaddrinfo .......... yes
getifaddrs ........... yes
IPv6 ifname .......... yes
libproxy.............. no
OpenSSL .............. yes (linked to the libraries)
NIS .................... yes
OpenGL / OpenVG:
EGL .................. no
OpenGL ............... no
OpenVG ............... no
PCRE ................... yes (bundled copy)
pkg-config ............. yes
PulseAudio ............. no
QPA backends:
DirectFB ............. no
EGLFS ................ no
EGLFS i.MX6....... . no
EGLFS KMS .......... no
EGLFS Mali ......... no
EGLFS Raspberry Pi . no
EGLFS X11 .......... no
LinuxFB .............. no
XCB .................. no
Session management ..... no
SQL drivers:
DB2 .................. no
InterBase ............ no
MySQL ................ no
OCI .................. no
ODBC ................. no
PostgreSQL ........... no
SQLite 2 ............. no
SQLite ............... yes (plugin, using bundled copy)
TDS .................. no
tslib .................. no
udev ................... no
xkbcommon-x11........... no
xkbcommon-evdev......... no
zlib ................... yes (bundled copy)
WARNING: Using static linking will disable the use of dynamically
loaded plugins. Make sure to import all needed static plugins,
or compile needed modules into the library.
NOTE: When linking against OpenSSL, you can override the default
library names through OPENSSL_LIBS.
For example:
OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked
NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
Configure with '-qreal float' to create a build that is binary compatible with 5.1.
Info: creating cache file /home/pi/phantomjs/src/qt/qtbase/.qmake.cache
Qt is now configured for building. Just run 'make'.
Once everything is built, Qt is installed.
You should not run 'make install'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
building Qt Base, please wait...
Executing in /home/pi/phantomjs/src/qt/qtbase: make -j 1
● PhantomJS 2.1.1を Raspbian Stretchでビルドしようとして苦戦した記録(ごみメモ)
●エラー
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR *__restrict __dirp,
^~~~~~~~~
...Done.
Running configuration tests...
The ICU library support cannot be enabled.
Turn on verbose messaging (-v) to /home/pi/phantomjs/src/qt/qtbase/configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to /home/pi/phantomjs/src/qt/qtbase/configure to continue.
ERROR: Failed to build PhantomJS! Configuration of Qt Base failed.
解決方法
sudo apt-get -y install libicu-dev
sudo apt-get -y install icu-devtools
sudo apt-get -y install sqlite3
●エラー
python ./build.py --jobs 1
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR *__restrict __dirp,
^~~~~~~~~
...Done.
Running configuration tests...
The ICU library support cannot be enabled.
Turn on verbose messaging (-v) to /home/pi/phantomjs/src/qt/qtbase/configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to /home/pi/phantomjs/src/qt/qtbase/configure to continue.
ERROR: Failed to build PhantomJS! Configuration of Qt Base failed.
解決方法
sudo apt-get -y install libicu-dev
sudo apt-get -y install icu-devtools
sudo apt-get -y install sqlite3
●エラー
python ./build.py --jobs 1
Creating qmake...
...Done.
Running configuration tests...
OpenSSL support cannot be enabled due to functionality tests!
Turn on verbose messaging (-v) to /home/pi/phantomjs/src/qt/qtbase/configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to /home/pi/phantomjs/src/qt/qtbase/configure to continue.
ERROR: Failed to build PhantomJS! Configuration of Qt Base failed.
解決方法
# openssl-devel
sudo apt-get -y install openssl
sudo apt-get -y install libssl-dev
●エラー
python ./build.py --jobs 1
/linux-g++ -o .obj/qsslcertificate_openssl.o ssl/qsslcertificate_openssl.cpp
ssl/qsslcertificate_openssl.cpp: In function ‘uint qHash(const QSslCertificate&, uint)’:
ssl/qsslcertificate_openssl.cpp:63:30: error: invalid use of incomplete type ‘X509 {aka struct x509_st}’
return qHashBits(x509->sha1_hash, SHA_DIGEST_LENGTH, seed);
^~
In file included from /usr/include/openssl/crypto.h:31:0,
from /usr/include/openssl/comp.h:16,
from /usr/include/openssl/ssl.h:47,
from ../../include/QtNetwork/5.5.1/QtNetwork/private/../../../../../src/network/ssl/qsslcontext_openssl_p.h:53,
from ../../include/QtNetwork/5.5.1/QtNetwork/private/qsslcontext_openssl_p.h:1,
from ssl/qsslsocket_p.h:55,
from ssl/qsslsocket_openssl_p.h:63,
from ssl/qsslsocket_openssl_symbols_p.h:64,
from ssl/qsslcertificate_openssl.cpp:35:
/usr/include/openssl/ossl_typ.h:93:16: note: forward declaration of ‘EVP_PKEY {aka struct evp_pkey_st}’
typedef struct evp_pkey_st EVP_PKEY;
^~~~~~~~~~~
Makefile:21893: recipe for target '.obj/qsslcertificate_openssl.o' failed
make[2]: *** [.obj/qsslcertificate_openssl.o] Error 1
make[2]: Leaving directory '/home/pi/phantomjs/src/qt/qtbase/src/network'
Makefile:213: recipe for target 'sub-network-make_first' failed
make[1]: *** [sub-network-make_first] Error 2
make[1]: Leaving directory '/home/pi/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.
解決方法
export CFLAGS="-DOPENSSL_API_COMPAT=0x10100000L"
export CXXFLAGS="-DOPENSSL_API_COMPAT=0x10100000L"
cd ./phantomjs/src/qt/qtbase
OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked -opensource -confirm-license
# -nomake examples -nomake tests -static
cd
cd ./phantomjs
python ./build.py --jobs 1
●エラー
python ./build.py --jobs 1
Core -I.moc -I../../mkspecs/linux-g++ -o .obj/qsslcertificate.o ssl/qsslcertificate.cpp
In file included from ssl/qsslsocket_openssl_symbols_p.h:64:0,
from ssl/qsslcertificate.cpp:110:
ssl/qsslsocket_openssl_p.h:95:9: error: ‘_STACK’ does not name a type
typedef _STACK STACK;
^~~~~~
In file included from ssl/qsslcertificate.cpp:110:0:
ssl/qsslsocket_openssl_symbols_p.h:295:14: error: ‘STACK’ was not declared in this scope
int q_sk_num(STACK *a);
^~~~~
Makefile:20348: recipe for target '.obj/qsslcertificate.o' failed
make[2]: *** [.obj/qsslcertificate.o] Error 1
make[2]: Leaving directory '/home/pi/phantomjs/src/qt/qtbase/src/network'
Makefile:213: recipe for target 'sub-network-make_first' failed
make[1]: *** [sub-network-make_first] Error 2
make[1]: Leaving directory '/home/pi/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.
解決方法
わかりません。
下記の設定も駄目だった。
export CFLAGS="-DOPENSSL_API_COMPAT=0x10000000L"
export CXXFLAGS="-DOPENSSL_API_COMPAT=0x10000000L"
openssl/openssl - _STACK
include/openssl/stack.h
Showing the top match Last indexed Oct 25, 2017
53 # if OPENSSL_API_COMPAT < 0x10100000L
54 # define _STACK OPENSSL_STACK
55 # define sk_num OPENSSL_sk_num
56 # define sk_value OPENSSL_sk_value
● OpenSSL 1.1.0 Changes
OpenSSL 1.1.0 Changes
OPENSSL_API_COMPAT
Various functions get deprecated as other interfaces get added, but are still available in a default build.
The include files support setting the OPENSSL_API_COMPAT define that will hide functions that are deprecated in the selected version.
To select the 1.1.0 version use -DOPENSSL_API_COMPAT=0x10100000L.
openssl-compat.tar.gzを使用したビルド可否は未確認。
そもそも、このファイルは OpenSSL 1.0.2ライブラリを OpenSSL 1.1.0に見せかける為のファイルに思えます。
今回欲しいのは OpenSSL 1.1.0ライブラリを OpenSSL 1.0.2に見せかける(互換性を持たせる)様な物です。
Downloads
openssl-compat.tar.gz
- openssl-compat.tar.gz includes sources files openssl-compat.h and openssl-compat.c.
The files provide the OpenSSL 1.1.0 compatibility layer for OpenSSL 1.0.2 and below users.
OpenSSL 1.0.2 users should add openssl-compat.h and openssl-compat.c to their project, and then access data members through the functions.
Tags: [Raspberry Pi], [電子工作]
●関連するコンテンツ(この記事を読んだ人は、次の記事も読んでいます)
FWinSdCardImager SDカード イメージ書き込みアプリ、ラズパイの Raspbian OS、Jetson Nanoの Ubuntuの書き込みに便利
ラズパイや Jetson Nano等のワンボードマイコン等への OSイメージの書き込みが簡単にできる
FWinPiFinder ラズベリーパイ IPアドレス発見アプリ。ARPコマンドでラズパイの IPアドレスを探索発見する
Raspberry Piや NVIDIA Jetson Nano等の IPアドレスを MACアドレスの OUI部分を使用して発見する
Raspberry Pi 3系のトラブルであるある第一位の電源トラブル、低電圧警報に関する情報のまとめ
ラズパイ3B系での低電圧警報に関する情報まとめ、コマンドラインやログファイルから低電圧を検知する方法
Raspberry Piで CPUの脆弱性 Spectreと Meltdownの脆弱性をチェックする方法
ラズパイで 2018年初頭に大騒ぎになったスペクターとメルトダウンの CPUの脆弱性をチェックする方法
Raspberry Pi Zero Wを海外通販の Pimoroni等での購入方法、購入できる通販ショップ一覧まとめ
ラズパイゼロW ワイヤレスモデルを海外通販でサクッと簡単に個人輸入で入手。技適通過でも国内販売は常に品切れ
Raspberry Pi 3で安定して使える相性の無い最適な microSDカードの種類のまとめ
ラズパイ3で安定して使える microSDカードを購入する Teamと SanDiskは絶対に買わない
Raspberry Pi 3 Model Bに専用カメラモジュール RaspiCamを接続する方法
ラズパイに専用カメラモジュールを接続して Raspbianで写真の静止画撮影や動画を録画する方法
Raspberry Pi 3の Linuxコンソール上で使用する各種コマンドまとめ
ラズパイの Raspbian OSのコマンドラインで使用する便利コマンド、負荷試験や CPUシリアル番号の確認方法等も
Raspberry Pi 3公式フォーラムの FAQの内容の日本語訳
ラズパイ公式フォーラムの「The Raspberry Pi 3 Model B Q&A thread」の日本語訳
Raspberry Pi 3で GPIO端子の I2C機能を有効化する方法
ラズパイ3の GPIO端子の I2C機能を有効にして各種センサーを繋げる方法まとめ
大人気の CPUボード、Raspberry Pi 3 Model Bで作ってみよう
Raspberry Piの開発環境の構築やタッチパネル付き液晶ディスプレイや各種センサーの使い方まとめ
Raspberry Pi関連はこちらへまとめました
下記以外にも多数のラズパイ関係の記事が有ります。
(I2C制御、GPIO制御、1-Wire制御、シリアル通信、日本語音声合成、日本語音声認識、中国語音声合成、MeCab 形態素解析エンジン、赤外線リモコン制御、秋月 I2C液晶モジュール、KeDei 3.5インチ液晶、HDMI 5インチ液晶、NFCカードリーダ、コマンドライン操作方法等)
Espressif ESP8266 Arduino互換でスケッチが使える ESP-12Eモジュール基板
Espressif ESP8266 ESP-12-E NodeMCU V1 ESP12 CP2102
BangGood通販はドローン以外にも面白い商品がまだまだ有った(電子工作編)
レーザー彫刻機、カラー液晶の DIYオシロ、Arduinoや Raspberry Pi用の小型カラー液晶
[HOME]
|
[BACK]
リンクフリー(連絡不要、ただしトップページ以外は Web構成の変更で移動する場合があります)
Copyright (c)
2017 FREE WING,Y.Sakamoto
Powered by 猫屋敷工房 & HTML Generator
http://www.neko.ne.jp/~freewing/raspberry_pi/raspberry_pi_3_phantomjs_211_stretch/