The "canonical import path" I patched out was removed upstream [1]. I've added 
that info to the patch message to indicate that it will become obsolete when 
the fix is released.

I'm posting the diff below.

[1] 
https://github.com/syncthing/syncthing/commit/1843cac6d9cb1e3c8b7dd96e5ec4fcb28f554275


One more thing: logs.

Syncthing logs to standard output by default. Currently, the RC service doesn't 
do anything with it, so you lose the logs when you reboot. The logs for the 
current session can still be accessed from the GUI, so it's not too bad.

If we want to persist logs somewhere by default, I think we can use the 
daemon_logger variable [1]. Alternatively, Syncthing has an option `--log-file` 
[2], which is able to do log rotation.


[1] https://man.openbsd.org/rc.d.8#ENVIRONMENT
[2] 
https://docs.syncthing.net/v2.0.0/users/faq.html#where-are-the-syncthing-logs


Here's the diff:


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/syncthing/Makefile,v
diff -u -p -r1.73 Makefile
--- Makefile    22 Jul 2025 20:20:25 -0000      1.73
+++ Makefile    28 Dec 2025 18:50:51 -0000
@@ -1,6 +1,6 @@
 COMMENT =      open decentralized synchronization utility
 
-V =            1.30.0
+V =            2.0.12
 DISTNAME =     syncthing-${V}
 DISTFILES =    syncthing-source-v${V}${EXTRACT_SUFX}
 
@@ -22,7 +22,6 @@ WRKDIST =             ${WRKDIR}/syncthing
 WRKSRC =               ${WRKDIR}/go/src/github.com/syncthing/syncthing
 
 MODULES =              lang/go
-MODGO_TYPE =           bin
 
 # Syncthing contains a lot of stuff that end users wouldn't be interested in,
 # so we package only these binaries.
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/syncthing/distinfo,v
diff -u -p -r1.50 distinfo
--- distinfo    4 Jul 2025 19:19:39 -0000       1.50
+++ distinfo    28 Dec 2025 18:50:51 -0000
@@ -1,2 +1,2 @@
-SHA256 (syncthing-source-v1.30.0.tar.gz) = 
7xvnHGZ1PAQhKrHJxUjmeNRoutmNxUYeg1QKTvXC/Lo=
-SIZE (syncthing-source-v1.30.0.tar.gz) = 16142834
+SHA256 (syncthing-source-v2.0.12.tar.gz) = 
VgBK5tl0qjh8PGpzTrmKr9XWFZ/GV6H0xhjgsYFPra4=
+SIZE (syncthing-source-v2.0.12.tar.gz) = 62613260
Index: patches/patch-build_go
===================================================================
RCS file: /cvs/ports/net/syncthing/patches/patch-build_go,v
diff -u -p -r1.24 patch-build_go
--- patches/patch-build_go      4 Jun 2025 20:07:43 -0000       1.24
+++ patches/patch-build_go      28 Dec 2025 18:50:51 -0000
@@ -3,7 +3,7 @@ Print build commands
 Index: build.go
 --- build.go.orig
 +++ build.go
