Bug#876848: haskell-cryptonite FTBFS on non-x86: error: redefinition of 'store_le32'

James Clarke jrtc27 at debian.org
Mon Oct 16 12:46:28 UTC 2017


Control: tags -1 patch

On Tue, Sep 26, 2017 at 02:07:07PM +0300, Adrian Bunk wrote:
> Source: haskell-cryptonite
> Version: 0.23-1
> Severity: serious
>
> https://buildd.debian.org/status/package.php?p=haskell-cryptonite&suite=sid
>
> ...
> [119 of 119] Compiling Crypto.Cipher.AES ( Crypto/Cipher/AES.hs, dist-ghc/build/Crypto/Cipher/AES.p_o )
>
> In file included from cbits/aes/block128.h:35:0: error:
>     0,
>                      from cbits/cryptonite_aes.h:36,
>                      from cbits/aes/generic.c:35:
>
> cbits/cryptonite_align.h:160:20: error:
>      error: redefinition of 'store_le32'
>      static inline void store_le32(uint8_t *dst, const uint32_t v)
>                         ^~~~~~~~~~
>
> cbits/cryptonite_align.h:135:20: error:
>      note: previous definition of 'store_le32' was here
>      static inline void store_le32(uint8_t *p, uint32_t val)
>                         ^~~~~~~~~~
>
> cbits/cryptonite_align.h:169:20: error:
>      error: redefinition of 'store_be32'
>      static inline void store_be32(uint8_t *dst, const uint32_t v)
>                         ^~~~~~~~~~
>
> cbits/cryptonite_align.h:104:20: error:
>      note: previous definition of 'store_be32' was here
>      static inline void store_be32(uint8_t *p, uint32_t val)
>                         ^~~~~~~~~~
>
> cbits/cryptonite_align.h:178:20: error:
>      error: redefinition of 'store_le64'
>      static inline void store_le64(uint8_t *dst, const uint64_t v)
>                         ^~~~~~~~~~
>
> cbits/cryptonite_align.h:143:20: error:
>      note: previous definition of 'store_le64' was here
>      static inline void store_le64(uint8_t *p, uint64_t val)
>                         ^~~~~~~~~~
>
> cbits/cryptonite_align.h:188:20: error:
>      error: redefinition of 'store_be64'
>      static inline void store_be64(uint8_t *dst, const uint64_t v)
>                         ^~~~~~~~~~
>
> cbits/cryptonite_align.h:112:20: error:
>      note: previous definition of 'store_be64' was here
>      static inline void store_be64(uint8_t *p, uint64_t val)
>                         ^~~~~~~~~~
> `gcc' failed in phase `C Compiler'. (Exit code: 1)
> /usr/share/cdbs/1/class/hlibrary.mk:147: recipe for target 'build-ghc-stamp' failed
> make: *** [build-ghc-stamp] Error 1
>
>
> debian/patches/more-alignment.patch and upstream seem to add
> the same code with different formatting to cryptonite_align.h

This is because more-alignment.patch included changes to
cryptonite_align.h which were in 0.22, so after the upload of 0.23 these
duplicates appeared. The fix is to simply drop those hunks from
more-alignment.patch, as in the attached debdiff.

