tofutim
tofutim

Reputation: 23374

Compiling ICU for Android: error: 'ICU_Utility' has not been declared

While compiling ICU for android, the following error is encountered:

/home/tim/icu49/icu/source/i18n/strmatch.cpp: In member function 'virtual icu_49::UnicodeString& icu_49::StringMatcher::toPattern(icu_49::UnicodeString&, UBool) const':
/home/tim/icu49/icu/source/i18n/strmatch.cpp:166: error: 'ICU_Utility' has not been declared
/home/tim/icu49/icu/source/i18n/strmatch.cpp:168: error: 'ICU_Utility' has not been declared
/home/tim/icu49/icu/source/i18n/strmatch.cpp:176: error: 'ICU_Utility' has not been declared
/home/tim/icu49/icu/source/i18n/strmatch.cpp: In member function 'virtual icu_49::UnicodeString& icu_49::StringMatcher::toReplacerPattern(icu_49::UnicodeString&, UBool) const':
/home/tim/icu49/icu/source/i18n/strmatch.cpp:243: error: 'ICU_Utility' has not been declared
make[1]: *** [strmatch.ao] Error 1
make[1]: Leaving directory `/home/tim/icu49/icu-android/i18n'
make: *** [all-recursive] Error 2

Update. As a hack, this can be solved with -DUCONFIG_NO_TRANSLITERATION (basically ignores the offending block). Doing this gets you past 'strmatch.cpp', but the error re-appears in dbgutil.cpp:143 and 145. Fixable using -DUCONFIG_NO_FORMATTING (losing another feature...) (Next issue: In function icu_49::IcuToolErrorCode::~IcuToolErrorCode()': toolutil.cpp:(.text+0x400): undefined reference to__cxa_end_cleanup')

Update2. This one is very strange. I undid my configuration changes. In i18n/strmatch.cpp, "util.h" is included. But it seems that it is never called which is why ICU_Utility is not defined. ("util.h" is in icu/source/common). Interestingly, if you use #include "../common/util.h" instead of #include "util.h" it works.

Of course, this now makes sense, because

tim@N01:~/icu49$ find android-ndk-r7b/ -name util.h
android-ndk-r7b/platforms/android-4/arch-x86/usr/include/util.h
android-ndk-r7b/platforms/android-4/arch-arm/usr/include/util.h
android-ndk-r7b/platforms/android-8/arch-x86/usr/include/util.h
android-ndk-r7b/platforms/android-8/arch-arm/usr/include/util.h
android-ndk-r7b/platforms/android-14/arch-x86/usr/include/util.h
android-ndk-r7b/platforms/android-14/arch-arm/usr/include/util.h
android-ndk-r7b/platforms/android-3/arch-x86/usr/include/util.h
android-ndk-r7b/platforms/android-3/arch-arm/usr/include/util.h
android-ndk-r7b/platforms/android-5/arch-x86/usr/include/util.h
android-ndk-r7b/platforms/android-5/arch-arm/usr/include/util.h
android-ndk-r7b/platforms/android-9/arch-x86/usr/include/util.h
android-ndk-r7b/platforms/android-9/arch-arm/usr/include/util.h

Upvotes: 1

Views: 614

Answers (1)

tofutim
tofutim

Reputation: 23374

Renaming the android-X version from util.h to _util.h provides quick resolution to this issue.

Upvotes: 2

Related Questions