-@@ -549,7 +549,7 @@ func appendParameters(args []string, tags []string, pk
+@@ -532,7 +532,7 @@ func appendParameters(args []string, tags []string, pk
  
        if !debugBinary {
                // Regular binaries get version tagged and skip some debug 
symbols
Index: patches/patch-cmd_syncthing_main_go
===================================================================
RCS file: /cvs/ports/net/syncthing/patches/patch-cmd_syncthing_main_go,v
diff -u -p -r1.3 patch-cmd_syncthing_main_go
--- patches/patch-cmd_syncthing_main_go 15 Jun 2025 16:42:21 -0000      1.3
+++ patches/patch-cmd_syncthing_main_go 28 Dec 2025 18:50:51 -0000
@@ -5,8 +5,8 @@ use unveil(2) to limit execution to
 Index: cmd/syncthing/main.go
 --- cmd/syncthing/main.go.orig
 +++ cmd/syncthing/main.go
-@@ -29,6 +29,8 @@ import (
-       "syscall"
+@@ -31,6 +31,8 @@ import (
+       "text/tabwriter"
        "time"
  
 +      "golang.org/x/sys/unix"
@@ -14,23 +14,28 @@ Index: cmd/syncthing/main.go
        "github.com/alecthomas/kong"
        "github.com/gofrs/flock"
        "github.com/thejerf/suture/v4"
-@@ -206,6 +208,19 @@ func defaultVars() kong.Vars {
- }
- 
+@@ -213,6 +215,24 @@ func defaultVars() kong.Vars {
  func main() {
+       // Create a parser with an overridden help function to print our extra
+       // help info.
++
 +      if err := unix.Unveil("/", "rwc"); err != nil {
 +              panic(err)
 +      }
++
 +      if err := unix.Unveil("/usr/local/bin/syncthing", "rx"); err != nil {
 +              panic(err)
 +      }
++
 +      if err := unix.Unveil("/usr/local/bin/xdg-open", "rx"); err != nil {
 +              panic(err)
 +      }
++
 +      if err := unix.UnveilBlock(); err != nil {
 +              panic(err)
 +      }
 +
-       // First some massaging of the raw command line to fit the new model.
-       // Basically this means adding the default command at the front, and
-       // converting -options to --options.
++
+       var entrypoint CLI
+       parser, err := kong.New(
+               &entrypoint,
Index: patches/patch-internal_db_interface_go
===================================================================
RCS file: patches/patch-internal_db_interface_go
diff -N patches/patch-internal_db_interface_go
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-internal_db_interface_go      28 Dec 2025 18:50:51 -0000
@@ -0,0 +1,20 @@
+Remove canonical import path that prevents successful build.
+
+This has been fixed upstream [1] and, when released, will
+make this patch obsolete.
+
+[1] 
https://github.com/syncthing/syncthing/commit/1843cac6d9cb1e3c8b7dd96e5ec4fcb28f554275
+
+
+Index: internal/db/interface.go
+--- internal/db/interface.go.orig
++++ internal/db/interface.go
+@@ -4,7 +4,7 @@
+ // License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ // You can obtain one at https://mozilla.org/MPL/2.0/.
+ 
+-package db // import "github.com/syncthing/syncthing/internal/db/sqlite"
++package db
+ 
+ import (
+       "iter"
Index: patches/patch-lib_build_build_go
===================================================================
RCS file: /cvs/ports/net/syncthing/patches/patch-lib_build_build_go,v
diff -u -p -r1.4 patch-lib_build_build_go
--- patches/patch-lib_build_build_go    28 Nov 2024 11:47:47 -0000      1.4
+++ patches/patch-lib_build_build_go    28 Dec 2025 18:50:51 -0000
@@ -3,7 +3,7 @@ Disable phone-home calls / anonymous usa
 Index: lib/build/build.go
 --- lib/build/build.go.orig
 +++ lib/build/build.go
-@@ -74,7 +74,7 @@ func setBuildData() {
+@@ -83,7 +83,7 @@ func setBuildData() {
  
        exp := regexp.MustCompile(`^v\d+\.\d+\.\d+(-[a-z]+[\d\.]+)?$`)
        IsRelease = exp.MatchString(Version)
Index: pkg/syncthing.rc
===================================================================
RCS file: /cvs/ports/net/syncthing/pkg/syncthing.rc,v
diff -u -p -r1.6 syncthing.rc
--- pkg/syncthing.rc    11 Mar 2022 19:47:38 -0000      1.6
+++ pkg/syncthing.rc    28 Dec 2025 18:50:51 -0000
@@ -1,7 +1,7 @@
 #!/bin/ksh
 
 daemon="${TRUEPREFIX}/bin/syncthing"
-daemon_flags="-no-browser"
+daemon_flags="--no-browser"
 daemon_user="_syncthing"
 
 . /etc/rc.d/rc.subr




On Sunday, December 28th, 2025 at 14:34, Douglas Silva <[email protected]> 
wrote:

> 
> 
> 
> 
> I got it to build by patching out the canonical import path from 
> `internal/db/interface.go`.
> 
> It's building, installing and running as expected. I've found no warnings or 
> errors in the build log, which I'm attaching here. Automatic upgrades are 
> disabled (as expected), and files are syncing.
> 
> 
> A few observations:
> 
> 1. Although `make install` succeeds, I get this warning:
> 
> useradd: Warning: home directory `/var/syncthing` doesn't exist, and -m was 
> not specified
> 
> But then you look at `/var/syncthing` and it's already there — it was created.
> 
> 
> 2. When opening the web GUI for the first time, I get the dialog asking if I 
> want to enable telemetry. Isn't it supposed to be disabled by the patch 
> `patch-lib_build_build_go`?
> 
> 
> Diff below:
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/net/syncthing/Makefile,v
> diff -u -p -r1.73 Makefile
> --- Makefile 22 Jul 2025 20:20:25 -0000 1.73
> +++ Makefile 28 Dec 2025 17:33:34 -0000
> @@ -1,6 +1,6 @@
> COMMENT = open decentralized synchronization utility
> 
> -V = 1.30.0
> +V = 2.0.12
> DISTNAME = syncthing-${V}
> DISTFILES = syncthing-source-v${V}${EXTRACT_SUFX}
> 
> @@ -22,7 +22,6 @@ WRKDIST = ${WRKDIR}/syncthing
> WRKSRC = ${WRKDIR}/go/src/github.com/syncthing/syncthing
> 
> MODULES = lang/go
> -MODGO_TYPE = bin
> 
> # Syncthing contains a lot of stuff that end users wouldn't be interested in,
> # so we package only these binaries.
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/net/syncthing/distinfo,v
> diff -u -p -r1.50 distinfo
> --- distinfo 4 Jul 2025 19:19:39 -0000 1.50
> +++ distinfo 28 Dec 2025 17:33:34 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (syncthing-source-v1.30.0.tar.gz) = 
> 7xvnHGZ1PAQhKrHJxUjmeNRoutmNxUYeg1QKTvXC/Lo=
> -SIZE (syncthing-source-v1.30.0.tar.gz) = 16142834
> +SHA256 (syncthing-source-v2.0.12.tar.gz) = 
> VgBK5tl0qjh8PGpzTrmKr9XWFZ/GV6H0xhjgsYFPra4=
> +SIZE (syncthing-source-v2.0.12.tar.gz) = 62613260
> Index: patches/patch-build_go
> ===================================================================
> RCS file: /cvs/ports/net/syncthing/patches/patch-build_go,v
> diff -u -p -r1.24 patch-build_go
> --- patches/patch-build_go 4 Jun 2025 20:07:43 -0000 1.24
> +++ patches/patch-build_go 28 Dec 2025 17:33:34 -0000
> @@ -3,7 +3,7 @@ Print build commands
> Index: build.go
> --- build.go.orig
> +++ build.go
> -@@ -549,7 +549,7 @@ func appendParameters(args []string, tags []string, pk
> +@@ -532,7 +532,7 @@ func appendParameters(args []string, tags []string, pk
> 
> if !debugBinary {
> // Regular binaries get version tagged and skip some debug symbols
> Index: patches/patch-cmd_syncthing_main_go
> ===================================================================
> RCS file: /cvs/ports/net/syncthing/patches/patch-cmd_syncthing_main_go,v
> diff -u -p -r1.3 patch-cmd_syncthing_main_go
> --- patches/patch-cmd_syncthing_main_go 15 Jun 2025 16:42:21 -0000 1.3
> +++ patches/patch-cmd_syncthing_main_go 28 Dec 2025 17:33:34 -0000
> @@ -5,8 +5,8 @@ use unveil(2) to limit execution to
> Index: cmd/syncthing/main.go
> --- cmd/syncthing/main.go.orig
> +++ cmd/syncthing/main.go
> -@@ -29,6 +29,8 @@ import (
> - "syscall"
> +@@ -31,6 +31,8 @@ import (
> + "text/tabwriter"
> "time"
> 
> + "golang.org/x/sys/unix"
> @@ -14,23 +14,28 @@ Index: cmd/syncthing/main.go
> "github.com/alecthomas/kong"
> "github.com/gofrs/flock"
> "github.com/thejerf/suture/v4"
> -@@ -206,6 +208,19 @@ func defaultVars() kong.Vars {
> - }
> -
> +@@ -213,6 +215,24 @@ func defaultVars() kong.Vars {
> func main() {
> + // Create a parser with an overridden help function to print our extra
> + // help info.
> ++
> + if err := unix.Unveil("/", "rwc"); err != nil {
> + panic(err)
> + }
> ++
> + if err := unix.Unveil("/usr/local/bin/syncthing", "rx"); err != nil {
> + panic(err)
> + }
> ++
> + if err := unix.Unveil("/usr/local/bin/xdg-open", "rx"); err != nil {
> + panic(err)
> + }
> ++
> + if err := unix.UnveilBlock(); err != nil {
> + panic(err)
> + }
> +
> - // First some massaging of the raw command line to fit the new model.
> - // Basically this means adding the default command at the front, and
> - // converting -options to --options.
> ++
> + var entrypoint CLI
> + parser, err := kong.New(
> + &entrypoint,
> Index: patches/patch-internal_db_interface_go
> ===================================================================
> RCS file: patches/patch-internal_db_interface_go
> diff -N patches/patch-internal_db_interface_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-internal_db_interface_go 28 Dec 2025 17:33:34 -0000
> @@ -0,0 +1,14 @@
> +Remove canonical import path that prevents successful build
> +
> +Index: internal/db/interface.go
> +--- internal/db/interface.go.orig
> ++++ internal/db/interface.go
> +@@ -4,7 +4,7 @@
> + // License, v. 2.0. If a copy of the MPL was not distributed with this file,
> + // You can obtain one at https://mozilla.org/MPL/2.0/.
> +
> +-package db // import "github.com/syncthing/syncthing/internal/db/sqlite"
> ++package db
> +
> + import (
> + "iter"
> Index: patches/patch-lib_build_build_go
> ===================================================================
> RCS file: /cvs/ports/net/syncthing/patches/patch-lib_build_build_go,v
> diff -u -p -r1.4 patch-lib_build_build_go
> --- patches/patch-lib_build_build_go 28 Nov 2024 11:47:47 -0000 1.4
> +++ patches/patch-lib_build_build_go 28 Dec 2025 17:33:34 -0000
> @@ -3,7 +3,7 @@ Disable phone-home calls / anonymous usa
> Index: lib/build/build.go
> --- lib/build/build.go.orig
> +++ lib/build/build.go
> -@@ -74,7 +74,7 @@ func setBuildData() {
> +@@ -83,7 +83,7 @@ func setBuildData() {
> 
> exp := regexp.MustCompile(`^v\\d+\\.\\d+\\.\\d+(-[a-z]+[\\d\\.]+)?$`)
> IsRelease = exp.MatchString(Version)
> Index: pkg/syncthing.rc
> ===================================================================
> RCS file: /cvs/ports/net/syncthing/pkg/syncthing.rc,v
> diff -u -p -r1.6 syncthing.rc
> --- pkg/syncthing.rc 11 Mar 2022 19:47:38 -0000 1.6
> +++ pkg/syncthing.rc 28 Dec 2025 17:33:34 -0000
> @@ -1,7 +1,7 @@
> #!/bin/ksh
> 
> daemon="${TRUEPREFIX}/bin/syncthing"
> -daemon_flags="-no-browser"
> +daemon_flags="--no-browser"
> daemon_user="_syncthing"
> 
> . /etc/rc.d/rc.subr
> 
> 
> 
> 
> 
> 
> 
> 
> On Wednesday, December 24th, 2025 at 17:02, Douglas Silva [email protected] 
> wrote:
> 
> > Thanks, I appreciate the help. I've asked for help on the Syncthing forum 
> > [1] and got a reply from the maintainer, but I'm not sure I understand what 
> > needs to be done.
> > 
> > Oh, and I'm attaching the `make build` log, and the current diff below. I 
> > forgot to do that before.
> > 
> > [1] 
> > https://forum.syncthing.net/t/error-building-syncthing-v2-on-openbsd/25929?u=harpia
> > 
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/net/syncthing/Makefile,v
> > diff -u -p -r1.73 Makefile
> > --- Makefile 22 Jul 2025 20:20:25 -0000 1.73
> > +++ Makefile 23 Dec 2025 14:06:16 -0000
> > @@ -1,6 +1,6 @@
> > COMMENT = open decentralized synchronization utility
> > 
> > -V = 1.30.0
> > +V = 2.0.12
> > DISTNAME = syncthing-${V}
> > DISTFILES = syncthing-source-v${V}${EXTRACT_SUFX}
> > 
> > Index: distinfo
> > ===================================================================
> > RCS file: /cvs/ports/net/syncthing/distinfo,v
> > diff -u -p -r1.50 distinfo
> > --- distinfo 4 Jul 2025 19:19:39 -0000 1.50
> > +++ distinfo 23 Dec 2025 14:06:16 -0000
> > @@ -1,2 +1,2 @@
> > -SHA256 (syncthing-source-v1.30.0.tar.gz) = 
> > 7xvnHGZ1PAQhKrHJxUjmeNRoutmNxUYeg1QKTvXC/Lo=
> > -SIZE (syncthing-source-v1.30.0.tar.gz) = 16142834
> > +SHA256 (syncthing-source-v2.0.12.tar.gz) = 
> > VgBK5tl0qjh8PGpzTrmKr9XWFZ/GV6H0xhjgsYFPra4=
> > +SIZE (syncthing-source-v2.0.12.tar.gz) = 62613260
> > Index: patches/patch-build_go
> > ===================================================================
> > RCS file: /cvs/ports/net/syncthing/patches/patch-build_go,v
> > diff -u -p -r1.24 patch-build_go
> > --- patches/patch-build_go 4 Jun 2025 20:07:43 -0000 1.24
> > +++ patches/patch-build_go 23 Dec 2025 14:06:16 -0000
> > @@ -3,7 +3,7 @@ Print build commands
> > Index: build.go
> > --- build.go.orig
> > +++ build.go
> > -@@ -549,7 +549,7 @@ func appendParameters(args []string, tags []string, pk
> > +@@ -532,7 +532,7 @@ func appendParameters(args []string, tags []string, pk
> > 
> > if !debugBinary {
> > // Regular binaries get version tagged and skip some debug symbols
> > Index: patches/patch-cmd_syncthing_main_go
> > ===================================================================
> > RCS file: /cvs/ports/net/syncthing/patches/patch-cmd_syncthing_main_go,v
> > diff -u -p -r1.3 patch-cmd_syncthing_main_go
> > --- patches/patch-cmd_syncthing_main_go 15 Jun 2025 16:42:21 -0000 1.3
> > +++ patches/patch-cmd_syncthing_main_go 23 Dec 2025 14:06:16 -0000
> > @@ -5,8 +5,8 @@ use unveil(2) to limit execution to
> > Index: cmd/syncthing/main.go
> > --- cmd/syncthing/main.go.orig
> > +++ cmd/syncthing/main.go
> > -@@ -29,6 +29,8 @@ import (
> > - "syscall"
> > +@@ -31,6 +31,8 @@ import (
> > + "text/tabwriter"
> > "time"
> > 
> > + "golang.org/x/sys/unix"
> > @@ -14,23 +14,28 @@ Index: cmd/syncthing/main.go
> > "github.com/alecthomas/kong"
> > "github.com/gofrs/flock"
> > "github.com/thejerf/suture/v4"
> > -@@ -206,6 +208,19 @@ func defaultVars() kong.Vars {
> > - }
> > -
> > +@@ -213,6 +215,24 @@ func defaultVars() kong.Vars {
> > func main() {
> > + // Create a parser with an overridden help function to print our extra
> > + // help info.
> > ++
> > + if err := unix.Unveil("/", "rwc"); err != nil {
> > + panic(err)
> > + }
> > ++
> > + if err := unix.Unveil("/usr/local/bin/syncthing", "rx"); err != nil {
> > + panic(err)
> > + }
> > ++
> > + if err := unix.Unveil("/usr/local/bin/xdg-open", "rx"); err != nil {
> > + panic(err)
> > + }
> > ++
> > + if err := unix.UnveilBlock(); err != nil {
> > + panic(err)
> > + }
> > +
> > - // First some massaging of the raw command line to fit the new model.
> > - // Basically this means adding the default command at the front, and
> > - // converting -options to --options.
> > ++
> > + var entrypoint CLI
> > + parser, err := kong.New(
> > + &entrypoint,
> > Index: patches/patch-lib_build_build_go
> > ===================================================================
> > RCS file: /cvs/ports/net/syncthing/patches/patch-lib_build_build_go,v
> > diff -u -p -r1.4 patch-lib_build_build_go
> > --- patches/patch-lib_build_build_go 28 Nov 2024 11:47:47 -0000 1.4
> > +++ patches/patch-lib_build_build_go 23 Dec 2025 14:06:16 -0000
> > @@ -3,7 +3,7 @@ Disable phone-home calls / anonymous usa
> > Index: lib/build/build.go
> > --- lib/build/build.go.orig
> > +++ lib/build/build.go
> > -@@ -74,7 +74,7 @@ func setBuildData() {
> > +@@ -83,7 +83,7 @@ func setBuildData() {
> > 
> > exp := 
> > regexp.MustCompile(`^v\\\\d+\\\\.\\\\d+\\\\.\\\\d+(-[a-z]+[\\\\d\\\\.]+)?$`)
> > IsRelease = exp.MatchString(Version)
> > 
> > On Friday, December 19th, 2025 at 20:28, Lydia Sobot 
> > [email protected] wrote:
> > 
> > > > `make build` is failing with the following error:
> > > 
> > > > lib/syncthing/globalmigrations.go:10:2: code in directory 
> > > > /usr/ports/pobj/syncthing-2.0.12/go/src/github.com/syncthing/syncthing/internal/db
> > > >  expects import "github.com/syncthing/syncthing/internal/db/sqlite"
> > > > 
> > > > I'm not at all familiar with Go, so I need some help with this.
> > > 
> > > I'm no expert on Go tooling myself however I am a regular and very
> > > satisfied user of Syncthing so I'm trying to look into this, it may
> > > have something to do with the following forum thread and OpenBSD go-mod
> > > infrastructure:
> > > https://forum.syncthing.net/t/go-module-path-for-syncthing-lib-remains-at-v1-unable-to-import-v2/25532/3

Reply via email to