therecipe / qt

Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly
GNU Lesser General Public License v3.0
10.5k stars 748 forks source link

BUILD using QT_PKG_CONFIG=true #1257

Open MarkLTZ opened 2 years ago

MarkLTZ commented 2 years ago

Hello,

I'd like to build using Qt system libraries but I have an issue:

[root@DEV01 ~]# pkg-config --cflags --libs Qt5Core
-DQT_CORE_LIB -I/usr/include/qt5/QtCore -I/usr/include/qt5 -lQt5Core 
[root@DEV01 ~]# export GO111MODULE=off
[root@DEV01 ~]# export QT_PKG_CONFIG=true
[root@DEV01 ~]# go get -v github.com/therecipe/env_linux_amd64_512
github.com/therecipe/env_linux_amd64_512 (download)
[root@DEV01 ~]# go get -v github.com/therecipe/qt/cmd/... 
github.com/therecipe/qt (download)
github.com/therecipe/env_linux_amd64_513 (download)
github.com/sirupsen/logrus (download)
get "golang.org/x/sys/unix": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at //golang.org/x/sys/unix?go-get=1
get "golang.org/x/sys/unix": verifying non-authoritative meta tag
golang.org/x/sys (download)
get "golang.org/x/tools/imports": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at //golang.org/x/tools/imports?go-get=1
get "golang.org/x/tools/imports": verifying non-authoritative meta tag
golang.org/x/tools (download)
get "golang.org/x/mod/semver": found meta tag get.metaImport{Prefix:"golang.org/x/mod", VCS:"git", RepoRoot:"https://go.googlesource.com/mod"} at //golang.org/x/mod/semver?go-get=1
get "golang.org/x/mod/semver": verifying non-authoritative meta tag
golang.org/x/mod (download)
get "golang.org/x/mod/module": found meta tag get.metaImport{Prefix:"golang.org/x/mod", VCS:"git", RepoRoot:"https://go.googlesource.com/mod"} at //golang.org/x/mod/module?go-get=1
get "golang.org/x/mod/module": verifying non-authoritative meta tag
get "golang.org/x/xerrors": found meta tag get.metaImport{Prefix:"golang.org/x/xerrors", VCS:"git", RepoRoot:"https://go.googlesource.com/xerrors"} at //golang.org/x/xerrors?go-get=1
golang.org/x/xerrors (download)
[root@DEV01 ~]# $(go env GOPATH)/bin/qtsetup -test=false
INFO[0000] running: 'qtsetup prep'                      
INFO[0000] successfully created qtrcc symlink in your PATH (/usr/local/bin/qtrcc) 
INFO[0000] successfully created qtmoc symlink in your PATH (/usr/local/bin/qtmoc) 
INFO[0000] successfully created qtminimal symlink in your PATH (/usr/local/bin/qtminimal) 
INFO[0000] successfully created qtdeploy symlink in your PATH (/usr/local/bin/qtdeploy) 
INFO[0000] running: 'qtsetup check linux' [docker=false] [vagrant=false] 
INFO[0000] GOOS:                        'linux'         
INFO[0000] GOARCH:                      'amd64'         
INFO[0000] GOVERSION:                   'go1.15.7'      
INFO[0000] GOROOT:                      '/usr/lib/golang' 
INFO[0000] GOPATH:                      '/root/go'      
INFO[0000] GOBIN:                       '/root/go/bin'  
INFO[0000] GOMOD:                       ''              
INFO[0000] QT_HASH:                     'c0c124a5770d357908f16fa57e0aa0ec6ccd3f91' 
INFO[0000] QT_API:                      ''              
INFO[0000] QT_VERSION:                  '5.12.5'        
INFO[0000] QT_DIR:                      '/root/Qt'      
INFO[0000] QT_STUB:                     'false'         
INFO[0000] QT_DEBUG:                    'false'         
INFO[0000] QT_QMAKE_DIR:                ''              
INFO[0000] QT_WEBKIT:                   'false'         
INFO[0000] QT_STATIC:                   'false'         
INFO[0000] QT_GEN_GO:                   'false'         
INFO[0000] QT_GEN_OPENGL:               'false'         
INFO[0000] QT_GEN_QUICK_EXTRAS:         'false'         
INFO[0000] QT_RESOURCES_BIG:            'false'         
INFO[0000] QT_NOT_CACHED:               'false'         
INFO[0000] QT_DISTRO:                   'fedora'        
INFO[0000] QT_PKG_CONFIG:            *  'true'          
INFO[0000] QT_DOC_DIR:                  '/usr/share/doc/qt5' 
INFO[0000] QT_MISC_DIR:                 '/usr/lib64/qt5' 
INFO[0000] running: 'qtsetup generate linux' [docker=false] [vagrant=false] 
INFO[0007] generating full qt/core                      
INFO[0027] generating full qt/androidextras             
INFO[0027] generating full qt/gui                       
INFO[0052] generating full qt/network                   
INFO[0059] generating full qt/xml                       
INFO[0060] generating full qt/dbus                      
INFO[0063] generating full qt/nfc                       
INFO[0064] generating full qt/script                    
INFO[0065] generating full qt/sensors                   
INFO[0071] generating full qt/positioning               
INFO[0072] generating full qt/widgets                   
INFO[0127] generating full qt/sql                       
INFO[0130] generating full qt/qml                       
INFO[0133] generating full qt/websockets                
INFO[0134] generating full qt/xmlpatterns               
INFO[0135] generating full qt/bluetooth                 
INFO[0138] generating full qt/webchannel                
INFO[0139] generating full qt/svg                       
INFO[0140] generating full qt/multimedia                
INFO[0162] generating full qt/quick                     
INFO[0167] generating full qt/help                      
INFO[0172] generating full qt/location                  
INFO[0174] generating full qt/scripttools               
INFO[0174] generating full qt/uitools                   
INFO[0175] generating full qt/webengine                 
INFO[0178] generating full qt/testlib                   
INFO[0178] generating full qt/serialport                
INFO[0179] generating full qt/serialbus                 
INFO[0181] generating full qt/printsupport              
INFO[0184] generating full qt/designer                  
INFO[0189] generating full qt/scxml                     
INFO[0191] generating full qt/gamepad                   
INFO[0192] generating full qt/datavisualization    [GPLv3] 
INFO[0199] generating full qt/charts               [GPLv3] 
INFO[0211] generating full qt/virtualkeyboard      [GPLv3] 
INFO[0213] generating full qt/speech                    
INFO[0214] generating full qt/quickcontrols2            
INFO[0214] generating full qt/sailfish                  
INFO[0214] generating full qt/webview                   
INFO[0214] generating full qt/remoteobjects             
INFO[0217] running: 'qtsetup install linux' [docker=false] [vagrant=false] 
INFO[0217] installing full qt/core                      
github.com/therecipe/qt/core
# github.com/therecipe/qt/core
core.cpp: In function ‘QtCore_PackedString QLocale_ToString3(void*, long int)’:
core.cpp:12678:87: error: call of overloaded ‘toString(long int&)’ is ambiguous
  return ({ QByteArray* teea9c2 = new QByteArray(static_cast<QLocale*>(ptr)->toString(i).toUtf8()); QtCore_PackedString { const_cast<char*>(teea9c2->prepend("WHITESPACE").constData()+10), teea9c2->size()-10, teea9c2 }; });
                                                                                       ^
