Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

PhantomJS 2

Drahakar edited this page Jan 18, 2015 · 33 revisions

The next version, PhantomJS 2, is still in the development. It will be based on Qt 5.

As of May 2014 it is based on webkit 538.1 (7 months old).

Source code

git clone git:/ariya/phantomjs.git
cd phantomjs

Building

Warning: Building PhantomJS 2 from source can take a very long time (~30 minutes with 4 parallel compile jobs).

Linux

First, install the development packages of the following tools and libraries: GNU C++ compiler, bison, flex, gperf, Perl, Ruby, SQLite, FreeType, FontConfig, OpenSSL, and ICU. The actual package names may vary from one distribution to another.

On Debian-based distro (tested on Ubuntu 14.04), just run:

sudo apt-get install g++ flex bison gperf ruby perl \
  libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev \
  libpng-dev libjpeg-dev

Note: It is recommend also to install ttf-mscorefonts-installer package.

On Fedora-based distro (tested on CentOS 6), just run:

sudo yum -y install gcc gcc-c++ make flex bison gperf ruby \
  openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel \
  libpng-devel libjpeg-devel

Then, launch the build:

./build.sh --confirm

NOTE: Using sh, instead of bash explicitly, has been reported to fail on some systems.

Mac OS X

Launch the build:

./build.sh --confirm --qt-config "-I /usr/local/include/ -L /usr/local/lib/"

If build failed with the following message:

make[1]: *** No rule to make target `qt/mkspecs/macx-g++/qmake.conf', needed by `Makefile.phantomjs'.  Stop.
make: *** [sub-src-phantomjs-pro-make_first-ordered] Error 2

try this:

  • make sure you have no system-installed cmake and qmake as phantomjs uses its own (you may need to brew unlink cmake etc)
  • make sure you have no auto-generated Makefiles from previous builds (those failed ones) - like src/Makefile.phantomjs
  • run make clean in order to delete all previously generated files
  • run ./build.sh --confirm

FreeBSD

You will need to edit build.sh:

  • Add OSTYPE=freebsd
  • Change the two make -j$COMPILE_JOBS lines near the end to call gmake instead of make
  • Follow the Linux instructions above

Windows

NOTE: Supported toolchains: MSVC2012 and MSVC2013.

NOTE: You must have Perl, Python, Ruby, and Git on PATH.

Use Visual Studio Command Prompt, run in the top directory. The results will go into bin:

build.cmd

NOTE: That will use MSVC2013 3rdparty libraries. If you want a different version, edit build.cmd, set 3RD_PARTY_LIBRARIES_REPO_BRANCH to point to the branch of https:/Vitallium/phantomjs-3rdparty-win that you want. If you need other versions, please let Vitallium by creating an issue in that repository.

NOTE: git.exe has to be on PATH. If you are using a wrapper (git.cmd, git.bat, etc.) modify build.cmd and replace "git.exe" with whatever you have on the PATH.

To generate a Visual Studio project, run qt\qtbase\bin\qmake -tp vc from the src directory (it will generate a .vcxproj). Make sure your project's INCLUDE/LIBRARY points to {PHANTOMJS_ROOT}\src\qt\3rdparty\{LIBRARY} (for all the libraries [icu, libxml, openssl, ...])

If you wish to visualize QtString values without installing the QtExtension, read this blog post.

NOTE: Enabling incremental linking will make the linkage process faster.

Further Development

We have two development repositories: KDAB and Vitallium's. We're in the process of merge these two repositories into one.

The main goal before we will create a branch for 2 version is make PhantomJS build on all supported platforms: Linux, OS X and Windows. Those repositories can be found at:

Clone this wiki locally