b-em icon indicating copy to clipboard operation
b-em copied to clipboard

The version number included in the code (on Linux builds) is unreliable

Open SteveFosdick opened this issue 3 years ago • 6 comments

Building a release for which git log and git describe both have 51fd877 as the current commit produces an executable which claims to be e5adcaf. See also the comments at the end of Issue#156.

SteveFosdick avatar May 16 '21 12:05 SteveFosdick

See also https://github.com/stardot/b-em/issues/18

SteveFosdick avatar May 16 '21 12:05 SteveFosdick

FYI, if I delete the autom4te.cache/ directory then re-run autogen.sh the version number in configure is then correct.

hoglet67 avatar May 16 '21 12:05 hoglet67

Adding -f to autoreconf in autogen.sh caused the version number to be correctly updated when you re-run autogen.sh

I think it would be better if the version was somehow updated as part of the compilation rather than as part of the configuration.

hoglet67 avatar May 16 '21 12:05 hoglet67

Yes, agreed. I might need to spend some time reading the documentation. If it were a plain Makefile I'd have a file version.h with a build command that got executed each time, or for an optimisation, depended on something in the git directory that gets updated on each commit. I am sure the same must be possible with autoconf, it's just a question of how.

SteveFosdick avatar May 16 '21 12:05 SteveFosdick

Here's one possible way of fixing that. It seem I can't remove GNU autoconf's idea of a package having a version known at configure time - it's part of the AC_INIT macro. So instead I am setting a different variable, also from git.

https://github.com/stardot/b-em/commit/c38083ad86e22218436105b3a14cccb534804a25

SteveFosdick avatar May 16 '21 14:05 SteveFosdick

This seems to have created a catch-22. I have added a Makefile rule to Makefile,.am to generate version.h but, because gcc is used for dependency analysis and gcc can't find an existing file of that name, it doesn't get added to the list of dependencies and thus the new rule is not called.

SteveFosdick avatar May 25 '21 21:05 SteveFosdick