Windows-on-ARM-Experiments / mingw-woarm64-build

Workflows and build scripts for Windows on Arm64 GNU cross-compiler for `aarch64-w64-mingw32` target.
GNU General Public License v2.0
32 stars 4 forks source link

`_umul128` was not declared error when building Boost library #210

Closed vejbomar closed 1 week ago

vejbomar commented 1 week ago

When building Boost library with either x86_64-pc-linux-gnu -> aarch64-w64-mingw32 or aarch64-pc-linux-gnu -> aarch64-w64-mingw32 toolchain I got the following errors about missing _umul128 from json and charconv modules.

json module

In file included from ./boost/json/detail/charconv/detail/fast_float/fast_float.hpp:11,
                 from ./boost/json/detail/charconv/impl/from_chars.ipp:14,
                 from ./boost/json/src.hpp:58,
                 from /home/vejby/boost-build-19-full/libs/json/src/src.cpp:10:
./boost/json/detail/charconv/detail/fast_float/float_common.hpp: In function ‘boost::json::detail::charconv::detail::fast_float::value128 boost::json::detail::charconv::detail::fast_float::full_multiplication(uint64_t, uint64_t)’:
./boost/json/detail/charconv/detail/fast_float/float_common.hpp:212:16: error: ‘_umul128’ was not declared in this scope
  212 |   answer.low = _umul128(a, b, &high); // _umul128 not available on ARM64
      |                ^~~~~~~~

charconv module

In file included from ./boost/charconv/detail/fast_float/fast_float.hpp:11,
                 from libs/charconv/build/../src/from_chars.cpp:16:
./boost/charconv/detail/fast_float/float_common.hpp: In function ‘boost::charconv::detail::fast_float::value128 boost::charconv::detail::fast_float::full_multiplication(uint64_t, uint64_t)’:
./boost/charconv/detail/fast_float/float_common.hpp:254:16: error: ‘_umul128’ was not declared in this scope; did you mean ‘umul128’?
  254 |   answer.low = _umul128(a, b, &high); // _umul128 not available on ARM64
      |                ^~~~~~~~
      |                umul128

The code seems to come originally from fast_float library https://github.com/fastfloat/fast_float/blob/4266c34620b3120718d8d631c354ba22e9607b36/include/fast_float/float_common.h#L348 and there're multiple versions of the function, so I think the problem is just that the wrong version is selected for arm64 + win + mingw combination.

eukarpov commented 1 week ago

please apply a fix in a similar way to how it was done here https://github.com/fastfloat/fast_float/pull/269

vejbomar commented 1 week ago

PR with fix accepted in Boost.charconv: https://github.com/boostorg/charconv/pull/230

Created similar PR in Boost.JSON: https://github.com/boostorg/json/pull/1057

vejbomar commented 1 week ago

Both PRs were accepted and merged into develop branches of charconv and JSON modules, so the fixes should be available in the next Boost release.