Opened 11 months ago

Last modified 11 months ago

#69000 assigned defect

libcxx-powerpc: can we get rid of depending on system libstdc++ completely?

Reported by: barracuda156 Owned by: catap (Kirill A. Korinsky)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: leopard, snowleopard, powerpc Cc:
Port: libcxx-powerpc

Description (last modified by barracuda156)

So I tried to build icu against libcxx on PowerPC. Here linking failed:

/opt/local/bin/g++-mp-12 -dynamiclib -dynamic -pipe -Os -arch ppc -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -std=c++11    -fvisibility=hidden -Wl,-headerpad_max_install_names -stdlib=libc++ -L/opt/local/libexec/llvm-7.1.1/lib -lc++ -arch ppc    -Wl,-compatibility_version -Wl,74 -Wl,-current_version -Wl,74.1 -install_name /opt/local/lib/libicuuc.74.dylib -o ../lib/libicuuc.74.1.dylib 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 mlbe.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 ulocale.o ulocbuilder.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 
Undefined symbols:
  "__ZSt14__once_functor", referenced from:
      __ZSt14__once_functor$non_lazy_ptr in umutex.o
     (maybe you meant: __ZSt14__once_functor$non_lazy_ptr)
  "__ZSt20__throw_system_errori", referenced from:
      __ZNSt5mutex4lockEv in umutex.o
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
      __ZNK6icu_7412UnifiedCache5_pollERKNS_12CacheKeyBaseERPKNS_12SharedObjectER10UErrorCode in unifiedcache.o
      __ZNSt5mutex4lockEv in unifiedcache.o
  "__ZNSt18condition_variable10notify_allEv", referenced from:
      __ZN6icu_7421umtx_initImplPostInitERNS_9UInitOnceE in umutex.o
      __ZNK6icu_7412UnifiedCache4_putEPK12UHashElementPKNS_12SharedObjectE10UErrorCode in unifiedcache.o
  "__ZSt16__get_once_mutexv", referenced from:
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
  "___once_proxy", referenced from:
      ___once_proxy$non_lazy_ptr in umutex.o
     (maybe you meant: ___once_proxy$non_lazy_ptr)
  "__ZNSt18condition_variableC1Ev", referenced from:
      _umtx_init in umutex.o
      __ZN6icu_7412UnifiedCache11getInstanceER10UErrorCode in unifiedcache.o
  "__ZNSt18condition_variableD1Ev", referenced from:
      _umtx_cleanup in umutex.o
      _unifiedcache_cleanup in unifiedcache.o
  "__ZSt27__set_once_functor_lock_ptrPSt11unique_lockISt5mutexE", referenced from:
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
  "__ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE", referenced from:
      __ZN6icu_7420umtx_initImplPreInitERNS_9UInitOnceE in umutex.o
      __ZNK6icu_7412UnifiedCache5_pollERKNS_12CacheKeyBaseERPKNS_12SharedObjectER10UErrorCode in unifiedcache.o
ld: symbol(s) not found

Apparently these symbols are provided by libstdc++: https://gcc.gnu.org/legacy-ml/gcc-help/2019-12/msg00090.html

If I just add -lstdc++ to the command above, it links successfully. But to all four libraries:

36-145% otool -L /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_icu/icu/work/icu/source/lib/libicuuc.74.1.dylib 
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_icu/icu/work/icu/source/lib/libicuuc.74.1.dylib:
	/opt/local/lib/libicuuc.74.dylib (compatibility version 74.0.0, current version 74.1.0)
	/opt/local/libexec/llvm-7.1.1/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/opt/local/lib/libicudata.74.dylib (compatibility version 74.0.0, current version 74.1.0)
	/opt/local/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.32.0)
	/opt/local/libexec/llvm-7.1.1/lib/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/opt/local/lib/libgcc/libgcc_s.1.1.dylib (compatibility version 1.0.0, current version 1.1.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 117.0.0)

This is wrong, but how do we get it to work without pulling in a zoo of C++ runtime libs?

  1. S. The issue is perhaps nothing specific to PowerPC and should be reproducible on Intel without a native libc++.

Change History (6)

comment:1 Changed 11 months ago by barracuda156

Description: modified (diff)

