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.42k stars 744 forks source link

Fails to install (OSX 11.2.3) - hardcoded Qt version? #1227

Open librariusbabble opened 3 years ago

librariusbabble commented 3 years ago

I'm trying to install on an M1 Mac running OSX 11.2.3, but neither command from the installation section works.

If I run this: go get -ldflags="-w" github.com/therecipe/examples/basic/widgets && $(go env GOPATH)/bin/widgets, I get a go error: go.mod:5: require github.com/therecipe/qt/internal/binding/files/docs/5.13.0: version "master" invalid: must be of the form v1.2.3

Meanwhile, if I run export GO111MODULE=off; xcode-select --install; go get -v github.com/therecipe/qt/cmd/... && $(go env GOPATH)/bin/qtsetup test && $(go env GOPATH)/bin/qtsetup -test=false I get the following:

INFO[0000] testing quick/calc                           
ERRO[0000] failed to run command                         _func=RunCmd cmd="/Users/j5/Qt/5.13.0/clang_64/bin/rcc -project -o
 /Users/j5/go/src/github.com/therecipe/qt/internal/examples/quick/calc/rcc.qrc" dir=/Users/j5/go/src/github.com/therecipe
/qt/internal/examples/quick/calc/qml env= error="fork/exec /Users/j5/Qt/5.13.0/clang_64/bin/rcc: no such file or directory" 
name="execute rcc *.qrc on darwin for darwin"

This is failing is because I don't have Qt 5.13.0, I have 6.0.2. Thus it can't find clang in the place it's apparently looking for it.

WildXav commented 3 years ago

You can use another version with export QT_VERSION=6.0.2. And if you have other path errors you can try to fix them by creating symbolink links: ln -s $HOME/Qt6.0.2/6.0.2 $HOME/Qt6.0.2/6.0.

But you'll probably end up getting the following error for some reason:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x5214a6]

goroutine 1 [running]:
github.com/therecipe/qt/internal/binding/parser.(*Class).GetBases(0x0, 0x0, 0x0, 0x9295e0)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/class.go:60 +0x26
github.com/therecipe/qt/internal/binding/parser.(*Class).GetAllBasesRecursiveCheckFailed(0x0, 0x1, 0xc0006500cc, 0x13, 0x92a9a0, 0x7f9c23417d00)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/class.go:82 +0x8b
github.com/therecipe/qt/internal/binding/parser.(*Class).GetAllBases(...)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/class.go:70
github.com/therecipe/qt/internal/binding/parser.(*Function).IsDerivedFromVirtual(0xc00064e780, 0x2c0000000071a300)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/function.go:436 +0xb2
github.com/therecipe/qt/internal/binding/parser.(*Function).fixGeneral_AfterClasses(0xc00064e780)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/function_fix.go:58 +0xa5
github.com/therecipe/qt/internal/binding/parser.(*Class).fixFunctions(0xc000502c60, 0x74cec8)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/class_fix.go:31 +0x52
github.com/therecipe/qt/internal/binding/parser.(*Class).fix(0xc000502c60)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/class_fix.go:26 +0xad
github.com/therecipe/qt/internal/binding/parser.(*Module).Prepare(0xc0000a9d28, 0xa70d5d, 0xa72000)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/module.go:82 +0x100e
github.com/therecipe/qt/internal/binding/parser.LoadModule(0x72bfbb, 0x4, 0x2a, 0xc0001d9180)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/parser.go:70 +0x9f3
github.com/therecipe/qt/internal/binding/parser.LoadModules()
        /home/lowkey/go/src/github.com/therecipe/qt/internal/binding/parser/parser.go:26 +0x6a
github.com/therecipe/qt/internal/cmd/minimal.Minimal(0xc000184050, 0x50, 0x72d2ba, 0x7)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/cmd/minimal/minimal.go:96 +0x19b4
github.com/therecipe/qt/internal/cmd/deploy.Deploy(0xc0000efa30)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/cmd/deploy/deploy.go:116 +0x699
github.com/therecipe/qt/internal/cmd/setup.test(0x72d2ba, 0x7)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/cmd/setup/test.go:110 +0x63b
github.com/therecipe/qt/internal/cmd/setup.Setup(0x7ffe8384384d, 0x4, 0x72d2ba, 0x7)
        /home/lowkey/go/src/github.com/therecipe/qt/internal/cmd/setup/setup.go:25 +0x79
main.main()
        /home/lowkey/go/src/github.com/therecipe/qt/cmd/qtsetup/qtsetup.go:37 +0xe5

And that's where I am. On Arch Linux.

kkharji commented 3 years ago

Similar issue on M1 macs

looking for qtbox in: /Users/tami/.local/share/go/pkg/mod/github.com/therecipe/examples@v0.0.0-20200701200025-1b5d8d146c95/basic/widgets/qtbox
looking for qtbox in: /Users/tami/.local/share/go/bin/qtbox
final qtbox location: /Users/tami/.local/share/go/bin/qtbox
panic: runtime error: integer divide by zero

goroutine 1 [running, locked to thread]:
github.com/therecipe/qt/internal.InitProcess.func2(0x9)
    /Users/tami/.local/share/go/src/github.com/therecipe/qt/internal/internal.go:334 +0xc8
github.com/therecipe/qt/internal.InitProcess.func1(0x1021ae7d8, 0x140003f1a70, 0x10aca2370, 0x140003f19e0, 0x14000113ce8, 0x0, 0x58)
    /Users/tami/.local/share/go/src/github.com/therecipe/qt/internal/internal.go:309 +0x1c8
github.com/therecipe/qt/internal.InitProcess()
    /Users/tami/.local/share/go/src/github.com/therecipe/qt/internal/internal.go:333 +0x5b4
github.com/therecipe/qt/widgets.NewQApplication(0x1, 0x140000121f0, 0x1, 0x1, 0x14000046768)
    /Users/tami/.local/share/go/src/github.com/therecipe/qt/widgets/widgets.go:4921 +0x30
main.main()
    /Users/tami/.local/share/go/src/github.com/therecipe/examples/basic/widgets/main.go:12 +0x54

export GO111MODULE=off; xcode-select --install; go get -v github.com/therecipe/qt/cmd/... && $(go env GOPATH)/bin/qtsetup test && $(go env GOPATH)/bin/qtsetup -test=false I get the following:

INFO[0000] testing quick/calc                           
ERRO[0000] failed to run command                         _func=RunCmd cmd="/Users/j5/Qt/5.13.0/clang_64/bin/rcc -project -o
 /Users/j5/go/src/github.com/therecipe/qt/internal/examples/quick/calc/rcc.qrc" dir=/Users/j5/go/src/github.com/therecipe
/qt/internal/examples/quick/calc/qml env= error="fork/exec /Users/j5/Qt/5.13.0/clang_64/bin/rcc: no such file or directory" 
name="execute rcc *.qrc on darwin for darwin"
kimanikelly commented 3 years ago

Hi everyone I'm also trying to install the QT Go Bindings on an M1 mac and there's been some trouble trying to install it. I see this issue is still open has anyone made any further progress if so I would be grateful to be informed.