bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* crypto/gc: fix link error with --with-libgcrypt
@ 2019-08-24 12:04 Bruno Haible
  2019-08-24 12:28 ` Bruno Haible
  0 siblings, 1 reply; 2+ messages in thread
From: Bruno Haible @ 2019-08-24 12:04 UTC (permalink / raw)
  To: bug-gnulib

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  <bruno@clisp.org>

	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])
 ])



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: crypto/gc: fix link error with --with-libgcrypt
  2019-08-24 12:04 crypto/gc: fix link error with --with-libgcrypt Bruno Haible
@ 2019-08-24 12:28 ` Bruno Haible
  0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2019-08-24 12:28 UTC (permalink / raw)
  To: bug-gnulib

> 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

Similar link errors also exist for crypto/gc-md2, crypto/gc-md4,
crypto/gc-rijndael, and they are not fixed through the previous patch.
This patch is necessary too:


2019-08-24  Bruno Haible  <bruno@clisp.org>

	crypto/gc-{md[24],rijndael} tests: Fix link error with --with-libgcrypt.
	* modules/crypto/gc-md2-tests (test_gc_md2_LDADD): New variable.
	* modules/crypto/gc-md4-tests (test_gc_md4_LDADD): New variable.
	* modules/crypto/gc-rijndael-tests (test_gc_rijndael_LDADD): New
	variable.

diff --git a/modules/crypto/gc-md2-tests b/modules/crypto/gc-md2-tests
index 759d3d5..74ccdf0 100644
--- a/modules/crypto/gc-md2-tests
+++ b/modules/crypto/gc-md2-tests
@@ -8,3 +8,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-gc-md2
 check_PROGRAMS += test-gc-md2
+test_gc_md2_LDADD = $(LDADD) @LIB_CRYPTO@
diff --git a/modules/crypto/gc-md4-tests b/modules/crypto/gc-md4-tests
index c6bd64a..b2a4ce1 100644
--- a/modules/crypto/gc-md4-tests
+++ b/modules/crypto/gc-md4-tests
@@ -8,3 +8,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-gc-md4
 check_PROGRAMS += test-gc-md4
+test_gc_md4_LDADD = $(LDADD) @LIB_CRYPTO@
diff --git a/modules/crypto/gc-rijndael-tests b/modules/crypto/gc-rijndael-tests
index 1bf2433..c7aaee2 100644
--- a/modules/crypto/gc-rijndael-tests
+++ b/modules/crypto/gc-rijndael-tests
@@ -8,3 +8,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-gc-rijndael
 check_PROGRAMS += test-gc-rijndael
+test_gc_rijndael_LDADD = $(LDADD) @LIB_CRYPTO@



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-24 12:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-24 12:04 crypto/gc: fix link error with --with-libgcrypt Bruno Haible
2019-08-24 12:28 ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).