Skip to content

Commit 9db0582

Browse files
committed
fix(building): add note that the C compiler is highly recommended
Signed-off-by: Jakob Borg <[email protected]>
1 parent 70f9222 commit 9db0582

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

dev/building.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,28 @@ Prerequisites
3232
- The latest stable version of Go. The previous stable version should also
3333
work; older versions will likely not work. This largely follows Go's
3434
`Release Policy <https://go.dev/doc/devel/release#policy>`__.
35+
3536
- Usually, a C compiler. Syncthing uses SQLite for storing data and the
3637
most common implementation is written in C.
38+
39+
.. note::
40+
41+
Don't skip the C compiler, and make sure to build syncthing with
42+
``CGO_ENABLED=1`` if you are cross compiling. While the build will succeed
43+
with ``CGO_ENABLED=0`` and the resulting binary will work, it will run
44+
with significantly lower performance and higher memory usage when the C
45+
implementation of SQLite couldn't be used. Your users will not thank you.
46+
3747
- Git, unless you're building from a downloaded source tarball that includes
3848
a ``RELEASE`` marker with the version information.
49+
3950
- If you want to build Debian packages FPM is required. See FPM's
4051
`installation information <https://fpm.readthedocs.io/en/latest/installation.html>`__.
52+
4153
- To build Windows executables, installing `goversioninfo
4254
<https://github.com/josephspurrier/goversioninfo>`__ is recommended
4355
in order to add file properties and icon to the compiled binaries.
56+
4457
- Building Android binaries requires `Android NDK <https://developer.android.com/ndk>`__.
4558

4659
If you're not already a Go developer, the easiest way to get going
@@ -142,6 +155,14 @@ influence ``build``, ``tar`` and ``zip``. Examples:
142155
Builds a zip distribution of Syncthing for Windows (current architecture) with
143156
upgrading disabled.
144157

158+
.. note::
159+
160+
Cross compiling with C (``CGO_ENABLED=1``) can be non-trivial; nonetheless
161+
you should try to do so when at all possible. We use Zig to ease the pain;
162+
you can check our `build workflows
163+
<https://github.com/syncthing/syncthing/blob/main/.github/workflows/build-syncthing.yaml>`__
164+
for inspiration.
165+
145166
.. _versiontagging:
146167

147168
Version Tagging

0 commit comments

Comments
 (0)