#include <sys/types.h> before platform.h (in ptypes.h) to fix endian issues

Description

Deleted Component: misc

In common/unicode/ptypes.h, need to #include <sys/types.h> before unicode/platform.h in order to ensure BYTE_ORDER and BIG_ENDIAN are set properly for U_IS_BIG_ENDIAN to be correct.
Since they are undefined when we reach the header section
/** @{ Compiler and environment features
a big-endian build will end up pointing to little-endian data "icudt44l.dat", as follows:

U_ICUDATA_LANG in _getDisplayNameForComponent()
depends on: U_ICUDATA_NAME (./common/ureslocs.h)
depends on: U_ICUDATA_TYPE_LETTER (./common/unicode/utypes.h)
depends on: U_IS_BIG_ENDIAN (./common/unicode/platform.h.in)

Markus Scherer suggested the following fix in common/unicode/ptypes.h

#include <sys/types.h>

#include "unicode/platform.h"

Activity

Show:
TracBot
July 1, 2018, 9:56 AM
Trac Comment 6.7 by jason.woodward@5e1bbd342c26b10b—2010-08-06T23:45:16.579Z

Replying to (Comment 6 markus):

this breaks cross compiling:

LD_LIBRARY_PATH=/build/icu-4.4.1/icu-host-build/icu/source/lib:/build/icu-4.4.1/icu-host-build/icu/source/stubdata:/build/icu-4.4.1/icu-host-build/icu/source/tools/ctestfw:$LD_LIBRARY_PATH /build/icu-4.4.1/icu-host-build/icu/source/bin/genuca -s ./unidata -d ./out/build/icudt44l/coll -i ./out/build/icudt44l
Something returned an error 3 (U_INVALID_FORMAT_ERROR) while processing line 11688 of ./unidata/FractionalUCA.txt. Exiting...
make[1]: *** [out/build/icudt44l/coll/ucadata.icu] Error 3

strace reveals:

stat64("./out/build/icudt44b/icudt44l/cnvalias.icu", 0xbffc0014) = -1 ENOENT (No such file or directory)
stat64("./out/build/icudt44b/icudt44l.dat", 0xbffbff84) = -1 ENOENT (No such file or directory)
open("./unidata/FractionalUCA.txt", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "Couldn't open file: ./unidata/Fr"..., 48Couldn't open file: ./unidata/FractionalUCA.txt
) = 48

TracBot
July 1, 2018, 9:56 AM
Trac Comment 7.9 by jason.woodward@5e1bbd342c26b10b—2010-08-06T23:49:06.759Z

Replying to (Comment 7 jason.woodward@…):

strace reveals:

 

stat64("./out/build/icudt44b/icudt44l/cnvalias.icu", 0xbffc0014) = -1 ENOENT (No such file or directory)

stat64("./out/build/icudt44b/icudt44l.dat", 0xbffbff84) = -1 ENOENT (No such file or directory)

open("./unidata/FractionalUCA.txt", O_RDONLY) = -1 ENOENT (No such file or directory)

write(2, "Couldn't open file: ./unidata/Fr"..., 48Couldn't open file: ./unidata/FractionalUCA.txt

) = 48

Sorry, I had test modifications to icudefs.mk. The strace should say:

stat64("./out/build/icudt44b/icudt44l/nfc.nrm", 0xbfad15e4) = -1 ENOENT (No such file or directory)

TracBot
July 1, 2018, 9:56 AM
Trac Comment 10 by jason.woodward@5e1bbd342c26b10b—2010-08-07T01:55:59.939Z

this can be closed... turns out not to be related. refiled as new tick #7874

Fixed

Assignee

Peter Edberg

Reporter

TracBot

Components

None

Labels

None

Reviewer

None

Priority

major

Time Needed

None

Fix versions