Package: liblucy-perl
Version: 0.3.3-2
Tags: sid patch
Severity: important
Justification: FTBFS
User: debian-mips-dev-disc...@lists.alioth.debian.org
Usertags: mips-patch



While trying to build liblucy-perl on mips architecture,
build fails on testing with an error:
> Test Summary Report
> -------------------
> t/511-sort_spec.t                   (Wstat: 10 Tests: 0 Failed: 0)
>   Non-zero wait status: 10
>   Parse errors: Bad plan.  You planned 18 tests but ran 0.
> Files=173, Tests=12293, 143 wallclock secs ( 9.98 usr  1.56 sys + 117.80 cusr 
>  8.88 csys = 138.22 CPU)
> Result: FAIL

Here is full build log:
https://buildd.debian.org/status/fetch.php?pkg=liblucy-perl&arch=mips&ver=0.3.3-2&stamp=1403494561

The same test failed in the past for mipsel as well:
https://buildd.debian.org/status/fetch.php?pkg=liblucy-perl&arch=mipsel&ver=0.3.3-1&stamp=1401734413



Both failures had happened on Broadcom boards.
I run test manually and got a Bus Error,
which is caused by unaligned access.


A patch which fixes this issue is attached.

After applying this patch,
package builds successfully for mips and mipsel.


Could you please consider including this patch?


Best regards,
Dejan
diff -uNr liblucy-perl-0.3.3.orig/core/Lucy/Util/MemoryPool.c liblucy-perl-0.3.3/core/Lucy/Util/MemoryPool.c
--- liblucy-perl-0.3.3.orig/core/Lucy/Util/MemoryPool.c	2014-05-23 16:43:30.000000000 +0000
+++ liblucy-perl-0.3.3/core/Lucy/Util/MemoryPool.c	2014-09-25 15:37:28.000000000 +0000
@@ -24,12 +24,19 @@
 
 #define DEFAULT_BUF_SIZE 0x100000 // 1 MiB
 
+// On MIPS, access to double values need to be 8-bytes aligned.
+#if defined (__mips__)
+#define BYTE_ALIGNED sizeof(double);
+#else
+#define BYTE_ALIGNED sizeof(void*);
+#endif
+
 // Enlarge amount so pointers will always be aligned.
 #define INCREASE_TO_WORD_MULTIPLE(_amount) \
     do { \
-        const size_t _remainder = _amount % sizeof(void*); \
+        const size_t _remainder = _amount % BYTE_ALIGNED; \
         if (_remainder) { \
-            _amount += sizeof(void*); \
+            _amount += BYTE_ALIGNED; \
             _amount -= _remainder; \
         } \
     } while (0)

Reply via email to