LanguageMachines / ticcutils

Ticcutils, a generic utility library shared by our software.
GNU General Public License v3.0
7 stars 8 forks source link

ticcutils fails to build against new libicu 75 because -std=c++14 is too old #29

Open proycon opened 4 months ago

proycon commented 4 months ago

On my system (Arch Linux), ticcutils and everything else in the stack refuses to compile because -std=c++14 is set (by us? by autotools?) and the icu headers no longer compile with that but require at least -std=c++17.

The work around is to just set export CXXFLAGS="-std=c++17" before ./configure, but I guess the autoconf process should have figured this out themselves.

In file included from /usr/include/unicode/unistr.h:39,
                 from ../include/ticcutils/Unicode.h:39,
                 from Unicode.cxx:28:
/usr/include/unicode/stringpiece.h:134:23: error: 'is_same_v' is not a member of 'std'; did you mean 'is_same'?
  134 |                 (std::is_same_v<decltype(T().data()), const char*>
      |                       ^~~~~~~~~
      |                       is_same
/usr/include/unicode/stringpiece.h:134:66: error: template argument 1 is invalid
  134 |                 (std::is_same_v<decltype(T().data()), const char*>
      |                                                                  ^
/usr/include/unicode/stringpiece.h:138:17: error: expected '>' before ')' token
  138 |                 ) &&
      |                 ^
/usr/include/unicode/stringpiece.h:138:17: error: expected unqualified-id before ')' token
In file included from /usr/include/unicode/uenum.h:25,
                 from /usr/include/unicode/utrans.h:22,
                 from /usr/include/unicode/translit.h:29,
                 from ../include/ticcutils/Unicode.h:40:
/usr/include/unicode/localpointer.h:561:26: error: 'auto' parameter not permitted in this context
  561 | template <typename Type, auto closeFunction>
      |                          ^~~~
/usr/include/unicode/localpointer.h:573:76: error: template argument 2 is invalid
  573 |     explicit LocalOpenPointer(std::unique_ptr<Type, decltype(closeFunction)> &&p)
      |                                                                            ^
/usr/include/unicode/localpointer.h:583:78: error: template argument 2 is invalid
  583 |     LocalOpenPointer &operator=(std::unique_ptr<Type, decltype(closeFunction)> &&p) {
      |                                                                              ^
/usr/include/unicode/localpointer.h:599:59: error: template argument 2 is invalid
  599 |     operator std::unique_ptr<Type, decltype(closeFunction)> () && {
      |                                                           ^
/usr/include/unicode/uenum.h:69:1: note: invalid template non-type parameter
   69 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/unicode/uset.h:358:1: note: invalid template non-type parameter
  358 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/unicode/utrans.h:258:1: note: invalid template non-type parameter
  258 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/unicode/unorm2.h:286:1: note: invalid template non-type parameter
  286 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/unicode/utext.h:1596:1: note: invalid template non-type parameter
 1596 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/unicode/uregex.h:229:1: note: invalid template non-type parameter
  229 | U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:697: Unicode.lo] Error 1
egpbos commented 3 months ago

Seeing this error for the conda build of ticcutils as well: https://github.com/conda-forge/ticcutils-feedstock/pull/34/checks?check_run_id=27458299416

kosloot commented 3 months ago

Well, I can update the software stack to generally use -std=c++17 I did so for ticcutils, libfolia and ucto

This however leads to problems with the MacOS runners for GitHub actions. (as usual) The clang builds is OK, but the c++12 build fails the 'make check'

Undefined symbols for architecture arm64:
  "icu_74::operator<<(std::ostream&, icu_74::UnicodeString const&)", referenced from:
      test_unicodehash() in runtest.o

I currently have no clue how to solve this, -licuio IS in the build libs

nevertheless, it would be nice if you all could test the builds on Arch Linux and Conda

kosloot commented 3 months ago

Well, probably this due to a mixup between libC++ (clang style, default on MacOS) and libstdc++ (Gnu style, deprecated on MacOS) see this article on Mac, libicuio provides:

0000000000000000 T icu_74::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, icu_74::UnicodeString const&)

And the linker searches for :

icu_74::operator<<(std::ostream&, icu_74::UnicodeString const&)

There seems no easy way to solve this

kosloot commented 3 months ago

see: this test which quick and dirty shows the pain

egpbos commented 2 months ago

Still seeing the error in a new PR https://github.com/conda-forge/ticcutils-feedstock/pull/35.

@kosloot in your snippets I see icu_74, shouldn't that be 75?

kosloot commented 2 months ago

@egpbos those snippets were to illustrate why building on MacOS using gcc is failing. It should have nothing to do with your problem, which in fact should haven been solved, as we now have switched to std=c++17 generally c++14 should NOT be used anymore.

egpbos commented 2 months ago

Ah, that's great (the conda-forge build picked up the previous release still)! Do you plan on making a new versioned release for this soon?

kosloot commented 2 months ago

Well, let's say soonish. a few weeks max

kosloot commented 1 month ago

@egpbos a new version of Ticcutils is released.

egpbos commented 1 month ago

Thanks for the headsup!