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

Compile Issues with ARM bare-metal GCC #280

Closed
ehntoo opened this issue Aug 11, 2023 · 1 comment
Closed

Compile Issues with ARM bare-metal GCC #280

ehntoo opened this issue Aug 11, 2023 · 1 comment

Comments

@ehntoo
Copy link
Contributor

ehntoo commented Aug 11, 2023

There seems to be some bad interaction with the way libstdc++ is configured/compiled for ARM's bare-metal GNU toolchain (https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) and this library that results in a compilation failure:

In file included from /opt/compiler-explorer/arm/gcc-arm-none-eabi-11.2-2022.02/arm-none-eabi/include/c++/11.2.1/cctype:42,
                 from /opt/compiler-explorer/arm/gcc-arm-none-eabi-11.2-2022.02/arm-none-eabi/include/c++/11.2.1/bits/localefwd.h:42,
                 from /opt/compiler-explorer/arm/gcc-arm-none-eabi-11.2-2022.02/arm-none-eabi/include/c++/11.2.1/string:43,
                 from /opt/compiler-explorer/arm/gcc-arm-none-eabi-11.2-2022.02/arm-none-eabi/include/c++/11.2.1/stdexcept:39,
                 from /app/raw.githubusercontent.com/kokkos/mdspan/single-header/mdspan.hpp:1871,
                 from <source>:11:
/app/raw.githubusercontent.com/kokkos/mdspan/single-header/mdspan.hpp:2011:27: error: expected identifier before numeric constant
 2011 | template <class _T, class _U, class _Enable = void> struct __compressed_pair {
      |                           ^~
/app/raw.githubusercontent.com/kokkos/mdspan/single-header/mdspan.hpp:2011:27: error: expected '>' before numeric constant
/app/raw.githubusercontent.com/kokkos/mdspan/single-header/mdspan.hpp:2013:29: error: expected unqualified-id before numeric constant
 2013 |   _MDSPAN_NO_UNIQUE_ADDRESS _U __u_val;
      |                             ^~
/app/raw.githubusercontent.com/kokkos/mdspan/single-header/mdspan.hpp:2018:53: error: expected unqualified-id before numeric constant
 2018 |   MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept { return __u_val; }
      |                                                     ^~
/app/raw.githubusercontent.com/kokkos/mdspan/single-header/mdspan.hpp:2019:42: error: expected unqualified-id before numeric constant
 2019 |   MDSPAN_FORCE_INLINE_FUNCTION constexpr _U const &__second() const noexcept {
      |                           
...

Godbolt reproduction based on the readme example: https://godbolt.org/z/s6qzafWP4

After some experimentation, I found that you can avoid the error by swapping the order of #include <stdexcept> and #include "layout_stride.hpp" in layout_right.hpp so that #include <stdexcept> comes last:

#include <stdexcept>
#include "layout_stride.hpp"

I have not been able to determine why this would fix the issue, though.

@ehntoo
Copy link
Contributor Author

ehntoo commented Aug 11, 2023

I swear I searched the issue tracker prior to this, but I've now stumbled on #187, which seems to explain the cause.

Closing, sorry for the noise.

@ehntoo ehntoo closed this as completed Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant