Tuesday, July 5, 2016

Possible Errors during the build process for QtWebKit 5.6 with MSVC 2013

Do not panic when you encounter any of these errors.  Simply follow the steps below to fix the issue and continue the build process by running run nmake && nmake install again (or jom if you are using jom). The build process will continue from where it stopped.

1.  ICU is required Error
This error usually pops up when you run qmake -r CONFIG+=release without proper ICU configuration.


Encountered 2 configuration warning(s):

 ! Qt not configured to use system libjpeg, QImageDecoder will decode JPEG image
s
 ! Qt not configured to use system libpng, QImageDecoder will decode PNG images

The WebKit build was disabled for the following reasons:
    * ICU is required.
    * Missing gperf from PATH
    * Missing bison from PATH

    * Missing flex from PATH











Resolution
Put icu libraries in your environment variables.

SET INCLUDE=C:\icu\include;%INCLUDE%
SET LIB=C:\icu\lib64;%LIB%
For the others, ensure gnuwin32 utilities that come with qt5.6 source are in path.

SET PATH =C:\Qt5.6\gnuwin32\bin;%PATH%




   2.  Flex error 
      You may likely encounter this error if you use a different version of flex other than the one shipped with Qt 5.6 source.


Creating library ..\..\bin\jsc.lib and object ..\..\bin\jsc.exp
        cd Source\ThirdParty\ANGLE\ && ( if not exist Makefile.ANGLE C:\Qt\5.6\m
svc2013_64\bin\qmake.exe C:\qtwebkit\Source\ThirdParty\ANGLE\ANGLE.pro "CONFIG+=
release" -o Makefile.ANGLE ) && "C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\BIN\amd64\nmake.exe" -f Makefile.ANGLE

Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

        ( if not exist Makefile.ANGLE.DerivedSources C:\Qt\5.6\msvc2013_64\bin\q
make.exe C:\qtwebkit\Source\ThirdParty\ANGLE\DerivedSources.pri "CONFIG+=release
" -o Makefile.ANGLE.DerivedSources ) && "C:\Program Files (x86)\Microsoft Visual
 Studio 12.0\VC\BIN\amd64\nmake.exe" -f Makefile.ANGLE.DerivedSources

Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

        flex --noline --nounistd --outfile=generated\glslang_lex.cpp src\compile
r\glslang.l
C:\gnuwin32\bin\flex.EXE: unknown flag '-'.  For usage, try
        C:\gnuwin32\bin\flex.EXE --help
NMAKE : fatal error U1077: 'C:\gnuwin32\bin\flex.EXE' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '(' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.





Resolution

Use the gnuwin32 utilities that come with qt5.6 source.



Possible Errors during the build process for Qt5.6 + QtWebKit with MSVC 2015.

Do not panic when you encounter any of these errors. The good news is that you do not have to start the build process from scratch again with a fresh copy of qt5.6/qtwebkit source. Just follow the steps below to fix the error and run nmake && nmake install again (or jom if you are using jom). The build process will continue from where it stopped.

1. Open SSL Error;

qsslcertificate_openssl.cpp
qsslcontext_openssl.cpp
ssl\qsslcontext_openssl.cpp(473): error C2039: 'tlsext_tick_lifetime_hint': is not a member of 'ssl_session_st'
C:\openssl-win32\include\openssl/ssl.h(423): note: see declaration of 'ssl_session_st'
qsslellipticcurve_openssl.cpp
qsslkey_openssl.cpp
qsslsocket_openssl.cpp
ssl\qsslsocket_openssl.cpp(393): error C2065: 'SSL_CTRL_SET_TLSEXT_HOSTNAME': undeclared identifier
qsslsocket_openssl_symbols.cpp
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'











Resolution
1. tlsext_tick_lifetime_hint is actually a member of ssl_session_st but the section of code is inside a preprocessor directive. Goto your openssl source directory and edit ssl.h. eg.
Edit C:\openssl-win32\include\openssl\ssl.h. Comment out line 478 and 489, save and close.

478//#ifndef OPENSSL_NO_TLSEXT
479            char *tlsext_hostname;
 .               /* RFC4507 info */
 .              unsigned char *tlsext_tick;          /* Session ticket */
 .             size_t    tlsext_ticklen;                   /* Session ticket length */          
 .              long tlsext_tick_lifetime_hint;   /* Session lifetime hint in seconds */

489//#endif




ii. SSL_CTRL_SET_TLSEXT_HOSTNAME is undeclared!
Goto your Qt 5.6 source directory and edit qsslsocket_openssl.cpp. eg.
Edit C:\Qt5.6\qtbase\src\network\ssl\qsslsocket_openssl.cpp and define the variable. e.g


353 bool QSslSocketBackendPrivate::initSslContext()
354 {
355 Q_Q(QSslSocket);
356         #ifndef SSL_CTRL_SET_TLSEXT_HOSTNAME
357         #define SSL_CTRL_SET_TLSEXT_HOSTNAME 55
358         #endif
........
.......}




  




        2. Missing icu dlls; icuuc54.dll and icuin54.dll

call C:\Qt5.6\qtbase\src\widgets\uic_wrapper.bat dialogs\qfiledialog.ui -o .uic\ui_qfiledialog.h
NMAKE : fatal error U1077: 'call' : return code '0xc0000135'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.

NMAKE : fatal error U1077: 'cd' : return code '0x2'



Resolution
Ensure icu is in path.

SET PATH=%PATH%;C:\icu\dist\bin; set INCLUDE=%INCLUDE%;C:\icu\dist\include; set LIB=%LIB%;C:\icu\dist\bin

3. Implicit Conversion

You can check Microsoft page for warning C4334. This warning was treated as error in file skedge.cpp and so it terminated the build process. 



[1838/11974] CXX obj\src\3rdparty\chromium\third_party\skia\src\core\skia_library.SkEdge.obj
FAILED: ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes /FC @obj\src\3rdparty\chromium\third_party\skia\src\core\skia_library.SkEdge.obj.rsp /c c:\qt5.6\qtwebengine\src\3rdparty\chromium\third_party\skia\src\core\SkEdge.cpp /Foobj\src\3rdparty\chromium\third_party\skia\src\core\skia_library.SkEdge.obj /Fdobj\src\3rdparty\chromium\skia\skia_library.cc.pdb
c:\qt5.6\qtwebengine\src\3rdparty\chromium\third_party\skia\src\core\skedge.cpp(231): error C2220: warning treated as error - no 'object' file generated
c:\qt5.6\qtwebengine\src\3rdparty\chromium\third_party\skia\src\core\skedge.cpp(231): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
[1838/11974] CXX obj\src\3rdparty\chromium\third_party\skia\src\core\skia_library.SkFontHost.obj
ninja: build stopped: subcommand failed.
NMAKE : fatal error U1077: 'C:\Qt5.6\qtwebengine\src\3rdparty\ninja\ninja.exe' : return code '0x1'
Stop.

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'



Resolution

Edit line 321 in C:\Qt5.6\qtwebengine\src\3rdparty\chromium\third_party\skia\src\core\SkEdge.cpp. e.g


231 fCurveCount = SkToS8(1i64 << shift);


4. sqlite3 error




qtbase\include\QtGui\5.6.0 -IC:\Qt5.6\qtbase\include\QtGui\5.6.0\QtGui -IC:\Qt5.6\qtmultimedia\include -IC:\Qt5.6\qtmultimedia\include\QtMultimedia -IC:\Qt5.6\qtbase\include -IC:\Qt5.6\qtbase\include\QtGui -IC:\Qt5.6\qtbase\include\QtNetwork -IC:\Qt5.6\qtbase\include\QtSql -IC:\Qt5.6\qtbase\include\QtCore\5.6.0 -IC:\Qt5.6\qtbase\include\QtCore\5.6.0\QtCore -IC:\Qt5.6\qtsensors\include -IC:\Qt5.6\qtsensors\include\QtSensors -IC:\Qt5.6\qtbase\include\QtCore -I.moc\debug -IC:\Qt5.6\qtbase\mkspecs\win32-msvc2015  -Fo.obj\debug\ @C:\Users\Admin\AppData\Local\Temp\nmA076.tmp
SQLiteAuthorizer.cpp
platform\sql\SQLiteAuthorizer.cpp(32): fatal error C1083: Cannot open include file: 'sqlite3.h': No such file or directory
SQLiteDatabase.cpp

platform\sql\SQLiteDatabase.cpp(34): fatal error C1083: Cannot open include file: 'sqlite3.h': No such file or directory






Resolution

Ensure SQLITE3SRCDIR variable is properly set and pointing to the right directory containing all sqlite3 files. Run the command below, assuming your sqllite3 files are in C:\Qt5.6\qtbase\src\3rdparty\sqlite.

SET SQLITE3SRCDIR=C:\Qt5.6\qtbase\src\3rdparty\sqlite


Two Ways To Compile QtWebKit With Qt 5.6 on Windows with Visual Studio


This is my first post outside of PHP SOAP programming tips. I have been working a lot of recent on Qt/C++ applications where I have utilized most of my experience in php soap in building core soap libraries for Qt/C++. This post will focus on compiling QtWebKit for Qt 5.6 which I believe most Qt/C++ programmers will find useful as they transit from Qt 5.5 to Qt 5.6.

Qt WebKit (Qt port of WebKit) was removed from Qt 5.6 in favour of Qt WebEngine. WebEngine is based on Chromium from Google and it seems faster, more dynamic with a robust engine. Chromium also offers lots of great features which Qt can simply use out of the box. The Qt team has tried to ensure that moving from Qt Webkit to Qt WebEngine is as seamless as possible.
However, despite these efforts from Qt team, the following features in QtWebKit are currently not supported in QtWebEngine 5.6:
  1. DOM manipulation through QWebElement APIs
  2. Cross platforms export of HTML to PDF
  3. Using QObject instances in web applications through QObject bridge

In addition, QtWebEngine is not supported on Android, iOS and MinGW.
You can check qt site for a complete list of unsupported features in QtWebEngine.

Based on these unavailable features in QtWebEngine it is close to impossible to port some existing QtWebkit codes to QtWebEngine. Qt page will advise you to stick with Qt5.5 if you really need to use QtWebKit. But then, you will miss out of the new features in Qt5.6. The next option is to compile QtWebKit with Qt5.6.

Compiling QtWebKit with Qt5.6 is very tricky and delicate because the entire build process can fail if you miss a single step. There seems to be no easy tutorial online on how to go about this. But after many days of failed attempts and persistence I finally build Qt5.6 from source with QtWebKit using Visual Studio 2015.

There are two ways you can actually build QtWebkit for Qt5.6 with MSVC.
  1. From both QtWebkit + Qt5.6 source
  2. From QtWebkit source alone with existing Qt5.6 toolkit.
Please find below links on detailed explanations of the possible errors you may encounter during the build process and how to resolve them. 


Wednesday, March 30, 2016

Send SOAP request XML via PHP cURL


At times PHP SOAP can be problematic to work with. This may be due to lack of proper error handling within its internal structure. The SOAP Client class tends to ignore any HTTP error from the server. 

One way to by-pass this limitation with the soap client class is to send the raw soap request XML as http post with PHP cURL. With this, you can see the actual http server response even in situation where the soap client class would have returned nothing.

Enough of the story, let’s see how we can achieve this in practice

Thursday, June 26, 2014

PHP Soap Client Request with SSL Certificate


When required to consume PHP SOAP web services via HTTPS with certificate authentication, we pass our certificate file to the parameter, “local_cert” of the soap client class. In case our certificate and private key are in separate files, we must combine them into one file for this to work.  You can google around on how to create a ‘.pem’ file from a certificate and private key.

The code below is an excerpt from the PHP SOAP Client Example. The point to note here is that we have added the local_cert parameter which contains the value of our certificate file. Most importantly, we have also changed the protocol from http to https for both the wsdl and the soap server location parameters. 

Monday, May 26, 2014

How To Add Header Message To PHP SOAP Client Request

Some web services require header message to be passed along with the body of the soap request. This is often needed for various reasons such as authentication, payment etc. In order to consume such web services successfully, we must define and pass the header element along with the body of the soap request message.

In this tutorial, we will demonstrates how to define and add a SOAP header message to PHP SOAP Client request. You can take a look at the web services we are trying to consume here. A sample request for the method “boom” from the web service is shown below.
From the sample soap request, we noticed that the soap header element, “requestHeader” has two inputs - username and password. We defined these inputs with an associative array. Eg
Next, we used the PHP SoapHeader class to create the soap header by passing it the namespace of the web service (e.g “http://wsdl.example.org/”), the name of the soap header we trying to create (e.g “requestHeader”) and the the soap header inputs defined above (e.g $headerbody).
Finally, we called the __setSoapHeaders($header) method on the soap client object to set the soap header.

See the complete codes below. 


A sample request and response obtained from the above script.

Request:


Response:


Friday, April 4, 2014

How to process Soap header in php SoapServer

To process soap header request in our PHP SOAP Server Example, we will add to our PHP server class, a function with the same name as the header element we are trying to process. Please ensure that you are using the latest version of PHP to avoid any weird behaviour.


See How To Add Header Message To WSDL, on how we created the header element. For this example, our header element is named, requestHeader. So we will create a function  in our server class, with the same name, requestHeader.
The requestHeader element is a complexType with two parameters, which we can process in php as an associative array with two keys.



Our requestHeader function will be called if soap request contains "requestHeader" in SOAP header. For demonstration, we simply stored the requestHeader parameters, username and password, in a private variable, headerInfo, and returned this info back to the client in the boom() function. See the complete server codes below;


The updated client version, on how to add SOAP Header request to PHP SOAP Client, will be available soon.
Related Posts Plugin for WordPress, Blogger...