How to build PhantomJS 1.5 for Windows ?

1,478 views
Skip to first unread message

j...@webmaster.ms

unread,
May 3, 2012, 11:58:19 PM5/3/12
to phantomjs
Hi.

I wanted to make some patches in my installation of PhantomJS, but I
have a problem with building PhantomJS.
There is a manual at http://code.google.com/p/phantomjs/wiki/ReleasePreparation
but it seems outdated, because Qt now resides under PhantomJS source
tree.

Can anybody provide me with fresh information on how to build recent
PhantomJS on Windows ?
MinGW or MSVC, does not matter.

Thanks.

Ariya Hidayat

unread,
May 18, 2012, 3:12:52 AM5/18/12
to phan...@googlegroups.com
For Windows build, you may want to check out Alessandro's repo:
https://github.com/aportale/phantomjs.

Unfortunately I didn't have a chance yet to pick all his fixes for the
Windows build. Hopefully before 1.6.


Thank you!

Regards,

--
Ariya Hidayat, http://ariya.ofilabs.com
http://twitter.com/ariyahidayat

pg

unread,
May 28, 2012, 6:05:11 AM5/28/12
to phan...@googlegroups.com
Hi,

I tried to compile imported QT source on windows 7 using Visual Studio 2010

Branch : windows-build

Steps : 
  1. download the sourcecode from mentioned git repository and branch
  2. Install necessary VS2010 patch, SP1 as mentioned in http://briolidz.wordpress.com/2012/03/07/compiling-qt-with-visual-studio-2010/
  3. Install Active Perl
  4. Open VS2010 command prompt and navigate to location <aportale phantomjs code>\src\qt
  5. configure -debug-and-release -opensource -shared -platform win32-msvc2010
  6. nmake
Errors on "configure" command
Unable to find file for inclusion doc\doc.pri
Qmake failed, return code 3
Reading C:/HARDDISK/PHANTOMJS_windows_build/alessandro/phantomjs/src/qt/demos Qmake failed, return code 3

Errors on "nmake" command
Creating library ..\..\lib\QtGui4.lib and object ..\..\lib\QtGui4.exp
mt.exe -nologo -manifest "tmp\obj\release_shared\QtGui.intermediate.manifest" -outputresource:..\..\lib\QtGui4.dll;2
copy /y "..\..\lib\QtGui4.dll" ..\..\bin 1 file(s) copied. cd src\qt3support\ && "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -f Makefile Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1073: don't know how to make 'qt3support.pro' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop.

I am not sure if the build steps I followed are correct, I could not find any discussion with proper build steps.
If there is a link to proper build step, kindly provide the link.

--PG

Ariya Hidayat

unread,
May 28, 2012, 2:34:51 PM5/28/12
to phan...@googlegroups.com
> I am not sure if the build steps I followed are correct, I could not find
> any discussion with proper build steps.
> If there is a link to proper build step, kindly provide the link.

Most likely you didn't follow it correctly, I suggest looking at
Alessandro's commit
https://github.com/aportale/phantomjs/commit/5a4c71b3d and analyze it.

Aries Beltran

unread,
May 30, 2012, 4:32:49 AM5/30/12
to phan...@googlegroups.com
Try using Alessandro's preconfig.cmd to set the proper configure arguments. There are modules needed to skip like qt3support.

Priyanka Gupta

unread,
May 30, 2012, 5:44:12 AM5/30/12
to phan...@googlegroups.com
Yes I figured out that some modules need to be disabled in the QT build, but I read in other discussions that phantomJS windows libraries are generated using mingw (cross compilation env) so I am trying out the same on MAC, will update the results here.
But i was looking for a way to compile and generate the libs/dlls on windows machine itself.

Priyanka Gupta

unread,
Jun 6, 2012, 3:14:58 PM6/6/12
to phan...@googlegroups.com
Finally Built the phantomjs qt source on windows using VS2010.....(without open SSL)

Branch : windows-build
Environment : Visual Studio 2010

STEPS :
  1. Download and install Microsoft Visual Studio 2010 Service Pack 1.
  2. For x64 users, it is recommended to download and install this patch for Visual Studio 2010, if it is not already up-to-date
  3. Install Active Perl
  4. Set up environmental variables
    QTDIR=<phantomjs_srcDir>\src\qt
    QMAKESPEC=win32-msvc2010

  5. Update PATH variable to include %QTDIR%\bin
  6. Modify the <phantomjs_srcDir>\src\qt\preconfig.cmd
    • set QT_CFG=%QT_CFG% -debug-and-release
    • set QT_CFG=%QT_CFG% -platform win32-msvc2010
    • comment OPENSSL related configuration as it has hard-coded path and will not work if you don't have openssl code
  7. Start Visual Studio 2010 Command Prompt:
    Start > Programs > Microsoft Visual Studio 2010 > Visual Studio Tools > Visual Studio Command Prompt.
  8. .\preconfig.cmd
OUTPUT :
  • <phantomjs_srcDir>\src\qt\bin\*
  • <phantomjs_srcDir>\src\qt\lib\*
  • parallel to <phantomjs_srcDir>  
    • JavaScriptCore\release\*
    • WebCore\release\*
But how do we generate phantomjs.exe on windows machine ??

Regards,
PG

Alessandro Portale

unread,
Jun 6, 2012, 4:59:32 PM6/6/12
to phan...@googlegroups.com, phan...@googlegroups.com
Thanks, Your listing of steps is great! I will try to find the time document the steps necessary for OpenSsl, and combine that with your list.

In order to build phantomjs, try
 - cd <phantomjs_srcDir>
 - src\qt\bin\qmake -r
 - nmake

Jamie Black

