Bug 453566

Summary: glib2 broken on big endian architectures
Product: [Fedora] Fedora Reporter: Tomas Mraz <tmraz>
Component: glib2Assignee: Matthias Clasen <mclasen>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: powerpc   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-07-03 04:49:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 449944    
Bug Blocks:    

Description Tomas Mraz 2008-07-01 12:04:20 UTC
Due to bug 449944 of autoconf the glib2 macros to convert the LE/BE endiannes to
internal representation are broken on all big endian architectures - most
notably PPC/PPC64. That means that all packages which use these macros from
glib2 are badly broken on big endian machines and they will have to be rebuilt
after the fixed glib2 is in.

Comment 1 Matthias Clasen 2008-07-02 15:37:46 UTC
Tomas, do you have a workaround that I can use in glib until autoconf is fixed ?

Comment 2 Matthias Clasen 2008-07-02 15:47:45 UTC
Does this look like it will work ?

--- configure.in.endian 2008-07-02 11:43:44.000000000 -0400
+++ configure.in        2008-07-02 11:46:20.000000000 -0400
@@ -3159,18 +3159,21 @@
 g_have_gnuc_visibility=$g_have_gnuc_visibility
 g_have_sunstudio_visibility=$g_have_sunstudio_visibility

-case xyes in
-x$ac_cv_c_bigendian)
+if test x$ac_cv_c_bigendian = xyes; then
   g_byte_order=G_BIG_ENDIAN
   g_bs_native=BE
   g_bs_alien=LE
-  ;;
-*)
-  g_byte_order=G_LITTLE_ENDIAN
-  g_bs_native=LE
-  g_bs_alien=BE
-  ;;
-esac
+else
+  if test x$ac_cv_c_bigendian = xuniversal then
+    g_byte_order=G_BIG_ENDIAN
+    g_bs_native=BE
+    g_bs_alien=LE
+  else
+    g_byte_order=G_LITTLE_ENDIAN
+    g_bs_native=LE
+    g_bs_alien=BE
+  fi
+fi

 g_pollin=$glib_cv_value_POLLIN
 g_pollout=$glib_cv_value_POLLOUT


Comment 3 Tomas Mraz 2008-07-02 18:56:40 UTC
No, that would make it break on little endian machines, because the
ac_cv_c_bigendian contains always universal with this autoconf version.

You can try to add something like this after the AC_C_BIGENDIAN:

if test x$ac_cv_c_bigendian = xuniversal ; then
AC_TRY_COMPILE([#include <endian.h>], [#if __BYTE_ORDER == __BIG_ENDIAN. 
#else. 
#error Not a big endian. 
#endif],. 
    ac_cv_c_bigendian=yes
    ,AC_TRY_COMPILE([#include <endian.h>], [#if __BYTE_ORDER == __LITTLE_ENDIAN.
#else. 
#error Not a little endian. 
#endif],. 
    ac_cv_c_bigendian=no
    ,AC_MSG_WARN([Could not determine endianness.])))
fi


Comment 4 Matthias Clasen 2008-07-03 04:49:35 UTC
I've added these workarounds in 2.17.3-1.fc10