Building Syncthing for OmniOS

Hi all.

Just wanted to post our experiences with Syncthing on OmniOS, and anyone getting the ‘Filewatcher not supported’ error. A massive thanks to all the developers of Syncthing for their hard work.

As explained in this post - File watcher not supported on zfs / OmniOS? - the automated builds provided by Syncthing don’t work with the filesystem watcher on OmniOS/Solaris. The solution as noted by @calmh is to build Syncthing from source.

In case this helps anyone, here are the steps we used to build the latest Syncthing on OmniOS.

These steps are based on the official documentation of how to build Syncthing which is here - Building Syncthing — Syncthing documentation

# Check what version of go is available on your build of OmniOS. Building Syncthing requires go 1.18 or higher.
$ pkg list -a ooce/developer/go-*

# If go 1.18 or higher is not available in your list, you might need to update OmniOS.
$ pfexec pkg refresh
$ pfexec pkg update

# Install required tools - go, git, gcc
$ pkg install ooce/developer/go-118 developer/build-essential developer/versioning/git

# This should output "go version go1.18" or higher.
$ go version

# Pick a place for your Syncthing source.
$ mkdir -p ~/dev
$ cd ~/dev

# Grab the code.
$ git clone

# Optional. Checkout a specific version of Syncthing
$ checkout v1.20.3

# Now we have the source. Time to build!
$ cd syncthing

# You should be inside ~/dev/syncthing right now.
# The following build line differs from the basic build documentation as without CGO_ENABLED=1 when building the binary the filesystem watcher will not work.
# The -no-upgrade option is set so that your build with filesystem watcher support isn't automatically replaced by a newer version with one that doesn't have filesystem watcher support. Obviously you will need to build each new version yourself as it is released.
$ CGO_ENABLED=1 go run build.go -no-upgrade build syncthing

Unless something goes wrong, you will have a syncthing binary built and ready in ~/dev/syncthing/bin.

At this point you may want to check it’s working and you don’t have the filesystem watcher error.

$ ~/dev/syncthing/bin/syncthing

Now if you want to set Syncthing to run at startup, you can use the included SMF service manifest.

# Read the included README for SMF
$ cat ~/dev/syncthing/etc/solaris-smf/

# Edit the SMF
# At minimum change the 'method_credential' to an appropriate user/group and 'method_environment' to the location of your Syncthing config (usually the home folder of the user you will use to run Syncthing). Also change 'exec_method' to the location of the Syncthing binary.
$ vi ~/dev/syncthing/etc/solaris-smf/syncthing.xml

# Check you haven't made any mistakes in the syntax
$ svccfg validate ~/dev/syncthing/etc/solaris-smf/syncthing.xml

# Import the SMF
$ svccfg import ~/dev/syncthing/etc/solaris-smf/syncthing.xml

# Enable the service
$ svcadm enable syncthing

# Check the service is running properly
$ svcs -x syncthing

Building like this on Solaris at the moment doesn’t seem easy, since it neither has (at the time of this writing) go 1.18 or newer available on the latest Solaris CBE (11.4.42), and the version of gcc available doesn’t seem to be able to build go 1.18. But others may have better luck.

I also haven’t tested if the binary produced by OmniOS might work on Solaris, but that could be a potential option if you are using Solaris 11.4 CBE.

Hope this helps someone out there.

Thanks again to the developers of Syncthing for all their hard work!



This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.