[SOLVED] Some self-compiled binaries fail with start due to "invalid version string"

Today, I have tried to compile and run Syncthing from

but both binaries fail to start with the following type of error:

Invalid version string "0fb34697";
        does not match regexp ^v\d+\.\d+\.\d+(-[a-z0-9]+)*(\.\d+)*(\+\d+-g[0-9a-f]+)?(-[^\s]+)?$

On the other hand, if I add a custom commit to the official main, and then compile and try to run it, then that binary works fine.

Do you have any idea what the problem may be about?

Just guessing here, but I believe the version string is somehow based on git describe output. If you check out a commit directly (detached HEAD) but don’t have the previous tags fetched from the cloned repository, then that output will fall back to just the abbreviated commit hash. So make sure to fetch the tags from upstream, or add an own local tag matching the version regexp (will pprobably cconfuse uusage reporting though).

3 Likes

That must be it.

I was doing git clone --branch <branch> --depth 1 just to save a temporary copy onto a RAM disk and compile from there, but I guess that I will have to add the tags next time.

Yes. It needs tags to generate a version