unicode-org / icu-jira-safari

Note: GitHub provides this directly now.
https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls
Other
4 stars 4 forks source link

Compilation of icu70.1 fails on solaris 11.3 #1

Open Hanumesh96 opened 3 years ago

Hanumesh96 commented 3 years ago

Hi, Iam trying to build icu70.1 on "SunOS 11.3 sparc sun4v", using oracle developer studio 12.5. Iam facing below issues:

  1. escapesrc: /build/icu/source/common/rbbi.cpp -> _rbbi.cpp /comms/tools/apps/solarisstudio125/bin/CC -DU_DEBUG=1 -DU_HAVE_ELF_H=1 -DU_HAVE_STRTOD_L=0 -I/build/icu/source/common "-DDEFAULT_ICU_PLUGINS=\"/build/built/icu/SunOS5.11_64_DBG.OBJ/lib/icu\" " -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION -xarch=sparc -m64 -norunpath -g -Wno-ambiguous-reversed-operator -mt -std=c++11 -c -DPIC -KPIC -o rbbi.o _rbbi.cpp "/build/icu/source/common/rbbi.cpp", line 795: Error: icu_70::RuleBasedBreakIterator::PTrieFunc is not accessible from icu_70. "/build/icu/source/common/rbbi.cpp", line 980: Error: icu_70::RuleBasedBreakIterator::PTrieFunc is not accessible from icu_70. 2 Error(s) detected. gmake[2]: *** [rbbi.o] Error 2

  2. escapesrc: /build/icu/source/common/umutex.cpp -> _umutex.cpp /comms/tools/apps/solarisstudio125/bin/CC -DU_DEBUG=1 -DU_HAVE_ELF_H=1 -DU_HAVE_STRTOD_L=0 -I/build/icu/source/common "-DDEFAULT_ICU_PLUGINS=\"/build/built/icu/SunOS5.11_64_DBG.OBJ/lib/icu\" " -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION -xarch=sparc -m64 -norunpath -g -Wno-ambiguous-reversed-operator -mt -std=c++11 -c -DPIC -KPIC -o umutex.o _umutex.cpp "/build/icu/source/common/umutex.cpp", line 73: Warning: Deducing non-void lambda return type 'std::mutex*' from lambda without a single return statement. "/build/icu/source/common/umutex.cpp", line 74: Warning: Deducing non-void lambda return type 'std::condition_variable*' from lambda without a single return statement. "/build/icu/source/common/umutex.cpp", line 73: Error: icu_70::umtx_init::{lambda at umutex.cpp,73:17}::operator()() const and icu_70::umtx_init::{lambda at umutex.cpp,74:21}::operator()() const have same extern name "(". 1 Error(s) and 2 Warning(s) detected.* gmake[2]: [umutex.o] Error 2

1st issue is gone after making few instructions public in unicode/rbbi.h as shown in the file sdiff_of_first_issue.txt, I hope this fix is correct, let me know.

I need help to solve 2nd issue. Iam pasting entire build output in this file build_output.txt, in case if you need it.

.Thanks, Hanumesh

markusicu commented 3 years ago

First issue: rbbi.cpp lines 795..796 are