In file included from /usr/include/qt5/QtCore/qtextstream.h:46,
                 from /usr/include/qt5/QtCore/qdebug.h:49,
                 from /usr/include/qt5/QtMultimedia/qmediaenumdebug.h:54,
                 from /usr/include/qt5/QtMultimedia/qcameraimagecapture.h:48,
                 from /usr/include/qt5/QtMultimedia/QCameraImageCapture:1,
                 from core.cpp:35:
/usr/include/qt5/QtCore/qlocale.h:983:13: note: candidate: ‘QString QLocale::toString(qlonglong) const’
     QString toString(qlonglong i) const;
             ^~~~~~~~
/usr/include/qt5/QtCore/qlocale.h:984:13: note: candidate: ‘QString QLocale::toString(qulonglong) const’
     QString toString(qulonglong i) const;
             ^~~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1101:16: note: candidate: ‘QString QLocale::toString(short int) const’
 inline QString QLocale::toString(short i) const
                ^~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1103:16: note: candidate: ‘QString QLocale::toString(ushort) const’
 inline QString QLocale::toString(ushort i) const
                ^~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1105:16: note: candidate: ‘QString QLocale::toString(int) const’
 inline QString QLocale::toString(int i) const
                ^~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1107:16: note: candidate: ‘QString QLocale::toString(uint) const’
 inline QString QLocale::toString(uint i) const
                ^~~~~~~
