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

Re: libcrypto++



* Jens Peter Secher:

> Steve Langasek <vorlon@debian.org> writes:
>
>> Below is a list of libraries which appear to be blocking other packages that
>> need to go through the C++ transition[1] and which are themselves ready to
>> go through the ABI transition.
> [...]
>> libcrypto++
>
> I am fighting with libcrypto++ but so far I am loosing.  
>
> GCC4 does definitely not like a mix of templates and anonymous enums
> [1,2] but there are easy fixes for this.
>
> What is worse, it seems that GCC4 silently refuses to generate code for
> some template instantiations, which results in undefined symbols in the
> library, as others have experienced [3].  It might however be the case
> that GCC4, being more C++ standards compliant, has simply revealed a
> problem in the Crypto++ template code.

There's another problem with libtool:

[...]
/bin/sh ./libtool --mode=link g++  -g -Wall -fno-strict-aliasing -O2   -o libcrypto++5.2.la -rpath /usr/lib -version-info 0:0:0 3way.lo adler32.lo algebra.lo algparam.lo arc4.lo asn.lo base32.lo base64.lo basecode.lo bfinit.lo blowfish.lo blumshub.lo camellia.lo cast.lo casts.lo cbcmac.lo channels.lo crc.lo cryptest.lo cryptlib.lo default.lo des.lo dessp.lo dh.lo dh2.lo dll.lo dsa.lo ec2n.lo eccrypto.lo ecp.lo elgamal.lo eprecomp.lo esign.lo files.lo filters.lo fips140.lo fipsalgt.lo fipstest.lo gf256.lo gf2_32.lo gf2n.lo gfpcrypt.lo gost.lo gzip.lo haval.lo hex.lo hmac.lo hrtimer.lo ida.lo idea.lo integer.lo iterhash.lo luc.lo mars.lo marss.lo md2.lo md4.lo md5.lo md5mac.lo misc.lo modes.lo modexppc.lo mqueue.lo mqv.lo nbtheory.lo network.lo oaep.lo osrng.lo panama.lo pch.lo pkcspad.lo polynomi.lo pssr.lo pubkey.lo queue.lo rabin.lo randpool.lo rc2.lo rc5.lo rc6.lo rdtables.lo regtest.lo rijndael.lo ripemd.lo rng.lo rsa.lo rw.lo safer.lo shacal2.lo seal.lo serpent.lo sha.lo shark.lo sharkbox.lo simple.lo skipjack.lo socketft.lo square.lo squaretb.lo strciphr.lo tea.lo tftables.lo tiger.lo tigertab.lo trdlocal.lo ttmac.lo twofish.lo wait.lo wake.lo whrlpool.lo winpipes.lo xtr.lo xtrcrypt.lo zdeflate.lo zinflate.lo zlib.lo  
./libtool: line 4120: test: : integer expression expected
./libtool: line 4120: test: : integer expression expected
creating reloadable object files...
./libtool: line 4154: test: : integer expression expected
./libtool: line 4154: test: : integer expression expected
[...]

After that, libtool performs linking with quadratic complexity:

[...]
/usr/bin/ld -r -o .libs/libcrypto++5.2.la-42.o .libs/gfpcrypt.o .libs/libcrypto+
+5.2.la-41.o
/usr/bin/ld -r -o .libs/libcrypto++5.2.la-43.o .libs/gost.o .libs/libcrypto++5.2
.la-42.o
/usr/bin/ld -r -o .libs/libcrypto++5.2.la-44.o .libs/gzip.o .libs/libcrypto++5.2
.la-43.o
/usr/bin/ld -r -o .libs/libcrypto++5.2.la-45.o .libs/haval.o .libs/libcrypto++5.
2.la-44.o
/usr/bin/ld -r -o .libs/libcrypto++5.2.la-46.o .libs/hex.o .libs/libcrypto++5.2.
la-45.o
[...]

Linking will not finish after reasonable time as a result.

This means that I'm probably not able to test my patch, which is
included below.

Sun Jul 24 12:05:11 CEST 2005  Florian Weimer <fw@deneb.enyo.de>
  * Make template instantiation compatible with GCC 4.0
  
  This patch is a kludge, but it will probably work.
diff -rN -u old-gcc-4.0-try/cryptopp_config.h.in new-gcc-4.0-try/cryptopp_config.h.in
--- old-gcc-4.0-try/cryptopp_config.h.in	2005-07-24 12:09:18.000000000 +0200
+++ new-gcc-4.0-try/cryptopp_config.h.in	2005-07-24 11:24:11.000000000 +0200
@@ -461,7 +461,7 @@
 #endif	// CRYPTOPP_WIN32_AVAILABLE
 
 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
-#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
+#define CRYPTOPP_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
 #elif defined(__MWERKS__)
 #define CRYPTOPP_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
 #else
@@ -469,7 +469,7 @@
 #endif
 
 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
-#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
+#define CRYPTOPP_STATIC_TEMPLATE_CLASS extern template class
 #elif defined(__MWERKS__)
 #define CRYPTOPP_STATIC_TEMPLATE_CLASS extern class
 #else
diff -rN -u old-gcc-4.0-try/dll.cpp new-gcc-4.0-try/dll.cpp
--- old-gcc-4.0-try/dll.cpp	2005-07-24 12:09:18.000000000 +0200
+++ new-gcc-4.0-try/dll.cpp	2005-07-24 11:23:03.000000000 +0200
@@ -20,8 +20,9 @@
 
 NAMESPACE_BEGIN(CryptoPP)
 
-#ifdef __MWERKS__
+#ifdef __MWERKS__ || __GNUC__
 // CodeWarrior 8 workaround: explicit instantiations have to appear after member function definitions
+// Workaround also needed by GCC 4.
 CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<ECP>;
 CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<EC2N>;
 CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;




Reply to: