Open LubosD opened 5 years ago
Thank you!! This is exactly what happened to my build! I use Termux on my android phone which uses clang as the default compiler. According to this answer https://stackoverflow.com/questions/2100331/c-macro-definition-to-determine-big-endian-or-little-endian-machine/2100391#2100391, I run on terminal:
λ [~] $ gcc -E -dM - < /dev/null |grep ENDIAN
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __LITTLE_ENDIAN__ 1
#define __ORDER_BIG_ENDIAN__ 4321
#define __ORDER_LITTLE_ENDIAN__ 1234
#define __ORDER_PDP_ENDIAN__ 3412
λ [~] $
My ARM is little endian with __LITTLE_ENDIAN__
flag defined. There are BIG_ENDIAN
_BIG_ENDIAN
and __BIG_ENDIAN
defined in /sysroot/usr/include/sys/endian.h
, but there is no __BIG_ENDIAN__
So a quick fix in my case would be replacing all entries: #ifndef _BIG_ENDIAN
with #ifndef __BIG_ENDIAN__
in src/jbig2structs.h
and src/jbig2segments.h
I've just spent a few hours figuring out why jbig2enc compiled for Android/arm produces output that cannot be decoded...
In
jbig2structs.h
there's a comment saying:The problem is Android has its own definition of
_BIG_ENDIAN
coming from here:Which makes your code assume it's being compiled for a big endian platform.