Skip to content

Commit a0226ec

Browse files
committed
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 <libxml/xmlreader.h>` 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 <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/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`.
1 parent c914c09 commit a0226ec

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

sdk/storage/azure-storage-common/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
### Other Changes
1212

13+
- Added support for ICU 75.1 or later.
14+
1315
## 12.10.0 (2025-03-11)
1416

1517
### Features Added

sdk/storage/azure-storage-common/src/xml_wrapper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#endif
2121
#include <webservices.h>
2222
#else
23+
// libxml2 uses ICU. ICU 75.1 or later requires C++17 but we use
24+
// C++14. It causes an error. We can disable ICU C++ API to avoid it
25+
// because we don't need ICU C++ API.
26+
#define U_SHOW_CPLUSPLUS_API 0
2327
#include <libxml/xmlreader.h>
2428
#include <libxml/xmlwriter.h>
2529
#endif

sdk/tables/azure-data-tables/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
### Other Changes
1212

13+
- Added support for ICU 75.1 or later.
14+
1315
## 1.0.0-beta.6 (2025-01-22)
1416

1517
### Breaking Changes

sdk/tables/azure-data-tables/src/xml_wrapper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#endif
2020
#include <webservices.h>
2121
#else
22+
// libxml2 uses ICU. ICU 75.1 or later requires C++17 but we use
23+
// C++14. It causes an error. We can disable ICU C++ API to avoid it
24+
// because we don't need ICU C++ API.
25+
#define U_SHOW_CPLUSPLUS_API 0
2226
#include <libxml/xmlreader.h>
2327
#include <libxml/xmlwriter.h>
2428
#endif

0 commit comments

Comments
 (0)