Bug#1002727: gnunet: FTBFS on BE systems [PATCH]

2021-12-28 Thread Gianfranco Costamagna
control: severity -1 serious


Hello, I forgot to mention:
1) please forward upstream (either the bug or the fix)
2) this fix needs another patch cherry-picked from upstream
https://git.gnunet.org/gnunet.git/commit/src/include/gnunet_common.h?id=83c0efff026598098addfabdf72698d5d13b7b48

You can also find the full diff here
http://launchpadlibrarian.net/577009313/gnunet_0.15.3-1_0.15.3-1ubuntu1.diff.gz

thanks

Gianfranco

On Tue, 28 Dec 2021 12:14:43 +0100 Gianfranco Costamagna 
 wrote:
> Source: gnunet
> Version: 0.15.3-1
> Tags: patch
> 
> Hello, the package now FTBFS on BE systems due to BYTE_SWAP_* not being 
> defined
> 
> e.g.
> ./src/conversation/gnunet-helper-audio-record.c:719: undefined reference to 
> `BYTE_SWAP_16'
> /usr/bin/ld: 
> /tmp/ccYZxpAw.ltrans0.ltrans.o:./src/conversation/gnunet-helper-audio-record.c:720:
>  undefined reference to `BYTE_SWAP_32'
> /usr/bin/ld: 
> /tmp/ccYZxpAw.ltrans0.ltrans.o:./src/conversation/gnunet-helper-audio-record.c:721:
>  undefined reference to `BYTE_SWAP_16'
> /usr/bin/ld: 
> /tmp/ccYZxpAw.ltrans0.ltrans.o:./src/conversation/gnunet-helper-audio-record.c:754:
>  undefined reference to `BYTE_SWAP_32'
> /usr/bin/ld: 
> /tmp/ccYZxpAw.ltrans0.ltrans.o:./src/conversation/gnunet-helper-audio-record.c:757:
>  undefined reference to `BYTE_SWAP_32'
> 
> The following patch might address the issue by defining it on the BIG_ENDIAN 
> if branch too:
> 
> 
> --- gnunet-0.15.3.orig/src/include/gnunet_common.h
> +++ gnunet-0.15.3/src/include/gnunet_common.h
> @@ -178,6 +178,15 @@ enum GNUNET_GenericReturnValue
>  #define GNUNET_le64toh(x) (x)
>  #endif
>  #if __BYTE_ORDER == __BIG_ENDIAN
> +#ifdef HAVE_BYTESWAP_H
> +#define BYTE_SWAP_16(x) bswap_16 (x)
> +#define BYTE_SWAP_32(x) bswap_32 (x)
> +#define BYTE_SWAP_64(x) bswap_64 (x)
> +#else
> +#define BYTE_SWAP_16(x) __bswap_16 (x)
> +#define BYTE_SWAP_32(x) __bswap_32 (x)
> +#define BYTE_SWAP_64(x) __bswap_64 (x)
> +#endif
>  #define GNUNET_htobe16(x) (x)
>  #define GNUNET_htole16(x) BYTE_SWAP_16 (x)
>  #define GNUNET_be16toh(x) (x)
> 
> 



Bug#1002727: gnunet: FTBFS on BE systems [PATCH]

2021-12-28 Thread Gianfranco Costamagna
Source: gnunet
Version: 0.15.3-1
Tags: patch

Hello, the package now FTBFS on BE systems due to BYTE_SWAP_* not being defined

e.g.
./src/conversation/gnunet-helper-audio-record.c:719: undefined reference to 
`BYTE_SWAP_16'
/usr/bin/ld: 
/tmp/ccYZxpAw.ltrans0.ltrans.o:./src/conversation/gnunet-helper-audio-record.c:720:
 undefined reference to `BYTE_SWAP_32'
/usr/bin/ld: 
/tmp/ccYZxpAw.ltrans0.ltrans.o:./src/conversation/gnunet-helper-audio-record.c:721:
 undefined reference to `BYTE_SWAP_16'
/usr/bin/ld: 
/tmp/ccYZxpAw.ltrans0.ltrans.o:./src/conversation/gnunet-helper-audio-record.c:754:
 undefined reference to `BYTE_SWAP_32'
/usr/bin/ld: 
/tmp/ccYZxpAw.ltrans0.ltrans.o:./src/conversation/gnunet-helper-audio-record.c:757:
 undefined reference to `BYTE_SWAP_32'

The following patch might address the issue by defining it on the BIG_ENDIAN if 
branch too:


--- gnunet-0.15.3.orig/src/include/gnunet_common.h
+++ gnunet-0.15.3/src/include/gnunet_common.h
@@ -178,6 +178,15 @@ enum GNUNET_GenericReturnValue
 #define GNUNET_le64toh(x) (x)
 #endif
 #if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef HAVE_BYTESWAP_H
+#define BYTE_SWAP_16(x) bswap_16 (x)
+#define BYTE_SWAP_32(x) bswap_32 (x)
+#define BYTE_SWAP_64(x) bswap_64 (x)
+#else
+#define BYTE_SWAP_16(x) __bswap_16 (x)
+#define BYTE_SWAP_32(x) __bswap_32 (x)
+#define BYTE_SWAP_64(x) __bswap_64 (x)
+#endif
 #define GNUNET_htobe16(x) (x)
 #define GNUNET_htole16(x) BYTE_SWAP_16 (x)
 #define GNUNET_be16toh(x) (x)