Bug 262808 - net/syncthing 1.19.1 doesn't build
Summary: net/syncthing 1.19.1 doesn't build
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Steve Wills
: 262993 (view as bug list)
Depends on:
Reported: 2022-03-25 17:11 UTC by Oscar Carlsson
Modified: 2022-05-09 09:27 UTC (History)
29 users (show)

See Also:
bugzilla: maintainer-feedback? (swills)

poudriere build log (18.37 KB, text/plain)
2022-03-25 17:11 UTC, Oscar Carlsson
no flags Details
v0 (5.44 KB, patch)
2022-04-06 08:15 UTC, Mikael Urankar
no flags Details | Diff
Upgrade to 1.19.2 (23.15 KB, patch)
2022-04-24 09:21 UTC, Sir l33tname
no flags Details | Diff
syncthing-1.20.0.patch (2.32 KB, patch)
2022-05-04 11:00 UTC, Dmitri Goutnik
dmgk: maintainer-approval?
Details | Diff
Upgrade to 1.20.1 (2.65 KB, patch)
2022-05-07 16:31 UTC, Sir l33tname
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oscar Carlsson 2022-03-25 17:11:20 UTC
Created attachment 232717 [details]
poudriere build log

Tried building syncthing with poudriere (13.0-RELEASE, ports HEAD) today and it breaks. Attached the poudriere log, let me know if anything more is needed.

I know nothing about Go, but this part of the log sticks out for me:

# github.com/marten-seemann/qtls-go1-18
vendor/github.com/marten-seemann/qtls-go1-18/cipher_suites.go:143:43: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/cipher_suites.go:413:45: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/cipher_suites.go:418:46: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/cipher_suites.go:426:45: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/conn.go:177:10: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/conn.go:183:13: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/conn.go:211:62: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/conn.go:973:14: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/conn.go:1056:33: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/common.go:1496:41: undeclared name: any (requires version go1.18 or later)
vendor/github.com/marten-seemann/qtls-go1-18/conn.go:1056:33: too many errors

The thing is, Go is version 1.18:

# pkg search go
go-1.18,1                      Go programming language