unread,
Jun 13, 2012, 7:02:46 AM6/13/12
to phan...@googlegroups.com
I have followed the instructions and it seems to have successfully compiled Qt. When I try and execute nmake in the phantamjs_src dir  i get an error as there is no makefie. I'm on windows 7. Any ideas?

j...@webmaster.ms

unread,
Jun 24, 2012, 1:28:18 PM6/24/12
to phantomjs

>
> Thanks, Your listing of steps is great! I will try to find the time document the steps necessary for OpenSsl, and combine that with your list.
>

You do not have to compile OpenSSL, there are pre-compiled libs here:
http://slproweb.com/products/Win32OpenSSL.html
Be sure you use openssl-1.0.0.
It is impossible to link phantomjs against openssl-0.9.8.
As for openssl-1.0.1, it is possible to build phantomjs against it,
but it will not able to connect to some https-sites (https://
www.derwesten.de/, https://www.strato-pro.com/ger/, ...)

Luis Lavena

unread,
Jun 24, 2012, 5:44:38 PM6/24/12
to phan...@googlegroups.com
On Sunday, June 24, 2012 2:28:18 PM UTC-3, j...@webmaster.ms wrote:

>
> Thanks, Your listing of steps is great! I will try to find the time document the steps necessary for OpenSsl, and combine that with your list.
>

You do not have to compile OpenSSL, there are pre-compiled libs here:
http://slproweb.com/products/Win32OpenSSL.html

AFAIK those "installers" will provide a shared library to link to and not static libraries, required to produce standalone PhantomJS executable.

--
Luis Lavena

j...@webmaster.ms

unread,
Jun 25, 2012, 11:00:51 AM6/25/12
to phantomjs
They do have:
<pre>
C:\OpenSSL-Win32-v1.0.0j\lib\VC>dir /S
Volume in drive C has no label.
Volume Serial Number is 1842-54A3

Directory of C:\OpenSSL-Win32-v1.0.0j\lib\VC

06/24/2012 08:23 PM <DIR> .
06/24/2012 08:23 PM <DIR> ..
05/10/2012 08:41 PM 774,718 libeay32MD.lib
05/10/2012 08:53 PM 774,718 libeay32MDd.lib
05/10/2012 08:47 PM 774,718 libeay32MT.lib
05/10/2012 08:59 PM 774,718 libeay32MTd.lib
05/10/2012 08:42 PM 56,830 ssleay32MD.lib
05/10/2012 08:54 PM 56,830 ssleay32MDd.lib
05/10/2012 08:48 PM 56,830 ssleay32MT.lib
05/10/2012 09:00 PM 56,830 ssleay32MTd.lib
06/24/2012 08:23 PM <DIR> static
8 File(s) 3,326,192 bytes

Directory of C:\OpenSSL-Win32-v1.0.0j\lib\VC\static

06/24/2012 08:23 PM <DIR> .
06/24/2012 08:23 PM <DIR> ..
05/10/2012 08:44 PM 19,933,030 libeay32MD.lib
05/10/2012 08:56 PM 19,951,966 libeay32MDd.lib
<b>05/10/2012 08:50 PM 19,933,030 libeay32MT.lib</b>
05/10/2012 09:03 PM 19,933,398 libeay32MTd.lib
05/10/2012 08:45 PM 3,702,912 ssleay32MD.lib
05/10/2012 08:57 PM 3,705,944 ssleay32MDd.lib
<b>05/10/2012 08:51 PM 3,702,912 ssleay32MT.lib</b>
05/10/2012 09:03 PM 3,702,996 ssleay32MTd.lib
8 File(s) 94,566,188 bytes

Total Files Listed:
16 File(s) 97,892,380 bytes
</pre>

Alessandro Portale

unread,
Jun 25, 2012, 12:35:22 PM6/25/12
to phan...@googlegroups.com
That looks indeed promising. The src/qt/preconfig.cmd may have to be adapted to the library names with the "MT". Thanks for the tip.

Andrew Groom

unread,
Dec 17, 2012, 4:31:03 PM12/17/12
to phan...@googlegroups.com
Hi All,

I'm in need of a phantom build with SSL for Windows 7 and I was hoping that someone would have built this already and have a download I could grab from somewhere :-) Any offers? Also, is there a reason why SSL support is not built in by default? Great tool, btw, keep up the good work!

Cheers, Andrew.

James Greene

unread,
Dec 17, 2012, 5:23:17 PM12/17/12
to phan...@googlegroups.com

Andrew:
SSL support is built into PhantomJS 1.8, which will be released on Dec. 21st (winter solstice).
~~James

--
You received this message because you are subscribed to the Google Groups "phantomjs" group.
Visit this group at http://groups.google.com/group/phantomjs?hl=en.
 
 

Andrew Groom

unread,
Dec 17, 2012, 5:49:41 PM12/17/12
to phan...@googlegroups.com
Awesome, thanks James!

Ariya Hidayat

unread,
Dec 18, 2012, 2:39:37 AM12/18/12
to phan...@googlegroups.com
Did you try 1.7.0 Windows binary? If its SSL support failed, can you
share some details? Thanks.
http://gplus.to/ariyahidayat

Anil Kesti

unread,
Mar 24, 2014, 3:04:39 AM3/24/14
to phan...@googlegroups.com
I'm trying  to capture the google map drawn in <div> as a image and want to use that image as a report with pdf and  excel sheets. Is it possible to achieve the same  with PhantomJS? If you are aware of any other technics , please do share with me.

Thanks n regards
Anil Kesti

James Greene

unread,
Mar 24, 2014, 6:51:23 AM3/24/14
to phan...@googlegroups.com

Anil:
Your question has nothing to do with this thread's topic. Please start a new thread.

Sincerely,
    James Greene
    Sent from my [smart?]phone

--
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.
Reply all
Reply to author
Forward
0 new messages