Building from master on GNU/Linux says QWebSettings has no member WebSecurityEnabled #14737

orangecms opened this Issue Jan 9, 2017 · 5 comments


None yet

2 participants

orangecms commented Jan 9, 2017 edited
  1. Which version of PhantomJS are you using? Tip: run phantomjs --version.

  2. What steps will reproduce the problem?

  • git clone
  • cd phantomjs
  • qmake-qt5 && make
  1. Which operating system are you using?

  2. Did you use binary PhantomJS or did you compile it from source?
    compile from source

  3. Please provide any additional information below.
    I tried building on Arch Linux with QtWebkit 5.7.1 and on Gentoo Linux with QtWebkit 5.6.2. Both attempts resulted in the error webpage.cpp:369:28: error: ‘WebSecurityEnabled’ is not a member of ‘QWebSettings’.
    I found the same message mentioned in but that didn't point me to the issue. I don't get the reference there.
    When I removed the offending line, I can build just fine. But then of course PhantomJS doesn't work as desired and almost all tests fail. =)

Note: qmake-qt5 results from the way Arch Linux handles having Qt4 and Qt5 installed at the same time. On Gentoo Linux I can use qtchooser or set an environment variable to use the right qmake version.

I also read that Qt is deprecating QtWebkit in favor of QtWebEngine, replacing Webkit with Blink. I tried to simply replace the classes, but unfortunately some APIs have changed, including the IPC mechanism, so no luck here. Are you intending to migrate to QtWebEngine anyway?

Vitallium commented Jan 9, 2017 edited

Sorry, but system-installed QtWebKit it not supported in 2.5. You have to use a new QtWebKit (


I cannot find a reference to this WebSecurityEnabled there either. I have downloaded and built (qtwebkit-tp4.tar.xz), and modified the src/ to use it (the path is correct, it uses QWebpage from there etc):

diff --git a/src/ b/src/
index fc94ab74..8b89fbaf 100644
--- a/src/
+++ b/src/
@@ -1,8 +1,13 @@
 TARGET = phantomjs
-QT += network webkitwidgets
+QT += network widgets
 CONFIG += console

+INCLUDEPATH += $$PWD/../../qtwebkit/dist/usr/local/include/
+INCLUDEPATH += $$PWD/../../qtwebkit/dist/usr/local/include/QtWebKit/
+INCLUDEPATH += $$PWD/../../qtwebkit/dist/usr/local/include/QtWebKitWidgets/
+LIBS += -L"../../qtwebkit/dist/usr/local/lib64"
 DESTDIR = ../bin

 RESOURCES = phantomjs.qrc \

The error message:

g++ -c -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DUSE_UTF8 -DSTATIC_BUILD -DQCOMMANDLINE_STATIC -DQ_FONTCONFIGDATABASE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_PLATFORMSUPPORT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I../../qtwebkit/dist/usr/local/include -I../../qtwebkit/dist/usr/local/include/QtWebKit -I../../qtwebkit/dist/usr/local/include/QtWebKitWidgets -Imongoose -Ilinenoise/src -Iqcommandline -Iqt-qpa-platform-plugin -isystem /usr/include/qt -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtPlatformSupport -isystem /usr/include/qt/QtPlatformSupport/5.7.1 -isystem /usr/include/qt/QtPlatformSupport/5.7.1/QtPlatformSupport -isystem /usr/include/qt/QtGui/5.7.1 -isystem /usr/include/qt/QtGui/5.7.1/QtGui -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtCore/5.7.1 -isystem /usr/include/qt/QtCore/5.7.1/QtCore -isystem /usr/include/qt/QtCore -I. -I/usr/lib/qt/mkspecs/linux-g++ -o webpage.o webpage.cpp
webpage.cpp: In constructor ‘WebPage::WebPage(QObject*, const QUrl&)’:
webpage.cpp:369:28: error: ‘WebSecurityEnabled’ is not a member of ‘QWebSettings’
     settings->setAttribute(QWebSettings::WebSecurityEnabled, phantomCfg->webSecurityEnabled());

This attribute is in master, but not in TP4. We have implemented it after TP4. But it will be in TP5.

@Vitallium Vitallium added the Webkit label Jan 17, 2017
@Vitallium Vitallium added this to the Release 2.5 milestone Jan 17, 2017
orangecms commented Jan 20, 2017 edited

Interesting. I checked out qtwebkit-stable. The master branch seems to be webkit without Qt but with GTK+ and other ports instead. Anyway, I got errors on missing references this time.

g++ -Wl,--no-undefined -Wl,-O1 -Wl,-rpath-link,/usr/lib64 -o ../bin/phantomjs callback.o childprocess.o config.o cookiejar.o crashdump.o encoding.o env.o filesystem.o main.o networkaccessmanager.o phantom.o repl.o system.o terminal.o utils.o webpage.o webserver.o mongoose.o linenoise.o utf8.o qcommandline.o phantomintegration.o phantombackingstore.o qrc_phantomjs.o qrc_ghostdriver.o moc_callback.o moc_childprocess.o moc_config.o moc_cookiejar.o moc_env.o moc_filesystem.o moc_networkaccessmanager.o moc_phantom.o moc_repl.o moc_system.o moc_terminal.o moc_webpage.o moc_webserver.o moc_qcommandline.o   -L../../qt-webkit/webkit-qtwebkit-stable/dist/usr/local/lib64 -ldl -L/home/shopco/opensource/phantomjs/src/qt-qpa-platform-plugin/plugins/platforms -lqphantom -lQt5Widgets -lQt5PlatformSupport -lQt5DBus -lgthread-2.0 -pthread -lglib-2.0 -lXrender -lXext -lX11 -lm -ludev -lfontconfig -lfreetype -lQt5Gui -Qt5Network -lQt5Core -lGL -lpthread -lfontconfig -lfreetype
config.o: In function `Config::loadJsonFile(QString const&)':
config.cpp:(.text+0x468f): undefined reference to `QWebPage::QWebPage(QObject*)'
config.cpp:(.text+0x46b8): undefined reference to `QWebPage::mainFrame() const'
config.cpp:(.text+0x46d0): undefined reference to `QWebFrame::addToJavaScriptWindowObject(QString const&, QObject*, QWebFrame::ValueOwnership)'
config.cpp:(.text+0x4714): undefined reference to `QWebPage::mainFrame() const'
config.cpp:(.text+0x4722): undefined reference to `QWebFrame::evaluateJavaScript(QString const&)'

And so forth. Which commit do you build qt-webkit from @Vitallium? What else do I need to do?


Awesome, that was my fault. I didn't specify the libs to include correctly, so the linker didn't have it. Now it works. Kudos and thank you so much @Vitallium! :)

@orangecms orangecms closed this Jan 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment