'abinit --version' prints UNKNOWN when built from a tarball and not from the git repository
'abinit --version' fails:
$ abinit --version
UNKNOWN
Build instructions don't say anything about how to set version. configure and build succeeds and produce a faulty executable.
Some computations fail as well:
--- !WARNING
src_file: m_hdr.F90
src_line: 3196
message: |
Cannot find major.minor pattern in codvsn: UNKNOWN
...
Version: 10.0.7 FreeBSD 14.1
What is your output of ~abinit/configure --version ? If the output is UNKNOWN, it is because autoconf sets PACKAGE_VERSION=UNKNOWN in configure, line 584. Maybe it is an autoconf issue
Temporary solution: changing all 'UNKNOWN' occurrences within the configure file to '10.0.7' allows to run computations successfully without the warning and corrects the output when asking abinit version
The problem occurs in case when tarball is used that isn't a git repository.
You should provide a way for users to specify the version in such case.
Also configure should fail when the version isn't available because otherwise the produced abinit executable is broken.
Workaround: I replaced all occurrences of UNKNOWN with version in config/scripts/git-version-gen.
This occurs (at least) for latest release tarballs (v10.0.3, v10.0.5, v10.0.7) that do not include neither .version nor .tarball-version. Some propositions for completing the docs on how to set the version number:
-
on the top of the source tree,
echo "10.0.7" > .version && echo "10.0.7" > .tarball-versionand then launching./autogen.shbefore configure -
how to use existing script config/scripts/update-version-number that lets the user specify version within configure.ac
see : https://github.com/abinit/abinit/releases/tag/10.0.9
These instructions recommended above fixed this problem in the FreeBSD port:
echo "10.0.7" > .version && echo "10.0.7" > .tarball-version
I think it might be because some versions of sh don't support this syntax.
https://github.com/abinit/abinit/blob/578d1fb2aa42e852bbaf1656c497b5bd85c16d9a/config/scripts/git-version-gen#L197
Consider modifying the syntax to v=$(cat .current_version).