comment:2 Changed 11 months ago by barracuda156

UPD. No, linking to libgcc_s.1 does not work. Referred to in https://gcc.gnu.org/legacy-ml/gcc-help/2020-01/msg00030.html

I get all the same error with it:

/opt/local/bin/g++-mp-12 -dynamiclib -dynamic -pipe -Os -arch ppc -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -std=c++11    -fvisibility=hidden -Wl,-headerpad_max_install_names -stdlib=libc++ -L/opt/local/libexec/llvm-7.1.1/lib -lc++ -L/usr/lib -lgcc_s.1 -arch ppc    -Wl,-compatibility_version -Wl,74 -Wl,-current_version -Wl,74.1 -install_name /opt/local/lib/libicuuc.74.dylib -o ../lib/libicuuc.74.1.dylib 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 mlbe.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 ulocale.o ulocbuilder.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 
Undefined symbols:
  "__ZSt14__once_functor", referenced from:
      __ZSt14__once_functor$non_lazy_ptr in umutex.o
     (maybe you meant: __ZSt14__once_functor$non_lazy_ptr)
  "__ZSt20__throw_system_errori", referenced from:
      __ZNSt5mutex4lockEv in umutex.o
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
      __ZNK6icu_7412UnifiedCache5_pollERKNS_12CacheKeyBaseERPKNS_12SharedObjectER10UErrorCode in unifiedcache.o
      __ZNSt5mutex4lockEv in unifiedcache.o
  "__ZNSt18condition_variable10notify_allEv", referenced from:
      __ZN6icu_7421umtx_initImplPostInitERNS_9UInitOnceE in umutex.o
      __ZNK6icu_7412UnifiedCache4_putEPK12UHashElementPKNS_12SharedObjectE10UErrorCode in unifiedcache.o
  "__ZSt16__get_once_mutexv", referenced from:
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
  "___once_proxy", referenced from:
      ___once_proxy$non_lazy_ptr in umutex.o
     (maybe you meant: ___once_proxy$non_lazy_ptr)
  "__ZNSt18condition_variableC1Ev", referenced from:
      _umtx_init in umutex.o
      __ZN6icu_7412UnifiedCache11getInstanceER10UErrorCode in unifiedcache.o
  "__ZNSt18condition_variableD1Ev", referenced from:
      _umtx_cleanup in umutex.o
      _unifiedcache_cleanup in unifiedcache.o
  "__ZSt27__set_once_functor_lock_ptrPSt11unique_lockISt5mutexE", referenced from:
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
      __ZSt9call_onceIRFvvEJEEvRSt9once_flagOT_DpOT0_ in umutex.o
  "__ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE", referenced from:
      __ZN6icu_7420umtx_initImplPreInitERNS_9UInitOnceE in umutex.o
      __ZNK6icu_7412UnifiedCache5_pollERKNS_12CacheKeyBaseERPKNS_12SharedObjectER10UErrorCode in unifiedcache.o
Last edited 11 months ago by barracuda156 (previous) (diff)

comment:3 Changed 11 months ago by barracuda156

Or maybe we need to add emutls into libcxxabi and possibly do not add -D_GLIBCXX_USE_CXX11_ABI=0 flag.

UPD. emutls added, but did not resolve the issue on its own.

Last edited 11 months ago by barracuda156 (previous) (diff)

comment:4 Changed 11 months ago by barracuda156

Do we need cxa_atexit? Or if not, do we need to pass fno-use-cxa-atexit?

Version 0, edited 11 months ago by barracuda156 (next)

comment:5 in reply to:  4 ; Changed 11 months ago by catap (Kirill A. Korinsky)

Replying to barracuda156:

Do we need to include cxa_atexit in the build? Or if not, do we need to pass -fno-use-cxa-atexit?

Yes, you really need it.

See: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/baselib---cxa-atexit.html

comment:6 in reply to:  5 Changed 11 months ago by barracuda156

Replying to catap:

Replying to barracuda156:

Do we need to include cxa_atexit in the build? Or if not, do we need to pass -fno-use-cxa-atexit?

Yes, you really need it.

See: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/baselib---cxa-atexit.html

Already done, but it does not solve the issue with icu build.

Note: See TracTickets for help on using tickets.