Any ideas?
Comment 1 Mikael Urankar freebsd_committer freebsd_triage 2022-03-25 17:31:29 UTC
qtls-go1-18 means it's only compatible with go 1.18
Comment 2 Oscar Carlsson 2022-03-26 06:15:14 UTC
(In reply to Mikael Urankar from comment #1)

Yes, and 1.18 is installed, citing the build log:

=======================<phase: build-depends  >============================
===>   syncthing-1.19.1 depends on file: /usr/local/bin/go - not found
===>   Installing existing package /packages/All/go-1.18,1.pkg
[13_0_release-HEAD-job-01] Installing go-1.18,1...
[13_0_release-HEAD-job-01] Extracting go-1.18,1: .......... done
===>   syncthing-1.19.1 depends on file: /usr/local/bin/go - found
===>   Returning to build of syncthing-1.19.1
Comment 3 wcarson.bugzilla 2022-03-28 16:53:02 UTC
I'm having the same problem on amd64 FreeBSD 13.0-RELEASE-p10.
Comment 4 Steve Wills freebsd_committer freebsd_triage 2022-03-28 21:26:08 UTC
I believe this may be due to the update of lang/go.
Comment 5 Mikael Urankar freebsd_committer freebsd_triage 2022-03-30 12:00:54 UTC
(In reply to Steve Wills from comment #4)
FWIW, it builds fine if we don't use the ports infra.
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2022-04-01 19:55:01 UTC
(In reply to Mikael Urankar from comment #5)
Looks like https://github.com/syncthing/syncthing/releases/download/v1.19.1/syncthing-source-v1.19.1.tar.gz contains a vendor/ dir with prepopulated vendor modules, but it was apparently built with an older go version.

Upstream uses 1.16 as the lowest supported version, so it is likely they populate the vendor dir with it. If you don't use -mod=vendor during the build, go will automagically update the vendor dir, but it'll probably download files from the internet, which likely isn't what you want.

I'm unsure what the right way is to fix it. The go module system is incomprehensible to me :)
Comment 7 Dimitry Andric freebsd_committer freebsd_triage 2022-04-02 08:59:41 UTC
*** Bug 262993 has been marked as a duplicate of this bug. ***
Comment 8 Mikael Urankar freebsd_committer freebsd_triage 2022-04-02 13:55:34 UTC
(In reply to Dimitry Andric from comment #6)
I've tried to use GO_MODULE and gomod-vendor to not avail. It always fails if the vendor dir is populated.
Comment 9 Mikael Urankar freebsd_committer freebsd_triage 2022-04-05 14:17:19 UTC
Can we use go 1.17 until this issue is sorted out?
Comment 10 Dimitry Andric freebsd_committer freebsd_triage 2022-04-05 14:27:54 UTC
(In reply to Mikael Urankar from comment #9)
Since syncthing's own mod files refer to go 1.16, did you check that go 1.17 can build it without the same type of 'outdated module' error? Specifically, inside a poudriere jail where it can't access internet? :)
Comment 11 Denis Shaposhnikov 2022-04-05 14:41:11 UTC
(In reply to Dimitry Andric from comment #10)

But before lang/go was upgraded to 1.18, syncthing was building with go 1.17. Why do we need to check it?
Comment 12 Dimitry Andric freebsd_committer freebsd_triage 2022-04-05 15:01:01 UTC
(In reply to Denis Shaposhnikov from comment #11)
Ah sorry, I wasn't aware that the previous go version was 1.17. So if that used to build syncthing 1.19.1 OK in the past, it should be fine.
Comment 13 Peter Wemm freebsd_committer freebsd_triage 2022-04-06 05:12:31 UTC
I didn't want to fight with gomod so I cheated.  I know it's not a good solution but I rolled my local poudriere syncthing build (not lang/go) back from 1.19.x to 1.18.x which "fixed" it.  I feel bad, but FYI.
Comment 14 Mikael Urankar freebsd_committer freebsd_triage 2022-04-06 08:15:58 UTC
Created attachment 232991 [details]

This patch seems to work.
- do not extract the go modules in the vendor dir as it causes problem for certain ports
- remove -mod=vendor as it's not used anymore

net/syncthing: Update to 1.19.2 and switch to GO_MODULE
Comment 15 Jan van Stekelenburg 2022-04-08 10:57:38 UTC
(In reply to Mikael Urankar from comment #14)
Works for me on amd64. Thanks Mikael.
Comment 16 Emmanuel Vadot freebsd_committer freebsd_triage 2022-04-08 11:40:55 UTC
(In reply to Mikael Urankar from comment #14)

Thanks, works for me here too.
Comment 17 Mikael Urankar freebsd_committer freebsd_triage 2022-04-08 13:39:43 UTC
the go.mk change is too intrusive and breaks some ports. I'll try to come up with a better fix.
Comment 18 Jonathan Vasquez 2022-04-08 17:02:02 UTC
Hey all,

I finally got a chance today to set up poudriere on my FreeBSD 13.0-RELEASE server (first time) and so far it's great. I noticed that syncthing was the only thing that failed so I went ahead and took a look at the logs and saw the same error that was already reported. Just wanted to mention this here as well. I was going to try out the patch that works but I see that Mikael said it's a bit too intrusive. I'll await for an improved version and I can help test. Keep up the good work everyone :).

- Jonathan
Comment 19 Mikael Urankar freebsd_committer freebsd_triage 2022-04-09 08:02:01 UTC
I've opened https://reviews.freebsd.org/D34857 for review.

net/syncthing still needs to be patched to use GO_MODULES and no_vendor_dir needs to be put in the USES list.
Comment 20 Eirik Oeverby 2022-04-16 18:05:50 UTC
Syncthing not building is, at least to us, becoming problematic. Is there any way to get it to build (with poudriere) until D34857 goes through?

Also, what's the right way to bring attention to your review? It's been sitting there for a while now..

Comment 21 Denis Shaposhnikov 2022-04-16 18:08:30 UTC
Hi Eirik,

as a workaround I'm using

GO_PORT=		lang/go117

in poudriere's make.conf. Hope it'll help you too.
Comment 22 Sir l33tname 2022-04-24 09:21:22 UTC
Created attachment 233430 [details]
Upgrade to 1.19.2

I used the latest release and switched it to go:modules and it builds in testport again for me. 

I didn't had time to really test it and i have no idea how GO stuff works so maybe the patch is bad.
Comment 23 Dan Langille freebsd_committer freebsd_triage 2022-04-27 20:48:12 UTC
I have syncthing 1.19.1 installed and running as of Sun Mar 27 21:35:53 2022 UTC

I can't find the build log right now...
Comment 24 Dan Langille freebsd_committer freebsd_triage 2022-04-27 20:50:25 UTC
It fails here, just last night: Wed Apr 27 07:27:08 UTC 2022

Comment 25 Dan Langille freebsd_committer freebsd_triage 2022-04-27 20:55:20 UTC
My first failed build at my install on 27 March was https://services.unixathome.org/poudriere/build.html?mastername=122amd64-default-primary&build=2022-03-28_15h26m00s
Comment 26 Sir l33tname 2022-04-30 07:40:55 UTC
I just installed my patched version which seems to work, would be great to get some feedback on the patch and move forward with that to unbreak syncthing in the ports tree for everyone
Comment 27 Jonathan Vasquez 2022-04-30 12:13:13 UTC
I can help test. What's the recommended way to test it? Download attachment and throw the file into the corresponding ports folder or is there some sort of 'overlay folder' that FreeBSD can apply when selecting the port?
Comment 28 Dmitri Goutnik freebsd_committer freebsd_triage 2022-05-04 11:00:04 UTC
Created attachment 233717 [details]

Update to 1.20.0, unbreak build.

I didn't attempt to run it, but poudriere testport passes in 130a, 130i, 123a
Comment 29 Eric Camachat 2022-05-04 14:00:16 UTC
(In reply to Dmitri Goutnik from comment #28)
Works good on my 13.0 amd64.
Comment 30 Sir l33tname 2022-05-07 16:31:11 UTC
Created attachment 233794 [details]
Upgrade to 1.20.1

Updated and tested the patch from Dmitri Goutnik but updated to 1.20.1.

What is required to get this merged?
Comment 31 Denis Shaposhnikov 2022-05-08 11:35:31 UTC
(In reply to Sir l33tname from comment #30)
Thank you! I've just upgraded net/syncthing using your patch and it works fine.
Comment 32 commit-hook freebsd_committer freebsd_triage 2022-05-08 15:09:02 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2ff27291417d9a79b9c43d6d128817e5ec465a17

commit 2ff27291417d9a79b9c43d6d128817e5ec465a17
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-05-08 15:05:07 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-05-08 15:05:07 +0000

    net/syncthing: Fix broken build and upgrade to 1.20.1

    After lang/go was updated to 1.18, net/syncthing failed to build under
    poudriere, with errors similar to:

    vendor/github.com/marten-seemann/qtls-go1-18/cipher_suites.go:143:43: undeclared name: any (requires version go1.18 or later)

    This is because the packaged vendor libraries in the upstream tarball
    don't work with go 1.18. Fix this by using USES=go:modules and changing
    the build commands. Also, upgrade to 1.20.1.

    PR:             262808
    Reported by:    Oscar Carlsson <oscar@spindel.tax>
    Approved by:    maintainer timeout (2 weeks)
    Submitted by:   dmgk
    MFH:            2022Q2

 net/syncthing/Makefile | 13 ++++++-------
 net/syncthing/distinfo |  6 +++---
 2 files changed, 9 insertions(+), 10 deletions(-)
Comment 33 Jonathan Vasquez 2022-05-08 15:12:49 UTC
Thank you :).