qml-go
qml-go copied to clipboard
Build fails using Qt 5.8
I'm messing with the project for a quite while now, trying to figure out why I got this error when building:
In file included from ./cpp/private/qobject_p.h:2:0,
from /usr/include/qt/QtCore/5.8.0/QtCore/private/qmetaobject_p.h:58,
from ./cpp/private/qmetaobject_p.h:2,
from ./cpp/govalue.h:7,
from ./cpp/capi.cpp:11,
from ./all.cpp:2:
/usr/include/qt/QtCore/5.8.0/QtCore/private/qobject_p.h:55:38: fatal error: QtCore/private/qglobal_p.h: No such file or directory
#include <QtCore/private/qglobal_p.h>
^
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I go it working, after compiling an empty qt project with QT += core-private added to my .pro file i found out that the headers must be included with -isystem:
diff --git a/bridge.go b/bridge.go
index fa11261..1805108 100644
--- a/bridge.go
+++ b/bridge.go
@@ -1,6 +1,7 @@
package qml
// #cgo CPPFLAGS: -I./cpp
+// #cgo CPPFLAGS: -isystem /usr/include/qt/QtCore/5.8.0 -isystem /usr/include/qt/QtCore/5.8.0/QtCore
// #cgo CXXFLAGS: -std=c++0x -pedantic-errors -Wall -fno-strict-aliasing
// #cgo LDFLAGS: -lstdc++
// #cgo pkg-config: Qt5Core Qt5Widgets Qt5Quick
This fixes the problem, but creates the need of specifying include dirs for each qt version.
I had the same problem compiling under Windows mingw64; I fixed adding /mingw64/include/QtCore/5.8.0 to CPATH.
try sudo ln -s /usr/include/qt/QtCore/5.8.0/QtCore/ /usr/include/
I'm getting this error on a Mac, how did you fix it?
Looks like creating a symling like upperxcode mentions is simplest way to go
try sudo ln -s /usr/include/qt/QtCore/5.8.0/QtCore/ /usr/include/
That solution doesn't work, I get the error below:
ln: /usr/include/QtCore: Operation not permitted
I believe this is due to apple's new System Integrity Protection feature, which prevents changes to several core parts of OS X, including most of /usr, even by root. Is there any other way to work around this issue?
on Linux I use sudo to have access to the folders. I do not know how it works on Mac. Another solution would be to set the environment variables in your IDE. Doing this is relatively easy in QtCreator, something like: project.pro . . . INCLUDEPATH += /usr/include/qt/QtSql INCLUDEPATH += /usr/include/qt/QtWidgets INCLUDEPATH += /usr/include/qt/QtPrintSupport
The only disadvantage is that this will only be visible to the concerned IDE
Had this problem on Ubuntu 18.04, but build proceeded for me after I did: sudo apt-get install qtbase5-private-dev.