Package: r-cran-curl
Version: 0.9.6-1
Severity: important
Tags: upstream patch

r-cran-curl fails to build on big endian architectures. Here are the
relevant parts of the build log:

| gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
-D_FORTIFY_SOURCE=2 -g  -c curl.c -o curl.o
| curl.c: In function 'rcurl_fgetc':
| curl.c:138:38: warning: implicit declaration of function 'BSWAP_32' 
|    return rcurl_read(&x, 1, 1, con) ? BSWAP_32(x) : R_EOF;
|                                       ^


| ** testing if installed package can be loaded
| Error in dyn.load(file, DLLpath = DLLpath, ...) : 
|   unable to load shared object 
|   /«PKGBUILDDIR»/debian/r-cran-curl/usr/lib/R/site-library/curl/libs/ 
undefined symbol: BSWAP_32
| Error: loading failed
| Execution halted
| ERROR: loading failed

The problem is that BSWAP_32 is only defined for Sun, Apple or OpenBSD.
Please find a patch below to also define it for GLIBC based systems.

--- r-cran-curl-0.9.6.orig/src/curl.c
+++ r-cran-curl-0.9.6/src/curl.c
@@ -23,6 +23,9 @@
 #define BSWAP_32 OSSwapInt32
 #elif (defined(__OpenBSD__))
 #define BSWAP_32(x) swap32(x)
+#elif (defined(__GLIBC__))
+#include <byteswap.h>
+#define BSWAP_32(x) bswap_32(x)
 /* the RConnection API is experimental and subject to change */

Note that it prevents a few r-cran packages to build on big-endian
architectures, so an upload with this patch would be appreciated.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: mips (mips64)

Kernel: Linux 4.7.0-1-5kc-malta
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Reply via email to