[systemd-devel] [PATCH 0/1] systemd will fail to compile if libgcrypt is missing

Djalal Harouni tixxdz at opendz.org
Fri Nov 1 18:11:48 PDT 2013


Hi list,

I'm doing some systemd testing on clean machines. I'm building from git
tree, and I've noticed that systemd autogen.sh will fail if the
libgcrypt and its headers are missing, this will produce a buggy
configure script.

The error messages were not clear, I did lost time debugging... :-/

The libtool and libgcrypt were missing, perhaps others packages too, but
I was trying to get it compile without all the features. The readme file
states clearly that libtool is needed and libgcrypt is optional, so lets
see:

(Libtool and libgcrypt were not installed)

The autogen.sh output:
configure.ac:547: warning: macro 'AM_PATH_LIBGCRYPT' not found in
library
configure.ac:47: error: possibly undefined macro: AC_MSG_ERROR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:547: error: possibly undefined macro: AM_PATH_LIBGCRYPT
autoreconf: /usr/bin/autoconf failed with exit status: 1

The produced configure.ac script will fail with:
./configure: line 5123: syntax error near unexpected token `2.2'
./configure: line 5123: `LT_PREREQ(2.2)'

So, I know LT_PREREQ(2.2) is from libtool, lets get it. After that I
re-run autogen.sh:

./autogen.sh 
configure.ac:547: warning: macro 'AM_PATH_LIBGCRYPT' not found in
library
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: linking file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: linking file `m4/libtool.m4'
libtoolize: linking file `m4/ltoptions.m4'
libtoolize: linking file `m4/ltsugar.m4'
libtoolize: linking file `m4/ltversion.m4'
libtoolize: linking file `m4/lt~obsolete.m4'
configure.ac:547: warning: macro 'AM_PATH_LIBGCRYPT' not found in library
configure.ac:47: error: possibly undefined macro: AC_MSG_ERROR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:547: error: possibly undefined macro: AM_PATH_LIBGCRYPT
autoreconf: /usr/bin/autoconf failed with exit status: 1


I still have the AM_PATH_LIBGCRYPT report, but I did install libtool
so why I'm getting that 'AC_MSG_ERROR'?, hmm ok perhaps other errors
got autoreconf produce this output? I don't know, all of this is set to
confuse my poor debugging skills... but running the autotools manually
will produce a better output.


Anyway, running the generated configure script will produce:

checking for fsetxattr in -lattr... yes
./configure: line 17100: syntax error near unexpected token `newline'
./configure: line 17100: `        AM_PATH_LIBGCRYPT('


So systemd clearly needs libgcrypt to compile since it makes use of
the AM_PATH_LIBGCRYPT macro. It's not optional as stated in the README
file.

There was a patch to test if AM_PATH_LIBGCRYPT is defined:
http://lists.freedesktop.org/archives/systemd-devel/2013-May/010885.html

The discussion ended by: libgcrypt should not use its own macro, yes
that's true, but in the end systemd is also using this same macro and
will fail to build...


What do you think of the following:
1) The following patch removes the AM_PATH_LIBGCRYPT macro use. It
makes the libgcrypt check consistent with the other library checks.

However by doing this we remove the version check from configure.ac, we
can still call gcry_version_check() inside AC_COMPILE_IFELSE to check
the minimal required version, but I don't like it.

It seems that the code that makes use of libgcrypt tries to check the
minimal version during initialization.

Please see the patch change log.


2) merge the patch:
http://lists.freedesktop.org/archives/systemd-devel/2013-May/010885.html


3) Edit the README file to state that systemd needs libgcrypt


BTW it would be nice if we can add a check like the following for
libtool:
m4_ifdef([LT_PREREQ],
         [LT_PREREQ(...)],
         [m4_fatal([Libtool version X not found])])

To improve error messages.


Thanks!


More information about the systemd-devel mailing list