Repository navigation
[C++][FlightRPC][ODBC] Clang 20 compiles failed on macOS 26 #50756
Copy link
Copy link
Closed
Description
Describe the bug, including details regarding any error messages, version, and platform.
There are four kinds of compile errors.
- Incorrect initialization way.
[build] cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/timestamp_array_accessor.cc:98:20: error: missing field 'tm_min' initializer [-Werror,-Wmissing-field-initializers]
[build] 98 | tm timestamp = {0};
[build] | - Used deprecated standard library APIs
std::wstring_convertandstd::codecvt_utf8.
[build] In file included from cpp/src/arrow/flight/sql/odbc/odbc_impl/encoding.cc:18:
[build] In file included from cpp/src/arrow/flight/sql/odbc/odbc_impl/encoding.h:23:
[build] /nix/store/4b6hc41dl32baac3vwy7xa29xzz14rzp-libcxx-20.1.8-dev/include/c++/v1/locale:3226:1: error: 'wstring_convert<std::codecvt_utf8<char16_t>, char16_t>' is deprecated [-Werror,-Wdeprecated-declarations]
[build] 3226 | wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::to_bytes(const _Elem* __frm, const _Elem* __frm_end) {
[build] | ^
[build] cpp/src/arrow/flight/sql/odbc/odbc_impl/encoding.h:111:32: note: in instantiation of member function 'std::wstring_convert<std::codecvt_utf8<char16_t>, char16_t>::to_bytes' requested here
[build] 111 | auto byte_string = converter.to_bytes((CHAR_TYPE*)wcs_string,
[build] | ^
[build] cpp/src/arrow/flight/sql/odbc/odbc_impl/encoding.h:126:14: note: in instantiation of function template specialization 'arrow::flight::sql::odbc::WcsToUtf8<char16_t>' requested here
[build] 126 | return WcsToUtf8<char16_t>(wcs_string, length_in_code_units, result);
[build] | ^
[build] /nix/store/4b6hc41dl32baac3vwy7xa29xzz14rzp-libcxx-20.1.8-dev/include/c++/v1/locale:3083:28: note: 'wstring_convert<std::codecvt_utf8<char16_t>, char16_t>' has been explicitly marked deprecated here
[build] 3083 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert {
[build] | ^
[build] /nix/store/4b6hc41dl32baac3vwy7xa29xzz14rzp-libcxx-20.1.8-dev/include/c++/v1/__config:725:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
[build] 725 | # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
[build] | ^
[build] /nix/store/4b6hc41dl32baac3vwy7xa29xzz14rzp-libcxx-20.1.8-dev/include/c++/v1/__config:698:49: note: expanded from macro '_LIBCPP_DEPRECATED'
[build] 698 | # define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
[build] |- Implicit conversion loses integer precision.
[build] cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_descriptor.cc:489:49: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
[build] 489 | int16_t concise_type = rsmd->GetConciseType(one_based_index);
[build] |- Unused private field.
[build] In file included from cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc:18:
[build] cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.h:50:15: error: private field 'odbc_version_' is not used [-Werror,-Wunused-private-field]
[build] 50 | OdbcVersion odbc_version_;
[build] | ^
[build] 1 error generated.Component(s)
C++, FlightRPC
Reactions are currently unavailable
Activity
HuaHuaY commentedon Jul 31, 2026
The second error is not easy to fix. We have these code which use deprecated
std::wstring_convertandstd::codecvt_utf8. #46622 (issue GH-46576) tried to suppress compilation errors by addingARROW_SUPPRESS_DEPRECATION_WARNING. But at least in my local environment, this error no longer occurs at the template definition, but rather where the template is actually instantiated.I think there are two ways to fix this:
#include <codecvt>and#include <locale>statements inencoding.hwithARROW_SUPPRESS_DEPRECATION_WARNING. Additionally, any code that includes bothencoding.hand<locale>must includeencoding.hfirst. This is necessary because the deprecation warning must be suppressed the moment the compiler encounters<locale>within the compilation unit. This is inconvenient, as headers like<vector>also internally include<locale>; effectively, if a compilation unit depends—directly or transitively—onencoding.h,encoding.hmust be manually included at the very top of the source file.boost::locale::conv::utf_to_utf.@kou @alinaliBQ @lidavidm Please take a look. What do you think about this?
HuaHuaY commentedon Jul 31, 2026
I lean towards Option 2 and have submitted a PR. If there are reasons why we cannot choose Option 2, I can adjust the PR's behavior accordingly.
alinaliBQ commentedon Jul 31, 2026
Hi @HuaHuaY, thank you for submitting this issue and looking into it! I'll defer to David and kou on the use of Boost, but as far as I know, we're generally trying to avoid implementations from Boost where possible.
lidavidm commentedon Aug 3, 2026
I don't know if we've really written down why we don't use Boost, but generally we prefer to avoid the dependency where possible.
We already vendor utfcpp. Is that sufficient?
HuaHuaY commentedon Aug 3, 2026
I have replaced with utfcpp.
kou commentedon Aug 3, 2026
+1 for utfcpp.
GH-50756: [C++][FlightSQL][ODBC] Fix Clang 20 compilation on macOS 26 (…
lidavidm commentedon Aug 5, 2026
Issue resolved by pull request 50757
#50757