Regards,
James
-------------- next part --------------
diff -Nru haskell-cryptonite-0.23/debian/patches/more-alignment.patch haskell-cryptonite-0.23/debian/patches/more-alignment.patch
--- haskell-cryptonite-0.23/debian/patches/more-alignment.patch	2017-09-16 21:10:13.000000000 +0100
+++ haskell-cryptonite-0.23/debian/patches/more-alignment.patch	2017-10-16 11:56:40.000000000 +0100
@@ -3,119 +3,6 @@
 Forwarded: https://github.com/haskell-crypto/cryptonite/pull/175
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/cbits/cryptonite_align.h
-+++ b/cbits/cryptonite_align.h
-@@ -34,9 +34,24 @@
- #define need_alignment(p,n) IS_ALIGNED(p,n)
- #endif
- 
-+static inline uint32_t load_be32_aligned(const uint8_t *p)
-+{
-+	return be32_to_cpu(*((uint32_t *) p));
-+}
-+
-+static inline uint64_t load_be64_aligned(const uint8_t *p)
-+{
-+	return be64_to_cpu(*((uint64_t *) p));
-+}
-+
-+static inline uint64_t load_le64_aligned(const uint8_t *p)
-+{
-+	return le64_to_cpu(*((uint64_t *) p));
-+}
-+
- static inline uint32_t load_le32_aligned(const uint8_t *p)
- {
--	return le32_to_cpu(*((uint32_t *) p));		
-+	return le32_to_cpu(*((uint32_t *) p));
- }
- 
- static inline void store_le32_aligned(uint8_t *dst, const uint32_t v)
-@@ -60,12 +75,83 @@ static inline void store_be64_aligned(ui
- }
- 
- #ifdef UNALIGNED_ACCESS_OK
--#define load_le32(a) load_le32_aligned(a)
-+
-+#define load_be32(p) load_be32_aligned(p)
-+#define load_be64(p) load_be64_aligned(p)
-+
-+#define store_be32(p, v) store_be32_aligned((p), (v))
-+#define store_be64(p, v) store_be64_aligned((p), (v))
-+
-+#define load_le32(p) load_le32_aligned(p)
-+#define load_le64(p) load_le64_aligned(p)
-+
-+#define store_le32(p, v) store_le32_aligned((p), (v))
-+#define store_le64(p, v) store_le64_aligned((p), (v))
-+
- #else
-+
-+static inline uint32_t load_be32(const uint8_t *p)
-+{
-+	return ((uint32_t)p[0] << 24) | ((uint32_t)p[1] << 16) | ((uint32_t)p[2] <<  8) | ((uint32_t)p[3]);
-+}
-+
-+static inline uint64_t load_be64(const uint8_t *p)
-+{
-+	return ((uint64_t)p[0] << 56) | ((uint64_t)p[1] << 48) | ((uint64_t)p[2] << 40) | ((uint64_t)p[3] << 32) |
-+	       ((uint64_t)p[4] << 24) | ((uint64_t)p[5] << 16) | ((uint64_t)p[6] <<  8) | ((uint64_t)p[7]);
-+}
-+
-+static inline void store_be32(uint8_t *p, uint32_t val)
-+{
-+	p[0] = (val >> 24);
-+	p[1] = (val >> 16) & 0xFF;
-+	p[2] = (val >>  8) & 0xFF;
-+	p[3] = (val      ) & 0xFF;
-+}
-+
-+static inline void store_be64(uint8_t *p, uint64_t val)
-+{
-+	p[0] = (val >> 56);
-+	p[1] = (val >> 48) & 0xFF;
-+	p[2] = (val >> 40) & 0xFF;
-+	p[3] = (val >> 32) & 0xFF;
-+	p[4] = (val >> 24) & 0xFF;
-+	p[5] = (val >> 16) & 0xFF;
-+	p[6] = (val >>  8) & 0xFF;
-+	p[7] = (val      ) & 0xFF;
-+}
-+
- static inline uint32_t load_le32(const uint8_t *p)
- {
- 	return ((uint32_t)p[0]) | ((uint32_t)p[1] <<  8) | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24);
- }
-+
-+static inline uint64_t load_le64(const uint8_t *p)
-+{
-+	return ((uint64_t)p[0]) | ((uint64_t)p[1] <<  8) | ((uint64_t)p[2] << 16) | ((uint64_t)p[3] << 24) |
-+	       ((uint64_t)p[4] << 32) | ((uint64_t)p[5] << 40) | ((uint64_t)p[6] << 48) | ((uint64_t)p[7] << 56);
-+}
-+
-+static inline void store_le32(uint8_t *p, uint32_t val)
-+{
-+	p[0] = (val      ) & 0xFF;
-+	p[1] = (val >>  8) & 0xFF;
-+	p[2] = (val >> 16) & 0xFF;
-+	p[3] = (val >> 24);
-+}
-+
-+static inline void store_le64(uint8_t *p, uint64_t val)
-+{
-+	p[0] = (val      ) & 0xFF;
-+	p[1] = (val >>  8) & 0xFF;
-+	p[2] = (val >> 16) & 0xFF;
-+	p[3] = (val >> 24) & 0xFF;
-+	p[4] = (val >> 32) & 0xFF;
-+	p[5] = (val >> 40) & 0xFF;
-+	p[6] = (val >> 48) & 0xFF;
-+	p[7] = (val >> 56);
-+}
-+
- #endif
- 
- #ifdef UNALIGNED_ACCESS_OK
 --- a/cbits/cryptonite_poly1305.c
 +++ b/cbits/cryptonite_poly1305.c
 @@ -37,11 +37,7 @@


More information about the Pkg-haskell-maintainers mailing list