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.38k stars 735 forks source link

qtsetup fails #992

Closed Pixdigit closed 4 years ago

Pixdigit commented 4 years ago

When following the install instructions qtsetup complains that some packages can not be found in the vendor directory. However I don't even have a vendor directory. 4641057 seems not to have fixed the problem. GO11MODULES are enabled

therecipe commented 4 years ago

Hey

Did you test the latest version of the binding as well? And could you maybe post some of the error messages?

Pixdigit commented 4 years ago

Isn't the official install the latest version as go clones them with latest:

go: finding github.com/therecipe/qt latest
go: finding github.com/gopherjs/gopherjs latest
go: finding github.com/therecipe/env_darwin_amd64_513 latest
go: finding golang.org/x/tools latest
go: finding github.com/therecipe/env_windows_amd64_513/Tools latest
go: finding github.com/therecipe/env_windows_amd64_513 latest
go: finding github.com/therecipe/qt/internal/binding/files/docs latest
go: finding github.com/therecipe/qt/internal/binding/files/docs/5.12.0 latest
go: finding golang.org/x/sys latest
go: finding github.com/therecipe/env_linux_amd64_513 latest
go: finding golang.org/x/crypto latest
go: finding github.com/therecipe/qt/internal/binding/files/docs/5.13.0 latest

The exact error message is:


ERRO[0000] failed to run command                         _func=RunCmd cmd="go list -mod=vendor -find -e -f {{.Dir}} github.com/therecipe/env_linux_amd64_513" dir=/[projectpath] env=" PATH=[...]$GOPATH/bin[…] GOPATH=/home/[...]/go GO111MODULE=on  _=/home/[…]/go/bin/qtsetup CGO_ENABLED=0" error="exit status 1" name="get env dir"
build github.com/therecipe/env_linux_amd64_513: cannot load github.com/therecipe/env_linux_amd64_513: open /[projectpath]/vendor/github.com/therecipe/env_linux_amd64_513: no such file or directory
Pixdigit commented 4 years ago

Oh nvm found the issue. When using gomodules the instructions in the readme don't work and there are separate instructions for when using GOMODULES.

Pixdigit commented 4 years ago

Still fails with the same error despite using the other commands. the vendor dir still does not contain a qt folder

therecipe commented 4 years ago

Could you maybe try to remove the vendor folder and see if the following works for you?

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_linux_amd64_513.git vendor/github.com/therecipe/env_linux_amd64_513 && $(go env GOPATH)/bin/qtsetup

(You will need to run it from within your projects root dir, and your project should import at least one therecipe/qt pkg such as github.com/therecipe/qt/widgets or any other one)


Later if you projects go.mod already contains a reference to therecipe/qt and you just want to deploy the application without running the setup. You can run something like this instead:

git clone https://github.com/therecipe/examples.git && cd ./examples && go mod download && go install github.com/therecipe/qt/cmd/... && go mod vendor && git clone https://github.com/therecipe/env_linux_amd64_513.git vendor/github.com/therecipe/env_linux_amd64_513 && $(go env GOPATH)/bin/qtdeploy test desktop ./basic/widgets

(Just replace git clone https://github.com/therecipe/examples.git && cd ./examples and ... test desktop ./basic/widgets)

Pixdigit commented 4 years ago

I removed the vendor folder but I still get the same error that there is no qt directory. build github.com/therecipe/qt: cannot load github.com/therecipe/qt: open /[project_location]/vendor/github.com/therecipe/qt: no such file or directory

Pixdigit commented 4 years ago

I do get a lot more logged now: pastebin

Pixdigit commented 4 years ago

I also tried deleting cached/already installed packages in [goroot]/pkg

therecipe commented 4 years ago

I removed the vendor folder but I still get the same error that there is no qt directory.

I suspect this is because you don't explicitly reference github.com/therecipe/qt in you go.mod or import a therecipe/qt pkg somewhere in your code before running go mod vendor

Could you test the following?

git clone https://github.com/therecipe/examples.git && cd ./examples && 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_linux_amd64_513.git vendor/github.com/therecipe/env_linux_amd64_513 && $(go env GOPATH)/bin/qtsetup

This will clone the therecipe/examples repo and then tries to install the binding for that project.

edit: from the log in the pastbin it seems like the issue is the following go: no dependencies to vendor

Can you maybe try to add some example code to your project? Something like this should work: https://github.com/therecipe/examples/blob/master/basic/widgets/main.go

Pixdigit commented 4 years ago

I tested the commands but it now exits with `/[goroot]/go/pkg/mod/github.com/therecipe/qt@v0.0.0-20191019224306-1097424d656c/cmd/env/linux_amd64.go:5:8: no matching versions for query "latest"

I also tried replacing the main by the example code. It appears to be working but I can say more when the set-up is finished. `

Pixdigit commented 4 years ago

Works now as intended. Please close the issue if you think the issue is thereby resolved. However I would change the README to reflect that the install command only works with go modules disabled.

therecipe commented 4 years ago

Yeah you a right, I changed the README with https://github.com/therecipe/qt/commit/6d18dd68e590c9a5c073a2359a91e86bff1b2647 and also updated the wiki entries to reflect that you might need to enable/disable go module support.

Will close this now.