[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#734273: sphinxtrain: FTBFS on big endian: Bad use of SWAP_LE_32()



Package: sphinxtrain
Version: 1.0.8-1
Severity: important
Tags: patch
User: debian-powerpcspe@breakpoint.cc
Usertags: powerpcspe

Hi,

on big endian architectures (powerpc, powerpcspe, ppc64, s390x, sparc),
sphinxtrain FTBFS like this:

...
Making all in mk_s2sendump
make[4]: Entering directory `/«PKGBUILDDIR»/src/programs/mk_s2sendump'
gcc -DPACKAGE_NAME=\"SphinxTrain\" -DPACKAGE_TARNAME=\"sphinxtrain\" -DPACKAGE_VERSION=\"1.0.8\" -DPACKAGE_STRING=\"SphinxTrain\ 1.0.8\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DWORDS_BIGENDIAN=1 -DHAVE_LIBM=1 -I. -I../../../include  -I/usr/include/powerpc-linux-gnuspe -I/usr/include/powerpc-linux-gnuspe/sphinxbase    -g -O2 -c mk_s2sendump.c
mk_s2sendump.c: In function 'fwrite_int32':
mk_s2sendump.c:85:5: error: invalid type argument of unary '*' (have 'int32')
mk_s2sendump.c:85:5: error: invalid type argument of unary '*' (have 'int32')
mk_s2sendump.c:85:5: error: invalid type argument of unary '*' (have 'int32')
mk_s2sendump.c:85:5: error: invalid type argument of unary '*' (have 'int32')
mk_s2sendump.c:85:5: error: invalid type argument of unary '*' (have 'int32')
make[4]: *** [mk_s2sendump.o] Error 1
make[4]: Leaving directory `/«PKGBUILDDIR»/src/programs/mk_s2sendump'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/«PKGBUILDDIR»/src/programs'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/«PKGBUILDDIR»/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/«PKGBUILDDIR»'
dh_auto_build: make -j1 returned exit code 2
make: *** [build-arch] Error 2
dpkg-buildpackage: error: debian/rules build-arch gave error exit status 2
...

This is due to wrong (probably untested) use of SWAP_LE_32() conditionally
defined to be returning identity on little endian. However, on big endian
arches, it requires the pointer to the object, not the object itself. The
attached patch fixes this.

Roland

-- System Information:
Debian Release: 7.0
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: powerpcspe (ppc)

Kernel: Linux 3.9.0-dirty (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/dash
Index: sphinxtrain-1.0.8/src/programs/mk_s2sendump/mk_s2sendump.c
===================================================================
--- sphinxtrain-1.0.8.orig/src/programs/mk_s2sendump/mk_s2sendump.c	2014-01-05 14:25:43.000000000 +0100
+++ sphinxtrain-1.0.8/src/programs/mk_s2sendump/mk_s2sendump.c	2014-01-05 14:25:43.000000000 +0100
@@ -82,7 +82,7 @@
 
 static void fwrite_int32 (FILE *fp, int32 val)
 {
-    SWAP_LE_32(val);
+    SWAP_LE_32(&val);
     fwrite (&val, sizeof(int), 1, fp);
 }
 

Reply to: