bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

crypto/gc: fix link error with --with-libgcrypt


From: Bruno Haible
Subject: crypto/gc: fix link error with --with-libgcrypt
Date: Sat, 24 Aug 2019 14:04:42 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-157-generic; KDE/5.18.0; x86_64; ; )

A gnulib testdir created through

  ./gnulib-tool --create-testdir --dir=../testdir1 --single-configure 
crypto/gc-md5

when built with

  ./configure --with-libgcrypt && make

fails with

gcc  -g -O2  -o test-gc-md5 test-gc-md5.o libtests.a ../gllib/libgnu.a 
libtests.a   
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_init':
/tmp/testdir1/gllib/gc-libgcrypt.c:51: undefined reference to `gcry_control'
/tmp/testdir1/gllib/gc-libgcrypt.c:54: undefined reference to `gcry_control'
/tmp/testdir1/gllib/gc-libgcrypt.c:57: undefined reference to 
`gcry_check_version'
/tmp/testdir1/gllib/gc-libgcrypt.c:60: undefined reference to `gcry_control'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_cipher_open':
/tmp/testdir1/gllib/gc-libgcrypt.c:185: undefined reference to 
`gcry_cipher_open'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_cipher_setkey':
/tmp/testdir1/gllib/gc-libgcrypt.c:198: undefined reference to 
`gcry_cipher_setkey'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_cipher_setiv':
/tmp/testdir1/gllib/gc-libgcrypt.c:210: undefined reference to 
`gcry_cipher_setiv'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_cipher_encrypt_inline':
/tmp/testdir1/gllib/gc-libgcrypt.c:220: undefined reference to 
`gcry_cipher_encrypt'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_cipher_decrypt_inline':
/tmp/testdir1/gllib/gc-libgcrypt.c:230: undefined reference to 
`gcry_cipher_decrypt'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_cipher_close':
/tmp/testdir1/gllib/gc-libgcrypt.c:240: undefined reference to 
`gcry_cipher_close'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_hash_open':
/tmp/testdir1/gllib/gc-libgcrypt.c:344: undefined reference to `gcry_md_open'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_hash_clone':
/tmp/testdir1/gllib/gc-libgcrypt.c:370: undefined reference to `gcry_md_copy'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_hash_read':
/tmp/testdir1/gllib/gc-libgcrypt.c:488: undefined reference to `gcry_md_ctl'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_hash_close':
/tmp/testdir1/gllib/gc-libgcrypt.c:506: undefined reference to `gcry_md_close'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_hash_buffer':
/tmp/testdir1/gllib/gc-libgcrypt.c:587: undefined reference to 
`gcry_md_hash_buffer'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_md5':
/tmp/testdir1/gllib/gc-libgcrypt.c:639: undefined reference to 
`gcry_md_get_algo_dlen'
/tmp/testdir1/gllib/gc-libgcrypt.c:646: undefined reference to `gcry_md_open'
/tmp/testdir1/gllib/gc-libgcrypt.c:650: undefined reference to `gcry_md_write'
/tmp/testdir1/gllib/gc-libgcrypt.c:652: undefined reference to `gcry_md_read'
/tmp/testdir1/gllib/gc-libgcrypt.c:661: undefined reference to `gcry_md_close'
/tmp/testdir1/gllib/gc-libgcrypt.c:655: undefined reference to `gcry_md_close'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_set_allocators':
/tmp/testdir1/gllib/gc-libgcrypt.c:109: undefined reference to 
`gcry_set_allocation_handler'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_hash_hmac_setkey':
/tmp/testdir1/gllib/gc-libgcrypt.c:444: undefined reference to `gcry_md_setkey'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_hash_write':
/tmp/testdir1/gllib/gc-libgcrypt.c:462: undefined reference to `gcry_md_write'
../gllib/libgnu.a(gc-libgcrypt.o): In function `gc_hash_read':
/tmp/testdir1/gllib/gc-libgcrypt.c:489: undefined reference to `gcry_md_read'
collect2: error: ld returned 1 exit status
Makefile:2673: recipe for target 'test-gc-md5' failed
make[4]: *** [test-gc-md5] Error 1

Similarly for crypto/gc-sha1, crypto/gc-md2, crypto/gc-md4, crypto/gc-rijndael,
and crypto/gc-sm3.

This patch fixes it.


2019-08-24  Bruno Haible  <address@hidden>

        crypto/gc: Fix link error with --with-libgcrypt.
        * m4/gc.m4 (gl_GC): Set LIB_CRYPTO to the value found by the
        AC_LIB_HAVE_LINKFLAGS invocation.

diff --git a/m4/gc.m4 b/m4/gc.m4
index 954459a..a5d8f92 100644
--- a/m4/gc.m4
+++ b/m4/gc.m4
@@ -1,4 +1,4 @@
-# gc.m4 serial 11
+# gc.m4 serial 12
 dnl Copyright (C) 2005-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_GC],
 [
-  AC_SUBST([LIB_CRYPTO])
   AC_ARG_WITH([libgcrypt],
     AS_HELP_STRING([--with-libgcrypt], [use libgcrypt for low-level crypto]),
     libgcrypt=$withval, libgcrypt=no)
@@ -15,11 +14,15 @@ AC_DEFUN([gl_GC],
     # version 1.4.4 or later, so test for it early. */
     gl_good_gcrypt=no
     AM_PATH_LIBGCRYPT([1.4.4], [gl_good_gcrypt=yes],
-     [AC_MSG_ERROR([libgcrypt is too old])])
+      [AC_MSG_ERROR([libgcrypt is too old])])
     if test "x$gl_good_gcrypt" != xno; then
+      dnl Ignore the value of LIBGCRYPT_LIBS, because it does not include
+      dnl '-lgpg-error'.
       AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [#include <gcrypt.h>])
+      LIB_CRYPTO="$LIBGCRYPT"
     else
       AC_MSG_ERROR([libgcrypt not found])
     fi
   fi
+  AC_SUBST([LIB_CRYPTO])
 ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]