Package: src:choreonoid
Version: 1.1.0+dfsg-6.1
Severity: normal
Tags: patch

Dear Maintainer,

While trying to build the package on ppc64el, I got this error:

<BUILDDIR>/choreonoid-1.1.0+dfsg/src/Collision/Opcode/OPC_OptimizedTree.cpp:579:35: error: cast from ‘Opcode::AABBCollisionNode*’ to ‘udword {aka unsigned int}’ loses precision [-fpermissive]
   udword Nb = (Data - udword(Nodes))/Nodes[i].GetNodeSize();

The issue seems to come from OPC_OptimizedTree.cpp's definition of REMAP_DATA which only handles x86_64 arch:

#ifdef __x86_64
#define REMAP_DATA(member)                                         \
    /* Fix data */                                                 \
    Data = Nodes[i].member;                                        \
    if(!(Data&1))                                                  \
    {                                                              \
        /* Compute box number */                                   \
        uqword Nb = (Data - uqword(Nodes))/Nodes[i].GetNodeSize(); \
        Data = uqword(&mNodes[Nb]);                                \
    }                                                              \
    /* ...remapped */                                              \
    mNodes[i].member = Data;
#else
#define REMAP_DATA(member)                                         \
    /* Fix data */                                                 \
    Data = Nodes[i].member;                                        \
    if(!(Data&1))                                                  \
    {                                                              \
        /* Compute box number */                                   \
        udword Nb = (Data - udword(Nodes))/Nodes[i].GetNodeSize(); \
        Data = udword(&mNodes[Nb]);                                \
    }                                                              \
    /* ...remapped */                                              \
    mNodes[i].member = Data;
#endif

For ppc64el, as for x86_64, uqword should be used instead of udword.
In the attached patch, I've changed the #ifdef line to this:
#if defined(__x86_64) || defined(__PPC64__)

Thanks for considering this patch.

Regards,
Erwan.


-- System Information:
Debian Release: jessie/sid
    APT prefers unstable
    APT policy: (500, 'unstable')
Architecture: ppc64el (ppc64le)

Kernel: Linux 3.13-1-powerpc64le (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash



diff -Naur a/debian/patches/fix-ppc64el.patch b/debian/patches/fix-ppc64el.patch
--- a/debian/patches/fix-ppc64el.patch	1970-01-01 01:00:00.000000000 +0100
+++ b/debian/patches/fix-ppc64el.patch	2014-10-22 16:00:54.756073954 +0200
@@ -0,0 +1,12 @@
+diff -Naur a/src/Collision/Opcode/OPC_OptimizedTree.cpp b/src/Collision/Opcode/OPC_OptimizedTree.cpp
+--- a/src/Collision/Opcode/OPC_OptimizedTree.cpp
++++ b/src/Collision/Opcode/OPC_OptimizedTree.cpp
+@@ -557,7 +557,7 @@
+ 		}																			\
+ 	}
+ 
+-#ifdef __x86_64
++#if defined(__x86_64) || defined(__PPC64__)
+ #define REMAP_DATA(member)											\
+ 	/* Fix data */													\
+ 	Data = Nodes[i].member;											\
diff -Naur a/debian/patches/series b/debian/patches/series
--- a/debian/patches/series	2014-10-16 12:09:30.164364404 +0200
+++ b/debian/patches/series	2014-10-22 16:01:22.268072491 +0200
@@ -7,3 +7,4 @@
 0007-Fix-cast-from-pointer-to-udword-losing-precision.patch
 0008-Fix-OpenSceneGraph-compilation-issues.patch
 0009-Install-libraries-always.patch
+fix-ppc64el.patch

Reply via email to