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

Compilation error with clang 14 on Apple silicon 13.6.4 #23

Open
fuhlig1 opened this issue May 21, 2024 · 8 comments
Open

Compilation error with clang 14 on Apple silicon 13.6.4 #23

fuhlig1 opened this issue May 21, 2024 · 8 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@fuhlig1
Copy link

fuhlig1 commented May 21, 2024

When trying to compile the test suite on an Apple silicon with macosx 13.6.4 and Apple clang 14 I get the following error

CC=clang CXX=clang++ make

gnu++2b: test extensions (-Wall -Wextra -Wpedantic -Wno-attributes -Wno-unknown-pragmas -Wno-psabi -Wno-self-assign-overloaded -Wno-deprecated -I/Users/uhlig/vir-simd)
In file included from vir/test.cpp:7:
In file included from /Users/uhlig/vir-simd/vir/simdize.h:19:
vir/simd_permute.h:176:23: error: no template named 'bit_cast' in namespace 'std'; did you mean 'detail::bit_cast'?
                const VecType vec = std::bit_cast<VecType>(v);
                                    ^~~~~~~~~~~~~
                                    detail::bit_cast
vir/detail.h:155:5: note: 'detail::bit_cast' declared here
    bit_cast(const From& x)
    ^
@mattkretz
Copy link
Owner

Oh, this is missing an #include <bit> in simdize.h. Seems to be indirectly included on my side.

@fuhlig1
Copy link
Author

fuhlig1 commented May 21, 2024

This is what I tried first but this doesn't help. The #include <bit> is in simd_permute.h.

@mattkretz
Copy link
Owner

According to https://en.cppreference.com/w/cpp/compiler_support std::bit_cast was added in Apple Clang 14.0.3. So maybe it's actually not available at all on your side?

@mattkretz
Copy link
Owner

If that's the case then we need to work around it via __cpp_lib_bit_cast (or __builtin_bit_cast - does that work?)

@fuhlig1
Copy link
Author

fuhlig1 commented May 21, 2024

According to https://en.cppreference.com/w/cpp/compiler_support std::bit_cast was added in Apple Clang 14.0.3. So maybe it's actually not available at all on your side?

Since I am using Apple Clang 14.0.0 this is probably the issue.

@fuhlig1
Copy link
Author

fuhlig1 commented May 21, 2024

If that's the case then we need to work around it via __cpp_lib_bit_cast (or __builtin_bit_cast - does that work?)

I think __builtin_bit_cast works. After changing the code the compilation now fails with missing functions from std::ranges. If I read the table correctly this functions are also missing in Apple clang 14.

@mattkretz
Copy link
Owner

OK, and I thought GCC 9 (in CI) was old 😅. So I guess the code needs way more #ifdef on feature test macros.

@mattkretz
Copy link
Owner

The master branch does not rely on std::bit_cast directly anymore (if I got it right). Can you confirm Apple builds now?

@mattkretz mattkretz added the bug Something isn't working label Aug 23, 2024
@mattkretz mattkretz self-assigned this Aug 23, 2024
@mattkretz mattkretz added this to the v0.4.0 milestone Aug 23, 2024
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

No branches or pull requests

2 participants