Open zhangxianweihebei opened 5 years ago
Hey
Do you use go modules?
If yes, then maybe checkout: https://github.com/therecipe/qt/wiki/Installation-on-macOS#in-module-mode-more-info-here-such-as-how-to-work-around-the-gfw
You will need to run something like this first
xcode-select --install; go get -u -v github.com/therecipe/qt/cmd/qtsetup && go get -u -v github.com/therecipe/qt/cmd/... && go mod vendor && git clone https://github.com/therecipe/env_darwin_amd64_512.git vendor/github.com/therecipe/env_darwin_amd64_512 && $(go env GOPATH)/bin/qtsetup -test=false
if you already did that, then maybe try to run go run -mod=vendor .
instead (or better use qtdeploy
) to build your application.
Run qtdeploy
with the -debug
flag. From there, find the commands that is used to go build
.
For my case, I have found out that using the flags -mod=vendor -tags=minimal
got rid of the error messages.
So, typically, you would do something like:
go build -mod=vendor -p 8 -v -ldflags=all="-w" -tags="minimal" -x -o <Path/to/package.app/Contents/MacOS/package> main.go
(you can obviously adapt this command to go run ...
but ensure the flags are there)
And the really nice thing about this is that I could integrate this command in my IDE, so, now, compilation is extremely fast, heck, even faster than building the equivalent project on Qt Creator but with all the goodies and nice libraries offered with Go. Of course, this skips all the other steps of qtdeploy
(like RCC files, app shell, etc...)
Unfortunately, DWARF symbols are stripped by qtdeploy
and thus, it is not possible to do debugging. @therecipe could you shed some light on how to build debuggable builds?
I can run $(go env GOPATH)/bin/qtsetup
I tried to run examples-master/test/qml_quick on Mac with an error
Ld-My:qml_quick a1$ ls main.go qml qml_quick_test.go testing_shared.go Ld-My:qml_quick a1$ go run main.go go: finding golang.org/x/net v0.0.0-20190420063019-afa5a82059c6 go: finding golang.org/x/tools v0.0.0-20190420181800-aa740d480789 go: finding golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a go: finding golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 go: finding golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480 go: finding golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a go: finding golang.org/x/text v0.3.0 go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
github.com/therecipe/qt/quickcontrols2
quickcontrols2.cpp:9:10: fatal error: 'QByteArray' file not found
github.com/therecipe/qt/core
core.cpp:9:10: fatal error: 'QAbstractAnimation' file not found Ld-My:qml_quick a1$ pwd /Users/a1/Desktop/examples-master/test/qml_quick