template <typename RowType, RuleBasedBreakIterator::PTrieFunc trieFunc>
int32_t RuleBasedBreakIterator::handleNext() {

so the diff suggests that the compiler wants the second template type to not be private inside the RBBI class. But it works on other compilers, including with strict settings. Could this be a known Solaris compiler bug?

The diff makes the type public in the public-API class. That's not good. We would have to mark it @internal which is still visible and thus messy.


The second issue is about the first two of the three lines in the function body of

static void U_CALLCONV umtx_init() {
    initMutex = STATIC_NEW(std::mutex);
    initCondition = STATIC_NEW(std::condition_variable);
    ucln_common_registerCleanup(UCLN_COMMON_MUTEX, umtx_cleanup);
}

STATIC_NEW is a macro, defined here: https://github.com/unicode-org/icu/blob/main/icu4c/source/common/cmemory.h#L125-L146 The lambda function there very clearly has exactly one return statement, so I don't know why the compiler complains about it.

FYI @aheninger @jefgen

aheninger commented 3 years ago

For the second problem, you could try manually expanding both the STATIC_NEW macro and the lambda function as inline code at the call sites - maybe that would work around the problem. It feels like a compiler issue.

Something like this at line 73

    alignas(std::mutex) static char storage[sizeof(std::mutex)];
    initMutex = new(storage) std::mutex();

and something similar for the next line.

Hanumesh96 commented 3 years ago

Thanks for your comments @markusicu and @jefgen

For the second problem, as suggested by @jefgen, I have expanded both the STATIC_NEW macro and the lambda function as inline code as shown below: <<< alignas(std::mutex) static char storage[sizeof(std::mutex)]; initMutex = new(storage) std::mutex(); alignas(std::condition_variable) static char mystorage[sizeof(std::condition_variable)]; initCondition = new(mystorage) std::condition_variable();

With the above change the compilation was successful.

Next it encountered link error as shown below: <<< /comms/tools/apps/solarisstudio125/bin/CC -xarch=sparc -m64 -norunpath -g -Wno-ambiguous-reversed-operator -mt -std=c++11 -Wl,-R\$ORIGIN/../lib:/comms/tools/apps/solarisstudio125/lib/compilers/atomic/sparcv9 -z defs -z text -z ignore -lCstd -lCrun -lc -G -h libicuuc.so.70 -o ../lib/libicuuc.so.70.1 appendable.o bmpset.o brkeng.o brkiter.o bytesinkutil.o bytestream.o bytestrie.o bytestriebuilder.o bytestrieiterator.o caniter.o characterproperties.o chariter.o charstr.o cmemory.o cstr.o cstring.o cwchar.o dictbe.o dictionarydata.o dtintrv.o edits.o emojiprops.o errorcode.o filteredbrk.o filterednormalizer2.o icudataver.o icuplug.o loadednormalizer2impl.o localebuilder.o localematcher.o localeprioritylist.o locavailable.o locbased.o locdispnames.o locdistance.o locdspnm.o locid.o loclikely.o loclikelysubtags.o locmap.o locresdata.o locutil.o lsr.o lstmbe.o messagepattern.o normalizer2.o normalizer2impl.o normlzr.o parsepos.o patternprops.o pluralmap.o propname.o propsvec.o punycode.o putil.o rbbi.o rbbi_cache.o rbbidata.o rbbinode.o rbbirb.o rbbiscan.o rbbisetb.o rbbistbl.o rbbitblb.o resbund.o resbund_cnv.o resource.o restrace.o ruleiter.o schriter.o serv.o servlk.o servlkf.o servls.o servnotf.o servrbf.o servslkf.o sharedobject.o simpleformatter.o static_unicode_sets.o stringpiece.o stringtriebuilder.o uarrsort.o ubidi.o ubidi_props.o ubidiln.o ubiditransform.o ubidiwrt.o ubrk.o ucase.o ucasemap.o ucasemap_titlecase_brkiter.o ucat.o uchar.o ucharstrie.o ucharstriebuilder.o ucharstrieiterator.o uchriter.o ucln_cmn.o ucmndata.o ucnv.o ucnv2022.o ucnv_bld.o ucnv_cb.o ucnv_cnv.o ucnv_ct.o ucnv_err.o ucnv_ext.o ucnv_io.o ucnv_lmb.o ucnv_set.o ucnv_u16.o ucnv_u32.o ucnv_u7.o ucnv_u8.o ucnvbocu.o ucnvdisp.o ucnvhz.o ucnvisci.o ucnvlat1.o ucnvmbcs.o ucnvscsu.o ucnvsel.o ucol_swp.o ucptrie.o ucurr.o udata.o udatamem.o udataswp.o uenum.o uhash.o uhash_us.o uidna.o uinit.o uinvchar.o uiter.o ulist.o uloc.o uloc_keytype.o uloc_tag.o umapfile.o umath.o umutablecptrie.o umutex.o unames.o unifiedcache.o unifilt.o unifunct.o uniset.o uniset_closure.o uniset_props.o unisetspan.o unistr.o unistr_case.o unistr_case_locale.o unistr_cnv.o unistr_props.o unistr_titlecase_brkiter.o unorm.o unormcmp.o uobject.o uprops.o ures_cnv.o uresbund.o uresdata.o usc_impl.o uscript.o uscript_props.o uset.o uset_props.o usetiter.o ushape.o usprep.o ustack.o ustr_cnv.o ustr_titlecase_brkiter.o ustr_wcs.o ustrcase.o ustrcase_locale.o ustrenum.o ustrfmt.o ustring.o ustrtrns.o utext.o utf_impl.o util.o util_props.o utrace.o utrie.o utrie2.o utrie2_builder.o utrie_swap.o uts46.o utypes.o uvector.o uvectr32.o uvectr64.o wintz.o -L../lib -L../stubdata -licudata -lpthread -lm -mt Undefined first referenced symbol in file std::condition_variable::~condition_variable() umutex.o std::condition_variable::condition_variable() umutex.o vtable for cxxabiv1::si_class_type_info appendable.o [Hint: static member vtable for cxxabiv1::si_class_type_info must be defined in the program]

cxa_end_catch brkeng.o cxa_begin_catch brkeng.o operator delete(void) localematcher.o std::condition_variable::notify_all() umutex.o std::condition_variable::wait(std::unique_lock&) umutex.o __cxxabiv1::zero_bytes(void, unsigned long) localebuilder.o SUNW_ABIG3_cpp_personality appendable.o std::__once_callable umutex.o [Hint: static member std::once_callable must be defined in the program]

cxa_bad_typeid rbbi.o std::terminate() brkeng.o vtable for cxxabiv1::__vmi_class_type_info localematcher.o [Hint: static member vtable for cxxabiv1::vmi_class_type_info must be defined in the program]

dynamic_cast normalizer2.o __cxxabiv1::zero_ptrs(void*, unsigned long) brkiter.o cxxabiv1::vector_del(void, unsigned long, void ()(void*)) caniter.o vtable for cxxabiv1::class_type_info bmpset.o [Hint: static member vtable for cxxabiv1::class_type_info must be defined in the program]

cxa_pure_virtual appendable.o once_proxy umutex.o cxa_rethrow brkeng.o std::__once_call umutex.o [Hint: static member std::once_call must be defined in the program]

__cxxabiv1::vector_new(void, unsigned long, unsigned long, void ()(void), void ()(void*)) caniter.o cxa_vec_dtor dictbe.o cxa_vec_ctor characterproperties.o std::__throw_system_error(int) umutex.o ld: fatal: symbol referencing errors

I also tried running above command by replacing "-lpthread -lm -mt" flags with "-mt -lstdc++ -lgcc_s -lm -lc", it gives below error: <<< -bash-4.4$ /comms/tools/apps/solarisstudio125/bin/CC -xarch=sparc -m64 -norunpath -g -Wno-ambiguous-reversed-operator -mt -std=c++11 -Wl,-R\$ORIGIN/../lib:/comms/tools/apps/solarisstudio125/lib/compilers/atomic/sparcv9 -z defs -z text -z ignore -lCstd -lCrun -lc -G -h libicuuc.so.70 -o ../lib/libicuuc.so.70.1 appendable.o bmpset.o brkeng.o brkiter.o bytesinkutil.o bytestream.o bytestrie.o bytestriebuilder.o bytestrieiterator.o caniter.o characterproperties.o chariter.o charstr.o cmemory.o cstr.o cstring.o cwchar.o dictbe.o dictionarydata.o dtintrv.o edits.o emojiprops.o errorcode.o filteredbrk.o filterednormalizer2.o icudataver.o icuplug.o loadednormalizer2impl.o localebuilder.o localematcher.o localeprioritylist.o locavailable.o locbased.o locdispnames.o locdistance.o locdspnm.o locid.o loclikely.o loclikelysubtags.o locmap.o locresdata.o locutil.o lsr.o lstmbe.o messagepattern.o normalizer2.o normalizer2impl.o normlzr.o parsepos.o patternprops.o pluralmap.o propname.o propsvec.o punycode.o putil.o rbbi.o rbbi_cache.o rbbidata.o rbbinode.o rbbirb.o rbbiscan.o rbbisetb.o rbbistbl.o rbbitblb.o resbund.o resbund_cnv.o resource.o restrace.o ruleiter.o schriter.o serv.o servlk.o servlkf.o servls.o servnotf.o servrbf.o servslkf.o sharedobject.o simpleformatter.o static_unicode_sets.o stringpiece.o stringtriebuilder.o uarrsort.o ubidi.o ubidi_props.o ubidiln.o ubiditransform.o ubidiwrt.o ubrk.o ucase.o ucasemap.o ucasemap_titlecase_brkiter.o ucat.o uchar.o ucharstrie.o ucharstriebuilder.o ucharstrieiterator.o uchriter.o ucln_cmn.o ucmndata.o ucnv.o ucnv2022.o ucnv_bld.o ucnv_cb.o ucnv_cnv.o ucnv_ct.o ucnv_err.o ucnv_ext.o ucnv_io.o ucnv_lmb.o ucnv_set.o ucnv_u16.o ucnv_u32.o ucnv_u7.o ucnv_u8.o ucnvbocu.o ucnvdisp.o ucnvhz.o ucnvisci.o ucnvlat1.o ucnvmbcs.o ucnvscsu.o ucnvsel.o ucol_swp.o ucptrie.o ucurr.o udata.o udatamem.o udataswp.o uenum.o uhash.o uhash_us.o uidna.o uinit.o uinvchar.o uiter.o ulist.o uloc.o uloc_keytype.o uloc_tag.o umapfile.o umath.o umutablecptrie.o umutex.o unames.o unifiedcache.o unifilt.o unifunct.o uniset.o uniset_closure.o uniset_props.o unisetspan.o unistr.o unistr_case.o unistr_case_locale.o unistr_cnv.o unistr_props.o unistr_titlecase_brkiter.o unorm.o unormcmp.o uobject.o uprops.o ures_cnv.o uresbund.o uresdata.o usc_impl.o uscript.o uscript_props.o uset.o uset_props.o usetiter.o ushape.o usprep.o ustack.o ustr_cnv.o ustr_titlecase_brkiter.o ustr_wcs.o ustrcase.o ustrcase_locale.o ustrenum.o ustrfmt.o ustring.o ustrtrns.o utext.o utf_impl.o util.o util_props.o utrace.o utrie.o utrie2.o utrie2_builder.o utrie_swap.o uts46.o utypes.o uvector.o uvectr32.o uvectr64.o wintz.o -L../lib -L../stubdata -licudata -mt -lstdc++ -lgcc_s -lm -lc Undefined first referenced symbol in file cxxabiv1::zero_bytes(void*, unsigned long) localebuilder.o __SUNW_ABIG3_cpp_personality appendable.o cxxabiv1::zero_ptrs(void, unsigned long) brkiter.o __cxxabiv1::vector_del(void, unsigned long, void ()(void)) caniter.o __cxxabiv1::vector_new(void, unsigned long, unsigned long, void ()(void), void ()(void*)) caniter.o ld: fatal: symbol referencing errors

Am i missing any flags? What could be the problem?

markusicu commented 3 years ago

For the second problem, as suggested by @jefgen, I have expanded both the STATIC_NEW macro and the lambda function as inline code [...] With the above change the compilation was successful.

If you get different behavior from a macro vs. its expansion, then there is something deeply wrong with the compiler.

Next it encountered link error [...] Undefined first referenced symbol in file std::condition_variable::~condition_variable() umutex.o std::condition_variable::condition_variable() umutex.o vtable for cxxabiv1::si_class_type_info appendable.o [Hint: static member vtable for cxxabiv1::si_class_type_info must be defined in the program]

Your list of libraries looks reasonable, but I don't know which library on Solaris exports the symbols for std::condition_variable. Same for most of the other symbols.

cxa_end_catch brkeng.o cxa_begin_catch brkeng.o

This sounds like symbols for exception handling. ICU does not throw nor handle C++ exceptions.

Am i missing any flags? What could be the problem?

Sorry, I think you will need to find someone who knows more about Solaris.

Feel free to reply to your existing thread on icu-support with a link to this issue here with new information.

markusicu commented 3 years ago

For the second problem, as suggested by @jefgen, I have expanded both the STATIC_NEW macro and the lambda function as inline code [...] With the above change the compilation was successful.

If you get different behavior from a macro vs. its expansion, then there is something deeply wrong with the compiler.

Actually, I take this one back. The inline replacement also drops the lambda expression. I guess the Solaris compiler has a bug in handling lambdas. Do the other uses of STATIC_NEW work with this compiler?

Hanumesh96 commented 3 years ago

I observed 2 warnings(same as previous, but no error) while compiling "icu/source/common/unifiedcache.cpp" <<< /comms/tools/apps/solarisstudio125/bin/CC -DU_DEBUG=1 -DU_HAVE_ELF_H=1 -DU_HAVE_STRTOD_L=0 -I/build/icu/source/common "-DDEFAULT_ICU_PLUGINS=\"/build/built/icu/SunOS5.11_64_DBG.OBJ/lib/icu\" " -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION -xarch=sparc -m64 -norunpath -g -mt -std=c++11 -c -DPIC -KPIC -o unifiedcache.o _unifiedcache.cpp "/build/icu/source/common/unifiedcache.cpp", line 75: Warning: Deducing non-void lambda return type 'std::mutex' from lambda without a single return statement. "/build/icu/source/common/unifiedcache.cpp", line 76: Warning: Deducing non-void lambda return type 'std::condition_variable' from lambda without a single return statement. 2 Warning(s) detected.

srl295 commented 1 year ago

Hi, this isn't the ICU issue tracker, I am archiving this repository as no longer used. Please use https://icu.unicode.org/bugs for issues.