therecipe/go mod support (was: Non-Deterministic Qt related build failures) #196

Closed
opened 2019-08-08 14:51:15 +00:00 by Wheest · 12 comments

Am trying to build the latest HEAD, however compilation fails. Device is Debian based x86.

Have ensured the qt bindings are the latest version, and built, and have fetched the other dependencies using go get ./....

Compiler output says that it is an issue with cwtch file applets.go, however cwtch itself compiles correctly into a container.

The output from running qtdeploy build desktop:

ERRO[0020] failed to run command                         _func=RunCmd cmd="go build -p 4 -v -ldflags=all=\"-s\" \"-w\" 
...
...
error="exit status 2" name="build for linux on linux"
cwtch.im/cwtch/app
# cwtch.im/cwtch/app
../cwtch/app/applets.go:30:5: acn.SetStatusCallback undefined (type connectivity.ACN has no field or method SetStatusCallback)
Am trying to build the latest [HEAD](https://git.openprivacy.ca/cwtch.im/ui/commit/c6ca6d2567f15db94e10e51f75b18f7364add42e), however compilation fails. Device is Debian based x86. Have ensured the qt bindings are the latest version, and built, and have fetched the other dependencies using `go get ./...`. Compiler output says that it is an issue with cwtch file [applets.go](https://git.openprivacy.ca/cwtch.im/cwtch/src/master/app/applets.go#L30), however cwtch itself compiles correctly into a container. The output from running `qtdeploy build desktop`: ``` ERRO[0020] failed to run command _func=RunCmd cmd="go build -p 4 -v -ldflags=all=\"-s\" \"-w\" ... ... error="exit status 2" name="build for linux on linux" cwtch.im/cwtch/app # cwtch.im/cwtch/app ../cwtch/app/applets.go:30:5: acn.SetStatusCallback undefined (type connectivity.ACN has no field or method SetStatusCallback) ```
Owner

Initial Fix:

SetStatusCallback was added to libricochet-go about a week ago (6517665498) so it looks like you might need to fetch that again.

Longer term fix: the ui ~almost~ supports go modules and if you do this:

GO111MODULE=on
rm go.mod
go mod init
go mod tidy
go mod vendor
rm -rf vendor/github.com/therecipe/
GO111MODLE=off

It should fetch all the actual dependencies (in many cases, because of development, the latest head is not the release that is being depended upon) and allow you to build everything.

Initial Fix: SetStatusCallback was added to libricochet-go about a week ago (https://git.openprivacy.ca/openprivacy/libricochet-go/commit/65176654981a62a5fc15557e3747c4a2ae46b917) so it looks like you might need to fetch that again. Longer term fix: the ui ~almost~ supports go modules and if you do this: GO111MODULE=on rm go.mod go mod init go mod tidy go mod vendor rm -rf vendor/github.com/therecipe/ GO111MODLE=off It should fetch all the actual dependencies (in many cases, because of development, the latest head is not the release that is being depended upon) and allow you to build everything.
Author

Wasn't able to get the module route working, though its not something I'm familiar with.

Ran commands with gocode/src/cwtch.im/ui as my working directory.

However, building ui failed with:

build cwtch.im/ui: cannot load github.com/therecipe/qt: open /home/wheest/gocode/src/cwtch.im/ui/vendor/github.com/therecipe/qt: no such file or directory

Maybe my working directory should be gocode/src? I tried this, however I think I created a state in my Go setup. Removed all created go.mod files, but a restart was needed.

Checked out the speicifc commit of libricochet-go, and moved past the error in OP.

However, building then throws the following error:


 github.com/therecipe/qt/core
core-minimal.cpp:2202:42: error: unknown type name 'Connection'
core-minimal.cpp:2202:29: warning: ISO C++ does not allow indirection on operand of type 'void *' [-Wvoid-ptr-dereference]
core-minimal.cpp:2202:9: error: no matching function for call to 'disconnect'
/home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:344:17: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'const char *' for 1st argument
/home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:347:17: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'const QObject *' for 1st argument
/home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:349:17: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'const QMetaObject::Connection' for 1st argument
/home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:356:24: note: candidate function template not viable: requires 4 arguments, but 1 was provided
/home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:373:24: note: candidate function template not viable: requires 4 arguments, but 1 was provided
/home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:340:17: note: candidate function not viable: requires 4 arguments, but 1 was provided
/home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:342:17: note: candidate function not viable: requires 4 arguments, but 1 was provided

I imagine it's because I'm working with the qt bindings HEAD. Having now read a bit more about what go modules are, I can see why it's useful in this case.

I think that the project root should be where the go modules stuff is run, though am not sure. Reran the module commands with everything fresh, but got the same output as before.

Wasn't able to get the module route working, though its not something I'm familiar with. Ran commands with `gocode/src/cwtch.im/ui` as my working directory. However, building `ui` failed with: `build cwtch.im/ui: cannot load github.com/therecipe/qt: open /home/wheest/gocode/src/cwtch.im/ui/vendor/github.com/therecipe/qt: no such file or directory` Maybe my working directory should be `gocode/src`? I tried this, however I think I created a state in my Go setup. Removed all created `go.mod` files, but a restart was needed. Checked out the speicifc commit of libricochet-go, and moved past the error in OP. However, building then throws the following error: ``` github.com/therecipe/qt/core core-minimal.cpp:2202:42: error: unknown type name 'Connection' core-minimal.cpp:2202:29: warning: ISO C++ does not allow indirection on operand of type 'void *' [-Wvoid-ptr-dereference] core-minimal.cpp:2202:9: error: no matching function for call to 'disconnect' /home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:344:17: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'const char *' for 1st argument /home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:347:17: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'const QObject *' for 1st argument /home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:349:17: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'const QMetaObject::Connection' for 1st argument /home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:356:24: note: candidate function template not viable: requires 4 arguments, but 1 was provided /home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:373:24: note: candidate function template not viable: requires 4 arguments, but 1 was provided /home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:340:17: note: candidate function not viable: requires 4 arguments, but 1 was provided /home/wheest/gocode/src/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtCore/qobject.h:342:17: note: candidate function not viable: requires 4 arguments, but 1 was provided ``` I imagine it's because I'm working with the qt bindings HEAD. Having now read a bit more about what go modules are, I can see why it's useful in this case. I think that the project root should be where the `go modules` stuff is run, though am not sure. Reran the module commands with everything fresh, but got the same output as before.
Owner

Maybe my working directory should be gocode/src?

GO_PATH should point to gocode/ (the directory should have src, bin and pkg in it)

However, building then throws the following error:

Ah! This is good, because I've been getting the same error on my dev environment and we've been struggling to reproduce.

In my case about 1 in every 5-6 build attempts succeeds (the other 4-5 display the error you posted), we believe that there is some non-determinism in the therecipe build process and it is likely building something in the wrong order. If you try running it a few times to see if it succeeds then we can narrow down where this error is coming from.

I've found that you can also run qtdeploy -fast -debug build desktop and successfully compile (because the steps overlap so -fast has everything it needs to build the rest of the go code)

> Maybe my working directory should be gocode/src? GO_PATH should point to `gocode/` (the directory should have src, bin and pkg in it) > However, building then throws the following error: Ah! This is good, because I've been getting the same error on my dev environment and we've been struggling to reproduce. In my case about 1 in every 5-6 build attempts succeeds (the other 4-5 display the error you posted), we believe that there is some non-determinism in the therecipe build process and it is likely building something in the wrong order. If you try running it a few times to see if it succeeds then we can narrow down where this error is coming from. I've found that you can also run `qtdeploy -fast -debug build desktop` and successfully compile (because the steps overlap so -fast has everything it needs to build the rest of the go code)
Author

Aye, can confirm that running qtdeploy build desktop about 4 times worked. Non-determinism!


Me earlier, being a daftie:

I think I created a state in my Go setup. Removed all created go.mod files, but a restart was needed.

I had to run git clean -d -f, and then open a new shell to stop getting the build error:

build cwtch.im/ui: cannot load github.com/therecipe/qt: open /home/wheest/gocode/src/cwtch.im/ui/vendor/github.com/therecipe/qt: no such file or directory


Now that it's build, running the desktop app gets stuck in a log message loop, without the GUI actually launching. This is probably a separate issue however. (none of these onion addresses are private ?)

2019/08/09 18:42:06 tor/BaseOnionService.go [DBUG] Error connecting to sp2ggemclwauqjkgk5xgdhb5jrf6qgdwoxjlb72otzdqjaijt2tj6jid socks connect tcp 127.0.0.1:39505->sp2ggemclwauqjkgk5xgdhb5jrf6qgdwoxjlb72otzdqjaijt2tj6jid.onion:9878: unknown error host unreachable
2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc0000a2600
2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d4a0
2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d5c0
2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d560
2019/08/09 18:42:06 tor/BaseOnionService.go [DBUG] Error connecting to p24aehg66acnuq3u4vxuuldan3bdairwbih7sjppv4qei3rbrgsfdhid socks connect tcp 127.0.0.1:39505->p24aehg66acnuq3u4vxuuldan3bdairwbih7sjppv4qei3rbrgsfdhid.onion:9878: unknown error host unreachable
2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc0000a2600
2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d4a0
2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d5c0
2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d560
2019/08/09 18:42:08 tor/BaseOnionService.go [DBUG] Error connecting to 2ylkvox3mj4twgqd3jddzqyhnxw4zoyvwo5tudcazpa34hsruhstyoad socks connect tcp 127.0.0.1:39505->2ylkvox3mj4twgqd3jddzqyhnxw4zoyvwo5tudcazpa34hsruhstyoad.onion:9878: unknown error host unreachable
2019/08/09 18:42:08 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc0000a2600
2019/08/09 18:42:08 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d4a0
2019/08/09 18:42:08 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d5c0

GO_PATH should point to gocode/ (the directory should have src, bin and pkg in it)

Aye, but I mean when running the go modules commands:

GO111MODULE=on
rm go.mod
go mod init
go mod tidy
go mod vendor
rm -rf vendor/github.com/therecipe/
GO111MODLE=off

This is done with PWD=[...]gocode/src/cwtch.im/ui?


qtdeploy -fast -debug build desktop doesn't work on my system, throwing this permission error:

go build runtime/cgo: open /usr/local/go/pkg/linux_amd64/runtime/cgo.a: permission denied

Aye, can confirm that running `qtdeploy build desktop` about 4 times worked. Non-determinism! ___ Me earlier, being a daftie: > I think I created a state in my Go setup. Removed all created go.mod files, but a restart was needed. I had to run `git clean -d -f`, and then open a new shell to stop getting the build error: `build cwtch.im/ui: cannot load github.com/therecipe/qt: open /home/wheest/gocode/src/cwtch.im/ui/vendor/github.com/therecipe/qt: no such file or directory` ___ Now that it's build, running the desktop app gets stuck in a log message loop, without the GUI actually launching. This is probably a separate issue however. (none of these onion addresses are private ?) ``` 2019/08/09 18:42:06 tor/BaseOnionService.go [DBUG] Error connecting to sp2ggemclwauqjkgk5xgdhb5jrf6qgdwoxjlb72otzdqjaijt2tj6jid socks connect tcp 127.0.0.1:39505->sp2ggemclwauqjkgk5xgdhb5jrf6qgdwoxjlb72otzdqjaijt2tj6jid.onion:9878: unknown error host unreachable 2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc0000a2600 2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d4a0 2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d5c0 2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d560 2019/08/09 18:42:06 tor/BaseOnionService.go [DBUG] Error connecting to p24aehg66acnuq3u4vxuuldan3bdairwbih7sjppv4qei3rbrgsfdhid socks connect tcp 127.0.0.1:39505->p24aehg66acnuq3u4vxuuldan3bdairwbih7sjppv4qei3rbrgsfdhid.onion:9878: unknown error host unreachable 2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc0000a2600 2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d4a0 2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d5c0 2019/08/09 18:42:06 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d560 2019/08/09 18:42:08 tor/BaseOnionService.go [DBUG] Error connecting to 2ylkvox3mj4twgqd3jddzqyhnxw4zoyvwo5tudcazpa34hsruhstyoad socks connect tcp 127.0.0.1:39505->2ylkvox3mj4twgqd3jddzqyhnxw4zoyvwo5tudcazpa34hsruhstyoad.onion:9878: unknown error host unreachable 2019/08/09 18:42:08 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc0000a2600 2019/08/09 18:42:08 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d4a0 2019/08/09 18:42:08 event/eventmanager.go [DBUG] Sending PeerStateChange to 0xc00012d5c0 ``` ___ > GO_PATH should point to gocode/ (the directory should have src, bin and pkg in it) Aye, but I mean when running the go modules commands: ``` GO111MODULE=on rm go.mod go mod init go mod tidy go mod vendor rm -rf vendor/github.com/therecipe/ GO111MODLE=off ``` This is done with `PWD=[...]gocode/src/cwtch.im/ui`? ___ `qtdeploy -fast -debug build desktop` doesn't work on my system, throwing this permission error: `go build runtime/cgo: open /usr/local/go/pkg/linux_amd64/runtime/cgo.a: permission denied`
Owner

how much RAM do you have on this computer? there is a suspicion that our compilation process may spike RAM at some point causing this failure.

I have 16GB and haven't seen it yet...

how much RAM do you have on this computer? there is a suspicion that our compilation process may spike RAM at some point causing this failure. I have 16GB and haven't seen it yet...
Author

Ditto on 16GB of RAM.

Running this morning, I can now get builds running successfully every time.

Resetting the build using git clean -f -d again, but it could be that isn't sufficient for how this build system creates stuff.

Tried artificially filling up my available memory using stress:

stress --vm-bytes $(awk '/MemAvailable/{printf "%d\n", $2 * 0.95;}' < /proc/meminfo)k --vm-keep -m 1

But builds are still successful (though the console never launches the UI).

Ditto on 16GB of RAM. Running this morning, I can now get builds running successfully every time. Resetting the build using `git clean -f -d` again, but it could be that isn't sufficient for how this build system creates stuff. Tried artificially filling up my available memory using `stress`: `stress --vm-bytes $(awk '/MemAvailable/{printf "%d\n", $2 * 0.95;}' < /proc/meminfo)k --vm-keep -m 1` But builds are still successful (though the console never launches the UI).
Author

Actually, just pulled the new HEAD, and the random Qt related build error occurred. Maybe there is some build caching outside of the source tree?

Memory never goes more than 50% during build.

However, all my cores got 100% utilisation, and building failed 10 times.

Tried killing non-essential processes that are resource hungry, and build worked after 3 attempts.

Actually, just pulled the new [HEAD](https://git.openprivacy.ca/cwtch.im/ui/commit/f029da4c495c4f456c9d2c1f4fc172041a301670), and the random Qt related build error occurred. Maybe there is some build caching outside of the source tree? Memory never goes more than 50% during build. However, all my cores got 100% utilisation, and building failed 10 times. Tried killing non-essential processes that are resource hungry, and build worked after 3 attempts.
Owner

Changed the title of this to reflect the Qt build errors.

Tried artificially filling up my available memory using stress
But builds are still successful (though the console never launches the UI).

Hmm, interesting. That would seem to support the idea that something isn't getting built properly because of memory contention.

Changed the title of this to reflect the Qt build errors. > Tried artificially filling up my available memory using `stress` > But builds are still successful (though the console never launches the UI). Hmm, interesting. That would seem to support the idea that something isn't getting built properly because of memory contention.
Author

Apologies if I was ambiguous. Memory utilisation seemed to be independent of potential for build success.

I think it was CPU utilisation, as the processes I killed to improve chances of successful builds were CPU hungry ones.

Admittedly, I only eyeballed htop, so perhaps there was a super-quick spike.

Regarding the UI launch error, I think it was an independent issue, see how I resolved that in #200.

Apologies if I was ambiguous. Memory utilisation seemed to be independent of potential for build success. I think it was CPU utilisation, as the processes I killed to improve chances of successful builds were CPU hungry ones. Admittedly, I only eyeballed `htop`, so perhaps there was a super-quick spike. Regarding the UI launch error, I think it was an independent issue, see how I resolved that in [#200](https://git.openprivacy.ca/cwtch.im/ui/issues/200).
Owner

So it looks like it's coming from using go modules. we haven't quite cracked using therecipe and go modules yet. my reccomendation is

export GO111MODULES=no
rm -r vendor
go get -d
qtdeploy

that seems to solve the irregularity in build fails for now. we are investigating this upstream

https://github.com/therecipe/qt/issues/932

this is non ideal and a work in progress

So it looks like it's coming from using go modules. we haven't quite cracked using therecipe and go modules yet. my reccomendation is ``` export GO111MODULES=no rm -r vendor go get -d qtdeploy ``` that seems to solve the irregularity in build fails for now. we are investigating this upstream https://github.com/therecipe/qt/issues/932 this is non ideal and a work in progress
Owner

An update on this. Looks like the newest version of therecipe/qt has fixed the bugs that were causing build irregularities (see the discussion here https://github.com/therecipe/qt/issues/932)

I've not seen the issue in a few successive builds now, whereas I was seeing it almost constantly before.

An update on this. Looks like the newest version of therecipe/qt has fixed the bugs that were causing build irregularities (see the discussion here https://github.com/therecipe/qt/issues/932) I've not seen the issue in a few successive builds now, whereas I was seeing it almost constantly before.
Owner

Looks like this has been fixed. Closing.

Looks like this has been fixed. Closing.
sarah closed this issue 2019-08-28 18:25:20 +00:00
This repo is archived. You cannot comment on issues.
No Milestone
No Assignees
3 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cwtch.im/ui#196
No description provided.