Skip to content

C API shim library fails to build on macOS #494

@loren-osborn

Description

@loren-osborn

Description

While testing the C API shim, I was able to reproduce a build failure on macOS using the following configuration.

Reproduction

On macOS, from the Universal repository root:

cmake -S third_party/universal -B build/universal-shim \
  -DUNIVERSAL_BUILD_ALL=ON \
  -DUNIVERSAL_ENABLE_TESTS=ON \
  -DUNIVERSAL_BUILD_C_API_SHIM_LIB=ON \
  --log-level=VERBOSE && \
cmake --build build/universal-shim --verbose

Notes

  • This may be macOS-specific (I have not yet tested it anywhere else).
  • CI currently disables the C shims, so this does not affect CI builds.
  • I have not yet investigated root cause beyond reproducing the failure.

If you have bandwidth to take a look, I’m happy to help test or provide additional logs.

Details

The current compiler output is as follows:


cd /Users/linux_dr/projects/trfloats/build/universal-shim/mixedprecision/roots && /usr/bin/c++ -DGIT_BRANCH=nuclear_cleanup -DGIT_COMMIT_HASH=3c21e439 -I/Users/linux_dr/projects/trfloats/build/universal-shim/generated -I/Users/linux_dr/projects/trfloats/third_party/universal/./include/sw -Wall -Wpedantic -Wno-narrowing -Wno-deprecated -O3 -DNDEBUG   -Wall -Wpedantic -Wno-narrowing -Wno-deprecated  -ffp-contract=off -std=gnu++20   -D REGRESSION_LEVEL_OVERRIDE -D REGRESSION_LEVEL_1=1 -D REGRESSION_LEVEL_2=0 -D REGRESSION_LEVEL_3=0 -D REGRESSION_LEVEL_4=0 -MD -MT mixedprecision/roots/CMakeFiles/mp_rpoly.dir/rpoly.cpp.o -MF CMakeFiles/mp_rpoly.dir/rpoly.cpp.o.d -o CMakeFiles/mp_rpoly.dir/rpoly.cpp.o -c /Users/linux_dr/projects/trfloats/third_party/universal/mixedprecision/roots/rpoly.cpp
In file included from /Users/linux_dr/projects/trfloats/third_party/universal/mixedprecision/roots/rpoly.cpp:15:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/complex:938:10: error: no matching function for call to 'hypot'
  938 |   return std::hypot(__c.real(), __c.imag());
      |          ^~~~~~~~~~
/Users/linux_dr/projects/trfloats/third_party/universal/mixedprecision/roots/rpoly.cpp:251:9: note: in instantiation of function template specialization 'std::abs<sw::universal::posit<32, 2>>' requested here
  251 |         abs(sequence(1) - sequence(0)) < abs(sequence(0)) / 2.0;
      |         ^
/Users/linux_dr/projects/trfloats/third_party/universal/mixedprecision/roots/rpoly.cpp:584:22: note: in instantiation of function template specialization 'HasConverged<std::complex<sw::universal::posit<32, 2>>>' requested here
  584 |             else if (HasConverged(t_lambda)) {
      |                      ^
/Users/linux_dr/projects/trfloats/third_party/universal/mixedprecision/roots/rpoly.cpp:371:31: note: in instantiation of member function 'JenkinsTraubSolver<sw::universal::posit<32, 2>>::ApplyFixedShiftToKPolynomial' requested here
  371 |                 convergence = ApplyFixedShiftToKPolynomial(root, kFixedShiftIterationMultiplier * (i + 1));
      |                               ^
/Users/linux_dr/projects/trfloats/third_party/universal/mixedprecision/roots/rpoly.cpp:896:19: note: in instantiation of member function 'JenkinsTraubSolver<sw::universal::posit<32, 2>>::ExtractRoots' requested here
  896 |     return solver.ExtractRoots();
      |                   ^
/Users/linux_dr/projects/trfloats/third_party/universal/mixedprecision/roots/rpoly.cpp:981:13: note: in instantiation of function template specialization 'FindPolynomialRootsJenkinsTraub<sw::universal::posit<32, 2>>' requested here
  981 |             FindPolynomialRootsJenkinsTraub(poly, realRoots, complexRoots);
      |             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__math/hypot.h:34:36: note: candidate function not viable: no known conversion from 'value_type' (aka 'sw::universal::posit<32, 2>') to 'float' for 1st argument
   34 | inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y) _NOEXCEPT { return __builtin_hypotf(__x, __y); }
      |                                    ^     ~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__math/hypot.h:37:30: note: candidate function not viable: no known conversion from 'value_type' (aka 'sw::universal::posit<32, 2>') to 'double' for 1st argument
   37 | _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y) _NOEXCEPT {
      |                              ^     ~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__math/hypot.h:41:42: note: candidate function not viable: no known conversion from 'value_type' (aka 'sw::universal::posit<32, 2>') to 'long double' for 1st argument
   41 | inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y) _NOEXCEPT {
      |                                          ^     ~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/math.h:431:15: note: candidate function not viable: no known conversion from 'value_type' (aka 'sw::universal::posit<32, 2>') to 'double' for 1st argument
  431 | extern double hypot(double, double);
      |               ^     ~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__math/hypot.h:46:65: note: candidate template ignored: requirement 'is_arithmetic<sw::universal::posit<32, 2>>::value' was not satisfied [with _A1 = value_type, _A2 = value_type]
   46 | inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type hypot(_A1 __x, _A2 __y) _NOEXCEPT {
      |                                                                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__math/hypot.h:82:36: note: candidate function not viable: requires 3 arguments, but 2 were provided
   82 | inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y, float __z) { return __math::__hypot(__x, __y, __z); }
      |                                    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__math/hypot.h:84:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
   84 | inline _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y, double __z) { return __math::__hypot(__x, __y, __z); }
      |                                     ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__math/hypot.h:86:42: note: candidate function not viable: requires 3 arguments, but 2 were provided
   86 | inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y, long double __z) {
      |                                          ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__math/hypot.h:94:63: note: candidate function not viable: requires 3 arguments, but 2 were provided
   94 | _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2, _A3>::type hypot(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT {
      |                                                               ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [mixedprecision/roots/CMakeFiles/mp_rpoly.dir/rpoly.cpp.o] Error 1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions