Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build on 32-bit architectures (e.g., armv7, i386, powerpc) #7422

Closed
jbeich opened this issue Aug 20, 2024 · 1 comment · Fixed by #7510
Closed

Fails to build on 32-bit architectures (e.g., armv7, i386, powerpc) #7422

jbeich opened this issue Aug 20, 2024 · 1 comment · Fixed by #7510
Labels
bug Something isn't working

Comments

@jbeich
Copy link
Contributor

jbeich commented Aug 20, 2024

Regression?

Yes

System Info and Version

v0.42.0-46-gc86db7bb

Description

Regressed by #7216 (75fe7c8). CC @gulafaran

Clang error
$ export CC=clang CXX=clang++
$ export CFLAGS=-m32 CXXFLAGS="-m32 -stdlib=libc++"
$ cmake -B _build
$ cmake --build _build
[...]
src/helpers/MiscFunctions.cpp:356:33: error: no matching function for call to 'max'
  356 |                 predictedWSID = std::max(predictedWSID, 0L);
      |                                 ^~~~~~~~
src/helpers/MiscFunctions.cpp:379:35: error: no matching function for call to 'max'
  379 |                     currentItem = std::max(currentItem, 0UL);
      |                                   ^~~~~~~~
src/helpers/MiscFunctions.cpp:416:42: error: no matching function for call to 'clamp'
  416 |                             namedWSIdx = std::clamp(namedWSIdx, 0UL, namedWSes.size() - 1);
      |                                          ^~~~~~~~~~
/usr/include/c++/v1/__algorithm/max.h:40:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('WORKSPACEID' (aka 'long long') vs. 'long')
   40 | max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
      | ^
/usr/include/c++/v1/__algorithm/max.h:51:1: note: candidate template ignored: could not match 'initializer_list<_Tp>' against 'WORKSPACEID' (aka 'long long')
   51 | max(initializer_list<_Tp> __t, _Compare __comp)
      | ^
/usr/include/c++/v1/__algorithm/max.h:60:1: note: candidate function template not viable: requires single argument '__t', but 2 arguments were provided
   60 | max(initializer_list<_Tp> __t)
      | ^   ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__algorithm/max.h:31:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided
   31 | max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
      | ^                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GCC error
$ export CFLAGS=-m32 CXXFLAGS=-m32
$ cmake -B _build
$ cmake --build _build
[...]
src/helpers/MiscFunctions.cpp: In function 'SWorkspaceIDName getWorkspaceIDNameFromString(const std::string&)':
src/helpers/MiscFunctions.cpp:356:41: error: no matching function for call to 'max(WORKSPACEID&, long int)'
  356 |                 predictedWSID = std::max(predictedWSID, 0L);
      |                                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/string:51,
                 from src/helpers/MiscFunctions.hpp:4,
                 from src/helpers/MiscFunctions.cpp:1:
/usr/include/c++/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
src/helpers/MiscFunctions.cpp:356:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
  356 |                 predictedWSID = std::max(predictedWSID, 0L);
      |                                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/bits/unicode.h:38,
                 from /usr/include/c++/text_encoding:44,
                 from /usr/include/c++/bits/locale_classes.h:44,
                 from /usr/include/c++/locale:41,
                 from /usr/include/c++/format:47,
                 from /usr/include/hyprutils/math/Vector2D.hpp:3,
                 from /usr/include/hyprutils/math/Region.hpp:5,
                 from src/helpers/math/Math.hpp:6,
                 from src/helpers/MiscFunctions.hpp:6:
/usr/include/c++/bits/stl_algo.h:5705:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5705 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/bits/stl_algo.h:5705:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/bits/stl_algo.h:5715:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5715 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/bits/stl_algo.h:5715:5: note:   template argument deduction/substitution failed:
src/helpers/MiscFunctions.cpp:356:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  356 |                 predictedWSID = std::max(predictedWSID, 0L);
      |                                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~
src/helpers/MiscFunctions.cpp:379:43: error: no matching function for call to 'max(size_t&, long unsigned int)'
  379 |                     currentItem = std::max(currentItem, 0UL);
      |                                   ~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
src/helpers/MiscFunctions.cpp:379:43: note:   deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'long unsigned int')
  379 |                     currentItem = std::max(currentItem, 0UL);
      |                                   ~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/bits/stl_algo.h:5705:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5705 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/bits/stl_algo.h:5705:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/bits/stl_algo.h:5715:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5715 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/bits/stl_algo.h:5715:5: note:   template argument deduction/substitution failed:
src/helpers/MiscFunctions.cpp:379:43: note:   mismatched types 'std::initializer_list<_Tp>' and 'unsigned int'
  379 |                     currentItem = std::max(currentItem, 0UL);
      |                                   ~~~~~~~~^~~~~~~~~~~~~~~~~~
src/helpers/MiscFunctions.cpp:416:52: error: no matching function for call to 'clamp(unsigned int&, long unsigned int, std::vector<long long int>::size_type)'
  416 |                             namedWSIdx = std::clamp(namedWSIdx, 0UL, namedWSes.size() - 1);
      |                                          ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/bits/stl_algo.h:3623:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::clamp(const _Tp&, const _Tp&, const _Tp&)'
 3623 |     clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi)
      |     ^~~~~
/usr/include/c++/bits/stl_algo.h:3623:5: note:   template argument deduction/substitution failed:
src/helpers/MiscFunctions.cpp:416:52: note:   deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'long unsigned int')
  416 |                             namedWSIdx = std::clamp(namedWSIdx, 0UL, namedWSes.size() - 1);
      |                                          ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/bits/stl_algo.h:3643:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::clamp(const _Tp&, const _Tp&, const _Tp&, _Compare)'
 3643 |     clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
      |     ^~~~~
/usr/include/c++/bits/stl_algo.h:3643:5: note:   candidate expects 4 arguments, 3 provided

How to reproduce

Build with -m32 or in 32-bit chroot.

Crash reports, logs, images, videos

No response

@jbeich jbeich added the bug Something isn't working label Aug 20, 2024
@sonnyxsm
Copy link

sonnyxsm commented Aug 24, 2024

crushing function calls that expect a 64 bit number to work with a 32bit build seems like a bad idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants