Building PhantomJS 2.0 on Ubuntu 14.04

2,460 views
Skip to first unread message

Robin Shields

unread,
Feb 4, 2015, 12:35:08 PM2/4/15
to phan...@googlegroups.com
I'm trying to build Phantom JS on Ubuntu 14.04 (hosted on Linode) and get the following error:

Building main PhantomJS application...

cd src/ && ( test -e Makefile.phantomjs || /root/phantomjs/src/qt/qtbase/bin/qmake /root/phantomjs/src/phantomjs.pro -o Makefile.phantomjs ) && make -f Makefile.phantomjs
make[1]: Entering directory `/root/phantomjs/src'
Makefile.phantomjs:286: *** multiple target patterns.  Stop.
make[1]: Leaving directory `/root/phantomjs/src'
make: *** [sub-src-phantomjs-pro-make_first-ordered] Error 2


I think the bold line is the problem? I've applied the patch here  https://github.com/ariya/phantomjs/issues/12949 in response to a previous error. Any suggestions very welcome!

Ariya Hidayat

unread,
Feb 5, 2015, 1:35:02 AM2/5/15
to phan...@googlegroups.com
Did you try to build it from the source tarball?

Best regards,

--
You received this message because you are subscribed to the Google Groups "phantomjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phantomjs+...@googlegroups.com.
Visit this group at http://groups.google.com/group/phantomjs.
For more options, visit https://groups.google.com/d/optout.

Hasan Naqvi

unread,
Feb 5, 2015, 5:19:58 AM2/5/15
to phan...@googlegroups.com
Hi !

I used https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-source.zip and got the error written below. I have also tried to use githit code and branch 2.0 but i got the same error.

POSIX iconv enabled.
ICU auto-detection... ()
g++ -c -pipe -DQT_NO_GRAPHICSVIEW -DQT_NO_GRAPHICSEFFECT -DQT_NO_STYLESHEET -DQT_NO_STYLE_CDE -DQT_NO_STYLE_CLEANLOOKS -DQT_NO_STYLE_MOTIF -DQT_NO_STYLE_PLASTIQUE -O2 -Wall -W -fPIE  -I../../../mkspecs/linux-g++ -I. -o icu.o icu.cpp
icu.cpp:42:28: fatal error: unicode/utypes.h: No such file or directory
 #include <unicode/utypes.h>
                            ^
compilation terminated.
make: *** [icu.o] Error 1
ICU disabled.
The ICU library support cannot be enabled.
 Turn on verbose messaging (-v) to /home/hasan/hasan/phantomjs-2.0.0/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/hasan/hasan/phantomjs-2.0.0/src/qt/qtbase/configure to continue.


regards,
/Hasan

Vitaly Slobodin

unread,
Feb 5, 2015, 5:21:59 AM2/5/15
to phan...@googlegroups.com
Hi,

You need to install libicu developer headers.

apt-get install libicu-dev

Robin Shields

unread,
Feb 5, 2015, 7:51:17 AM2/5/15
to phan...@googlegroups.com
Worked with no problems on the try when I used the zipped source download, thank you very much! The tools required to build (on the build page) should probably include make. I would have thought this was standard on Ubuntu, but it wasn't included on the Linode version.

Hasan Naqvi

unread,
Feb 5, 2015, 9:46:35 AM2/5/15
to phan...@googlegroups.com
Hi!

I ended up with another error.

g++ -c -include .pch/Qt5Gui -pipe -O3 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -std=c++0x -fno-exceptions -Wall -W -D_REENTRANT -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_GRAPHICSVIEW -DQT_NO_GRAPHICSEFFECT -DQT_NO_STYLESHEET -DQT_NO_STYLE_CDE -DQT_NO_STYLE_CLEANLOOKS -DQT_NO_STYLE_MOTIF -DQT_NO_STYLE_PLASTIQUE -DQT_NO_USING_NAMESPACE -DQT_BUILD_GUI_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_ENABLE_HARFBUZZ_NG -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB -I../../mkspecs/linux-g++ -I. -I../../include -I../../include/QtGui -I../../include/QtGui/5.3.0 -I../../include/QtGui/5.3.0/QtGui -Iimage -I../3rdparty/harfbuzz-ng/include -I../../include/QtCore/5.3.0 -I../../include/QtCore/5.3.0/QtCore -I../../include/QtCore -I.moc -o .obj/qpnghandler.o image/qpnghandler.cpp
image/qpnghandler.cpp:58:17: fatal error: png.h: No such file or directory
 #include <png.h>
                 ^
compilation terminated.
make[2]: *** [.obj/qpnghandler.o] Error 1
make[2]: Leaving directory `/home/hasan/phantomjs/src/qt/qtbase/src/gui'
make[1]: *** [sub-gui-make_first] Error 2
make[1]: Leaving directory `/home/hasan/phantomjs/src/qt/qtbase/src'
make: *** [sub-src-make_first] Error 2


Regards,
/Hasan

Vitaly Slobodin

unread,
Feb 5, 2015, 9:48:00 AM2/5/15
to phan...@googlegroups.com
Now you need to install libpng headers.
apt-get install libpng-dev

You can find the list with all required packages here: http://phantomjs.org/build.html 

Hasan Naqvi

unread,
Feb 6, 2015, 1:43:35 AM2/6/15
to phan...@googlegroups.com
Thank you Vitaly!

Build is successfull now but phantomjs is not installed. Do I need to do something else other sudo ./build.sh . Or I need to manually configure the phantomjs using /bin/phantomjs ?

Regards,
/Hasan

Berry

unread,
Jul 6, 2015, 5:26:24 AM7/6/15
to phan...@googlegroups.com
why won't you add this to the README.md file?
or wrtite a short "requirements.txt" or "build-instructions.txt" file?

Vitaly Slobodin

unread,
Jul 6, 2015, 5:32:36 AM7/6/15
to phan...@googlegroups.com
Hi,

We have build instructions here - http://phantomjs.org/build.html

Berry

unread,
Jul 6, 2015, 5:41:45 AM7/6/15
to phan...@googlegroups.com
To sum it up, these were the missing libraries I encountered:
  • apt-get install libjpeg-dev
  • apt-get install libpng-dev (apt decided to use libpng12-dev, automatically)
  • apt-get install libicu-dev
(probably others were preinstalled)


On Monday, July 6, 2015 at 12:26:24 PM UTC+3, Berry wrote:

Berry

unread,
Jul 6, 2015, 6:15:48 AM7/6/15
to phan...@googlegroups.com
final summary
  • apt-get flex bison gperf
  • apt-get install libjpeg-dev
  • apt-get install libpng-dev (apt decided to use libpng12-dev, automatically)
  • apt-get install libicu-dev
    funny thing is, i thought i'm compiling a python module, but got a standalone static  54MB binary executable shell.
    Reply all
    Reply to author
    Forward
    0 new messages