找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 4007|回复: 0

[openwrt(x86)] 编译glibc版的openwrt使其运行无头浏览器Phantomjs

[复制链接]
发表于 2019-10-14 23:55 | 显示全部楼层 |阅读模式
编译环境搭建:
请自行百度。

无头浏览器Phantomjs是什么,怎么用:
请自行百度。

编译方法如下:
git clone https://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
编译glibc-openwrt需要修改的makefile
package/feeds/packages/fontconfig/makefile
-----------
PKG_VERSION:=2.11.1
改成
PKG_VERSION:=2.13.1
-----------
PKG_HASH:=dc62447533bca844463a3c3fd4083b57c90f18a70506e7a9f4936b5a1e516a99
改成
PKG_HASH:=f655dd2a986d7aa97e052261b36aa67b0a64989496361eca8d604e6414006741
-----------
DEPENDS:=+libpthread +libexpat +libfreetype
改成
DEPENDS:=+libpthread +libexpat +libfreetype +libuuid +libiconv-full +libxml2
-----------
CONFIGURE_ARGS+= \
        --with-cache-dir=/tmp/fontconfig/cache \
        --with-arch=$(ARCH) \
        --disable-iconv \
        --disable-libxml2 \
        --disable-docs
改成
CONFIGURE_ARGS+= \
        --with-cache-dir=/tmp/fontconfig/cache \
        --with-arch=$(ARCH) \
        --disable-docs

-----------


make menuconfig

编译glibc-openwrt的必须选项:
Target System-->x86
Subtarget-->2G内存以下选Generic,4G以上选x86_64
勾选Adcanced configuration options(for devlopers)
勾选Adcanced configuration options(for devlopers)-->Toolchain Options
Adcanced configuration options(for devlopers)-->Toolchain Options-->binutils version-->选binutils 2.31.1
Adcanced configuration options(for devlopers)-->Toolchain Options-->GCC compiler Version-->选gcc 7.x
Adcanced configuration options(for devlopers)-->Toolchain Options-->C Libary implementation-->选Use glibc


Development-->勾选gcc
Development-->gcc-->Libraries-->勾选Include static libc on target、include static libptread on target、include static libstdc++ on target


Xorg-->Font-Utils-->勾选fontconfig

编译glibc-openwrt的可能是必须选项(建议都勾上):
Target Images-->Root filesystem partition size(in MB)-->建议至少200MB
Global build settings-->勾选Compile with full langeuage support
Global build settings-->referred standard C++ library-->选libstdc++

编译glibc-openwrt的可选选项:
Languages-->ython-->python3
Languages-->ython-->python3-pip
Languages-->ython-->python3-requests
Languages-->ython-->python3-setuptools(勾选python3-pip会自动选上)

编译glibc-openwrt的其他选项:
Luci等

make download V=s -j4(编译前先下载,非必选项)(glibc建议直接官网下载,然后自己改名字)

make V=99 -j4(等等等等)
编译完刷固件,怎么刷自行百度。
--------------------------------------------
用putty登陆路由器

selenium安装:
pip3 install selenium==2.48.0
--------------------------------------------
https://phantomjs.org/download.html下载对应版本的Phantomjs,x86-generic选linux32-bit,x86-64选linux64-bit
解压缩
用winscp登录路由器
将解压缩后的文件夹里找到phantomjs(在bin下的)复制到路由器的/usr/bin,并赋予执行权限

-----------------------------------------------------------
phantomjs试运行:
用putty登陆路由器
python3
from selenium import webdriver
driver = webdriver.PhantomJS( service_args=['--ignore-ssl-errors=true'])
driver.get("http://www.baidu.com")
driver.page_source
运行结果:




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
只谈技术、莫论政事!(点击见详情) | 恩山无线论坛欢迎您的来访,请互相尊重、友善交流,建议保持一颗平常心看待网友的评论,切勿过度反应。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-9-23 10:31

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com

快速回复 返回顶部 返回列表