Navigation Menu

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

ARM64 builds fails if Neon is enabled on MSVC #1521

Closed
sylveon opened this issue Jun 5, 2019 · 2 comments · Fixed by #1548
Closed

ARM64 builds fails if Neon is enabled on MSVC #1521

sylveon opened this issue Jun 5, 2019 · 2 comments · Fixed by #1548
Labels

Comments

@sylveon
Copy link
Contributor

sylveon commented Jun 5, 2019

When building rapidjson for ARM64 with RAPIDJSON_NEON defined on MSVC, it will fail to build, because it includes <arm_neon.h>, but this is for ARM 32-bits only on Microsoft's compiler. The right file to include is <arm64_neon.h>

Apparently a fix is incoming, but this was posted in April and we're in June now... https://developercommunity.visualstudio.com/content/problem/201662/arm-neonh-doenst-support-arm64-compiler.html

@miloyip miloyip added the build label Jun 6, 2019
@sylveon
Copy link
Contributor Author

sylveon commented Jul 25, 2019

This got fixed in the latest VS 2019, but now when compiling with NEON on, there's a bunch of errors pertaining to __builtin_clzll and uint64x2_t

  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(446,24): error C2440:  'reinterpret_cast': cannot convert from 'uint8x16_t' to 'uint64x2_t' [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(446,24): error C2440:         uint64_t low = vgetq_lane_u64(reinterpret_cast<uint64x2_t>(x), 0);   // extract [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(446,24): error C2440:                        ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(447,25): error C2440:  'reinterpret_cast': cannot convert from 'uint8x16_t' to 'uint64x2_t' [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(447,25): error C2440:         uint64_t high = vgetq_lane_u64(reinterpret_cast<uint64x2_t>(x), 1);  // extract [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(447,25): error C2440:                         ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(451,25): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(451,25): error C3861:                 int lz =__builtin_clzll(high);; [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(451,25): error C3861:                         ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(455,22): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(455,22): error C3861:             int lz = __builtin_clzll(low);; [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(455,22): error C3861:                      ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(482,24): error C2440:  'reinterpret_cast': cannot convert from 'uint8x16_t' to 'uint64x2_t' [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(482,24): error C2440:         uint64_t low = vgetq_lane_u64(reinterpret_cast<uint64x2_t>(x), 0);   // extract [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(482,24): error C2440:                        ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(483,25): error C2440:  'reinterpret_cast': cannot convert from 'uint8x16_t' to 'uint64x2_t' [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(483,25): error C2440:         uint64_t high = vgetq_lane_u64(reinterpret_cast<uint64x2_t>(x), 1);  // extract [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(483,25): error C2440:                         ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(487,26): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(487,26): error C3861:                 int lz = __builtin_clzll(high); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(487,26): error C3861:                          ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(491,22): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(491,22): error C3861:             int lz = __builtin_clzll(low); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(491,22): error C3861:                      ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1254,45): error C2065:  '__builtin_clzll': undeclared identifier [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1254,45): error C2065:                     unsigned lz = (unsigned)__builtin_clzll(high);; [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1254,45): error C2065:                                             ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1254,45): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1254,45): error C3861:                     unsigned lz = (unsigned)__builtin_clzll(high);; [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1254,45): error C3861:                                             ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1259,41): error C2065:  '__builtin_clzll': undeclared identifier [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1259,41): error C2065:                 unsigned lz = (unsigned)__builtin_clzll(low);; [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1259,41): error C2065:                                         ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1259,41): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1259,41): error C3861:                 unsigned lz = (unsigned)__builtin_clzll(low);; [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1259,41): error C3861:                                         ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1324,45): error C2065:  '__builtin_clzll': undeclared identifier [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1324,45): error C2065:                     unsigned lz = (unsigned)__builtin_clzll(high); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1324,45): error C2065:                                             ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1324,45): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1324,45): error C3861:                     unsigned lz = (unsigned)__builtin_clzll(high); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1324,45): error C3861:                                             ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1329,41): error C2065:  '__builtin_clzll': undeclared identifier [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1329,41): error C2065:                 unsigned lz = (unsigned)__builtin_clzll(low); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1329,41): error C2065:                                         ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1329,41): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1329,41): error C3861:                 unsigned lz = (unsigned)__builtin_clzll(low); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1329,41): error C3861:                                         ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1378,30): error C2065:  '__builtin_clzll': undeclared identifier [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1378,30): error C2065:                     int lz = __builtin_clzll(high); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1378,30): error C2065:                              ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1378,30): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1378,30): error C3861:                     int lz = __builtin_clzll(high); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1378,30): error C3861:                              ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1383,26): error C2065:  '__builtin_clzll': undeclared identifier [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1383,26): error C2065:                 int lz = __builtin_clzll(low); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1383,26): error C2065:                          ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1383,26): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1383,26): error C3861:                 int lz = __builtin_clzll(low); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\reader.h(1383,26): error C3861:                          ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(671,1): error C2440:  'reinterpret_cast': cannot convert from 'uint8x16_t' to 'uint64x2_t' [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(671,1): error C2440:         uint64_t low = vgetq_lane_u64(reinterpret_cast<uint64x2_t>(x), 0);   // extract [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(671,1): error C2440: ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(672,1): error C2440:  'reinterpret_cast': cannot convert from 'uint8x16_t' to 'uint64x2_t' [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(672,1): error C2440:         uint64_t high = vgetq_lane_u64(reinterpret_cast<uint64x2_t>(x), 1);  // extract [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(672,1): error C2440: ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(678,41): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(678,41): error C3861:                 unsigned lz = (unsigned)__builtin_clzll(high); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(678,41): error C3861:                                         ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
  T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(683,37): error C3861:  '__builtin_clzll': identifier not found [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(683,37): error C3861:             unsigned lz = (unsigned)__builtin_clzll(low); [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]
T:\Projects\vcpkg\installed\arm64-windows\include\rapidjson\writer.h(683,37): error C3861:                                     ^ (compiling source file main.cpp) [T:\Projects\TranslucentTB\TranslucentTB\TranslucentTB.vcxproj]

@sylveon
Copy link
Contributor Author

sylveon commented Jul 25, 2019

clzll can be replaced with https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64

The casts can be replaced by vreinterpretq_u64_u8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants