Bug 453566 - glib2 broken on big endian architectures
Summary: glib2 broken on big endian architectures
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: glib2
Version: rawhide
Hardware: powerpc
OS: Linux
high
high
Target Milestone: ---
Assignee: Matthias Clasen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 449944
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-07-01 12:04 UTC by Tomas Mraz
Modified: 2008-07-03 04:49 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2008-07-03 04:49:35 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.