From 6cc8fc195f000ffb6c0f3ed4416c826d1b9cc81f Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 08:08:40 +0900 Subject: [PATCH] Add support for building with ICU 75.1 or later (#6486) * Add support for building with ICU 75.1 or later We use ICU via libxml2 implicitly. ICU 75.1 or later require C++17 for its C++ API: https://github.com/unicode-org/icu/releases/tag/release-75-1 > C++ code now requires C++17 But we use C++17. So `#include ` with ICU 75.1 or later causes an error: [1/177] Building CXX object sdk/storage/azure-storage-common/CMakeFiles/azure-storage-common.dir/src/xml_wrapper.cpp.o FAILED: sdk/storage/azure-storage-common/CMakeFiles/azure-storage-common.dir/src/xml_wrapper.cpp.o /bin/c++ -DAZ_RTTI -DBUILD_CURL_HTTP_TRANSPORT_ADAPTER -D_azure_BUILDING_SDK -Isdk/storage/azure-storage-common/inc -Isdk/core/azure-core/inc -isystem /usr/include/libxml2 -g -std=gnu++14 -fno-operator-names -Wold-style-cast -Wall -Wextra -pedantic -Werror -MD -MT sdk/storage/azure-storage-common/CMakeFiles/azure-storage-common.dir/src/xml_wrapper.cpp.o -MF sdk/storage/azure-storage-common/CMakeFiles/azure-storage-common.dir/src/xml_wrapper.cpp.o.d -o sdk/storage/azure-storage-common/CMakeFiles/azure-storage-common.dir/src/xml_wrapper.cpp.o -c sdk/storage/azure-storage-common/src/xml_wrapper.cpp In file included from /usr/include/unicode/uenum.h:25, from /usr/include/unicode/ucnv.h:52, from /usr/include/libxml2/libxml/encoding.h:31, from /usr/include/libxml2/libxml/parser.h:812, from /usr/include/libxml2/libxml/globals.h:18, from /usr/include/libxml2/libxml/threads.h:35, from /usr/include/libxml2/libxml/xmlmemory.h:218, from /usr/include/libxml2/libxml/tree.h:1307, from /usr/include/libxml2/libxml/xmlreader.h:14, from sdk/storage/azure-storage-common/src/xml_wrapper.cpp:23: /usr/include/unicode/localpointer.h:561:26: error: 'auto' parameter not permitted in this context 561 | template | ^~~~ /usr/include/unicode/localpointer.h:573:76: error: template argument 2 is invalid 573 | explicit LocalOpenPointer(std::unique_ptr &&p) | ^ /usr/include/unicode/localpointer.h:583:78: error: template argument 2 is invalid 583 | LocalOpenPointer &operator=(std::unique_ptr &&p) { | ^ /usr/include/unicode/localpointer.h:599:59: error: template argument 2 is invalid 599 | operator std::unique_ptr () && { | ^ /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/ucnv.h:597:1: note: invalid template non-type parameter 597 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ We don't need ICU C++ API. So we can avoid this error by disabling ICU C++ API by defining `U_SHOW_CPLUSPLUS_API` as `0`. * Update CHANGELOG --- sdk/storage/azure-storage-common/CHANGELOG.md | 8 ++++++++ sdk/storage/azure-storage-common/src/xml_wrapper.cpp | 4 ++++ sdk/tables/azure-data-tables/CHANGELOG.md | 8 ++++++++ sdk/tables/azure-data-tables/src/xml_wrapper.cpp | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/sdk/storage/azure-storage-common/CHANGELOG.md b/sdk/storage/azure-storage-common/CHANGELOG.md index 57d9a800c..31a81c862 100644 --- a/sdk/storage/azure-storage-common/CHANGELOG.md +++ b/sdk/storage/azure-storage-common/CHANGELOG.md @@ -10,6 +10,14 @@ ### Other Changes +- Added support for ICU 75.1 or later. (A community contribution, courtesy of _[kou](https://github.com/kou)_) + +### Acknowledgments + +Thank you to our developer community members who helped to make Azure Storage better with their contributions to this release: + +- Sutou Kouhei _([GitHub](https://github.com/kou))_ + ## 12.10.0 (2025-03-11) ### Features Added diff --git a/sdk/storage/azure-storage-common/src/xml_wrapper.cpp b/sdk/storage/azure-storage-common/src/xml_wrapper.cpp index 435d631b8..e46536b54 100644 --- a/sdk/storage/azure-storage-common/src/xml_wrapper.cpp +++ b/sdk/storage/azure-storage-common/src/xml_wrapper.cpp @@ -20,6 +20,10 @@ #endif #include #else +// libxml2 uses ICU. ICU 75.1 or later requires C++17 but we use +// C++14. It causes an error. We can disable ICU C++ API to avoid it +// because we don't need ICU C++ API. +#define U_SHOW_CPLUSPLUS_API 0 #include #include #endif diff --git a/sdk/tables/azure-data-tables/CHANGELOG.md b/sdk/tables/azure-data-tables/CHANGELOG.md index 772a31975..f94b5fecb 100644 --- a/sdk/tables/azure-data-tables/CHANGELOG.md +++ b/sdk/tables/azure-data-tables/CHANGELOG.md @@ -10,6 +10,14 @@ ### Other Changes +- Added support for ICU 75.1 or later. (A community contribution, courtesy of _[kou](https://github.com/kou)_) + +### Acknowledgments + +Thank you to our developer community members who helped to make Azure Data Tables better with their contributions to this release: + +- Sutou Kouhei _([GitHub](https://github.com/kou))_ + ## 1.0.0-beta.6 (2025-01-22) ### Breaking Changes diff --git a/sdk/tables/azure-data-tables/src/xml_wrapper.cpp b/sdk/tables/azure-data-tables/src/xml_wrapper.cpp index 80e650582..76128d04a 100644 --- a/sdk/tables/azure-data-tables/src/xml_wrapper.cpp +++ b/sdk/tables/azure-data-tables/src/xml_wrapper.cpp @@ -19,6 +19,10 @@ #endif #include #else +// libxml2 uses ICU. ICU 75.1 or later requires C++17 but we use +// C++14. It causes an error. We can disable ICU C++ API to avoid it +// because we don't need ICU C++ API. +#define U_SHOW_CPLUSPLUS_API 0 #include #include #endif