← Back to team overview

maria-developers team mailing list archive

Big endian issue in libmariadb: test: main.mysql_client_test fails

 

Hi,


We are building MariaDB on AIX.


The test: main.mysql_client_test fails (after time-out).

This is due to little endian code being used though HAVE_BIGENDIAN  is correctly set.


This is due to:

  libmariadb/libmariadb/ma_dtoa.c :

    #if defined(WORDS_BIGENDIAN) || (defined(__FLOAT_WORD_ORDER) && \

          (__FLOAT_WORD_ORDER == __BIG_ENDIAN))

   #define word0(x) (x)->L[0]

   #define word1(x) (x)->L[1]

   #else

   #define word0(x) (x)->L[1]

   #define word1(x) (x)->L[0]

   #endif

which results in the #else part (Little Endian) since none of the tested macros are defined.


File  libmariadb/libmariadb/ma_dtoa.c includes ma_global.h  which has:
  #define HAVE_BIGENDIAN 1

but nothing defined about WORDS_BIGENDIAN .


However, probably that some changes were made in the past in ma_global.h, since I see:

     #ifdef HAVE_BIGENDIAN

     #endif /* WORDS_BIGENDIAN */

2 times in this file.


I do not master MariaDB, so I do not have a clear idea about how to fix this.

I see 3 solutions:

  a) libmariadb/CMakeLists.txt :

      Add:  SET(HAVE_WORDS_BIGENDIAN TRUE ...) after : TEST_BIG_ENDIAN(HAVE_BIGENDIAN) if it is BigEndian.

  b) libmariadb/include/ma_global.h :

      Add:

          #ifdef HAVE_BIGENDIAN

               #define WORDS_BIGENDIAN 1

          #endif

  c) libmariadb/libmariadb/ma_dtoa.c :

          Change:

               #if defined(WORDS_BIGENDIAN) || (defined(__FLOAT_WORD_ORDER) && \

                          (__FLOAT_WORD_ORDER == __BIG_ENDIAN))

          by:

               #if defined(HAVE_BIGENDIAN) || defined(WORDS_BIGENDIAN) || (defined(__FLOAT_WORD_ORDER) && \

                          (__FLOAT_WORD_ORDER == __BIG_ENDIAN))



Please let me know which seems appropriate.


Regards,


Tony



ATOS / Bull SAS
ATOS Expert
IBM Coop Architect & Technical Leader
Office : +33 (0) 4 76 29 72 67
1 rue de Provence - 38432 Échirolles - France
www.atos.net<https://mail.ad.bull.net/owa/redir.aspx?C=PvphmPvCZkGrAgHVnWGsdMcDKgzl_dEIsM6rX0g4u4v8V81YffzBGkWrtQeAXNovd3ttkJL8JIc.&URL=http%3a%2f%2fwww.atos.net%2f>