qml-go icon indicating copy to clipboard operation
qml-go copied to clipboard

Build fails using Qt 5.8

Open lassade opened this issue 8 years ago • 8 comments

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.

lassade avatar Feb 17 '17 08:02 lassade

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.

lassade avatar Feb 17 '17 09:02 lassade

I had the same problem compiling under Windows mingw64; I fixed adding /mingw64/include/QtCore/5.8.0 to CPATH.

neclepsio avatar Feb 19 '17 07:02 neclepsio

try sudo ln -s /usr/include/qt/QtCore/5.8.0/QtCore/ /usr/include/

upperxcode avatar Mar 23 '17 22:03 upperxcode

I'm getting this error on a Mac, how did you fix it?

ibm-enio avatar May 16 '18 19:05 ibm-enio

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/

lassade avatar May 19 '18 17:05 lassade

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?

ibm-enio avatar May 22 '18 15:05 ibm-enio

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

upperxcode avatar May 23 '18 18:05 upperxcode

Had this problem on Ubuntu 18.04, but build proceeded for me after I did: sudo apt-get install qtbase5-private-dev.

geoffreymantel avatar Apr 15 '19 05:04 geoffreymantel