I’ve been a long time lurker but I finally decided to register an account and join the community . I also thought I’d try tinkering with development, which is where I’ve got stuck.
I’m trying to build Syncthing by following the instructions in the docs, however when building I only get this output:
C:\Users\...\Documents\Syncthing\syncthing-sadphi>go run build.go
Warning: Windows binaries will not have file information encoded: failed to create C:\Users\...\Documents\Syncthing\syncthing-sadphi\cmd\syncthing\resource.syso: exec: "goversioninfo": executable file not found in %PATH%
exec: "gcc": executable file not found in %PATH%
exit status 2
exit status 1
A few months ago I was testing around and built Syncthing the exact same way on this machine, but this time it doesn’t work. I found this thread which said to download TDM-GCC, but that didn’t work. I have also tried updating go.
I currently run
go version go1.14.4 windows/amd64
set CGO_ENABLED=0 env var.
Or make sure gcc.exe is in your path, looks like the tdm-gcc installer didn’t take care of that (or you first need to rerun/-start something for the change to take effect).
Thanks, this fixed it! Is there any downsides to disabling CGO?
We never needed CGO on Windows, adding badger dependency introduced it, it should be fine to build without it.
Well, restarting my PC made it work with TDM-GCC and CGO enabled. My bad
Alright, I see, thanks for the help!
Badger has two build modes apparently, with
zstd when CGO_ENABLED=1 and with
lz4 when it’s disabled. (I haven’t tested whether the databases are compatible between the two; I’d hope they are…)
I looked at the code: They are not fully compatible. There’s an option to choose the compression, i.e. on a cgo build you can open both, but you need to specify the correct compression to open an existing db. On a no-cgo build you can’t open dbs compressed with zstd. There’s some chance zstd will be available without cgo soon: https://github.com/dgraph-io/badger/issues/1162