/usr/include/qt5/QtCore/qlocale.h:989:13: note: candidate: ‘QString QLocale::toString(double, char, int) const’
     QString toString(double i, char f = 'g', int prec = 6) const;
             ^~~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1109:16: note: candidate: ‘QString QLocale::toString(float, char, int) const’
 inline QString QLocale::toString(float i, char f, int prec) const
                ^~~~~~~
core.cpp: In function ‘QtCore_PackedString QLocale_ToString4(void*, long unsigned int)’:
core.cpp:12683:87: error: call of overloaded ‘toString(long unsigned int&)’ is ambiguous
  return ({ QByteArray* teea9c2 = new QByteArray(static_cast<QLocale*>(ptr)->toString(i).toUtf8()); QtCore_PackedString { const_cast<char*>(teea9c2->prepend("WHITESPACE").constData()+10), teea9c2->size()-10, teea9c2 }; });
                                                                                       ^
In file included from /usr/include/qt5/QtCore/qtextstream.h:46,
                 from /usr/include/qt5/QtCore/qdebug.h:49,
                 from /usr/include/qt5/QtMultimedia/qmediaenumdebug.h:54,
                 from /usr/include/qt5/QtMultimedia/qcameraimagecapture.h:48,
                 from /usr/include/qt5/QtMultimedia/QCameraImageCapture:1,
                 from core.cpp:35:
/usr/include/qt5/QtCore/qlocale.h:983:13: note: candidate: ‘QString QLocale::toString(qlonglong) const’
     QString toString(qlonglong i) const;
             ^~~~~~~~
/usr/include/qt5/QtCore/qlocale.h:984:13: note: candidate: ‘QString QLocale::toString(qulonglong) const’
     QString toString(qulonglong i) const;
             ^~~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1101:16: note: candidate: ‘QString QLocale::toString(short int) const’
 inline QString QLocale::toString(short i) const
                ^~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1103:16: note: candidate: ‘QString QLocale::toString(ushort) const’
 inline QString QLocale::toString(ushort i) const
                ^~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1105:16: note: candidate: ‘QString QLocale::toString(int) const’
 inline QString QLocale::toString(int i) const
                ^~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1107:16: note: candidate: ‘QString QLocale::toString(uint) const’
 inline QString QLocale::toString(uint i) const
                ^~~~~~~
/usr/include/qt5/QtCore/qlocale.h:989:13: note: candidate: ‘QString QLocale::toString(double, char, int) const’
     QString toString(double i, char f = 'g', int prec = 6) const;
             ^~~~~~~~
/usr/include/qt5/QtCore/qlocale.h:1109:16: note: candidate: ‘QString QLocale::toString(float, char, int) const’
 inline QString QLocale::toString(float i, char f, int prec) const
                ^~~~~~~

ERRO[0321] failed to install 'core'; aborting setup     

Could you please help me? Thanks

MarkLTZ commented 2 years ago

[root@DEV01 ~]# cat /etc/redhat-release CentOS Linux release 8.4.2105

MarkLTZ commented 2 years ago

I solved the issue passing qt-api

$(go env GOPATH)/bin/qtsetup -test=false -qt_api="5.12.0"

But I still have and issue during compilation:

....
webengine.cpp: In function ‘void QWebEngineProfile_DestroyedUrlSchemeHandlerDefault(void*, void*)’:
webengine.cpp:2440:60: error: ‘class QWebEngineProfile’ has no member named ‘destroyedUrlSchemeHandler’; did you mean ‘removeUrlSchemeHandler’?
   static_cast<QWebEngineProfile*>(ptr)->QWebEngineProfile::destroyedUrlSchemeHandler(static_cast<QWebEngineUrlSchemeHandler*>(obj));
                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~
                                                            removeUrlSchemeHandler
....
WARN[0307] failed to install:
WARN[0307] webengine

Could you please fix this issue while compiling with "QT_PKG_CONFIG=true"?

Thanks