google / highway

Performance-portable, length-agnostic SIMD with runtime dispatch
Apache License 2.0
4.21k stars 319 forks source link

Cannot build highway on windows11 with vs 2022 #2373

Closed LaurentBerger closed 6 hours ago

LaurentBerger commented 7 hours ago

I have got errors (MSVC 2022 error C2589) when I compile highway lib :

C:\lib\highway\hwy\contrib\sort\algo-inl.h(131,17): error C2589: '(' : jeton non conforme à droite de '::' [C:\lib\build\hwy\sort_test.vcxproj]
  (compiler le fichier source '../../highway/hwy/contrib/sort/sort_test.cc')
      C:\lib\highway\hwy\contrib\sort\algo-inl.h(131,17):
      le contexte d’instanciation du modèle (le plus ancien) est
          C:\lib\highway\hwy\contrib\sort\sort_test.cc(204,5):
          voir la référence à l'instanciation de la fonction modèle 'void hwy::N_SSSE3::`anonymous-namespace'::TestAnySort<hwy::N_SSSE3::detail::TraitsLane<hwy::N_SSSE3::detail::OrderDescending<double>>>(const std::vector<hwy::Algo,std::allocator<hwy::Algo>> &,size_t)' en cours de compilation
          C:\lib\highway\hwy\contrib\sort\sort_test.cc(152,32):
          voir la référence à l'instanciation classe modèle 'hwy::InputStats<hwy::N_SSSE3::`anonymous-namespace'::TestAnySort::LaneType>' en cours de compilation
          C:\lib\highway\hwy\contrib\sort\algo-inl.h(130,8):
          pendant la compilation de la fonction membre classe modèle 'void hwy::InputStats<hwy::N_SSSE3::`anonymous-namespace'::TestAnySort::LaneType>::Notify(T)'
          with
          [
              T=hwy::N_SSSE3::`anonymous-namespace'::TestAnySort::LaneType
          ]
              C:\lib\highway\hwy\contrib\sort\result-inl.h(267,26):
              voir la première référence à « hwy::InputStats<hwy::N_SSSE3::`anonymous-namespace'::TestAnySort::LaneType>::Notify » dans « hwy::N_SSE2::SortOrderVerifier<Traits>::CheckSelectOrder »
          with
          [
              Traits=hwy::N_SSE2::detail::TraitsLane<hwy::N_SSE2::detail::OrderDescending<double>>
          ]
              C:\lib\highway\hwy\contrib\sort\result-inl.h(216,23):
              voir la première référence à « hwy::N_SSE2::SortOrderVerifier<Traits>::CheckSelectOrder » dans « hwy::N_SSE2::SortOrderVerifier<Traits>::operator () »
          with
          [
              Traits=hwy::N_SSE2::detail::TraitsLane<hwy::N_SSE2::detail::OrderDescending<double>>
          ]
              C:\lib\highway\hwy\contrib\sort\sort_test.cc(158,38):
              voir la première référence à « hwy::N_SSE2::SortOrderVerifier<Traits>::operator () » dans « hwy::N_SSE2::`anonymous-namespace'::TestAnySort »
          with
          [
              Traits=hwy::N_SSE2::detail::TraitsLane<hwy::N_SSE2::detail::OrderDescending<double>>
          ]

I tried

git clone https://github.com/google/highway.git
mkdir build/hwy
cd build/hwy/
cmake ../../highway/ -DCMAKE_INSTALL_PREFIX=/c/install/hwy

result

-- Building for: Visual Studio 17 2022
CMake Deprecation Warning at CMakeLists.txt:28 (cmake_policy):
  The OLD behavior for policy CMP0111 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.41.34123.0
-- The CXX compiler identification is MSVC 19.41.34123.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test ATOMICS_LOCK_FREE_INSTRUCTIONS
-- Performing Test ATOMICS_LOCK_FREE_INSTRUCTIONS - Success
-- Performing Test HWY_EMSCRIPTEN
-- Performing Test HWY_EMSCRIPTEN - Failed
-- Performing Test HWY_RISCV
-- Performing Test HWY_RISCV - Failed
-- Looking for sys/auxv.h
-- Looking for sys/auxv.h - not found
-- Looking for asm/hwcap.h
-- Looking for asm/hwcap.h - not found
-- Configuring done (10.5s)
-- Generating done (0.4s)
-- Build files have been written to: C:/lib/build/hwy

then

cmake --build . --target install --config release

full ouputhighway_ouput.txt

jan-wassenberg commented 6 hours ago

Hi, this is likely caused by a Windows or other header defining min/max. #define NOMINMAX beforehand should fix that, but we can also work around it by using HWY_MIN instead.

LaurentBerger commented 6 hours ago

thanks it works now with pr

 -- Install configuration: "release"
  -- Installing: C:/install/hwy/lib/hwy.lib
  -- Installing: C:/install/hwy/include/hwy/abort.h
  -- Installing: C:/install/hwy/include/hwy/aligned_allocator.h
  -- Installing: C:/install/hwy/include/hwy/base.h
  -- Installing: C:/install/hwy/include/hwy/cache_control.h
  -- Installing: C:/install/hwy/include/hwy/detect_compiler_arch.h
  -- Installing: C:/install/hwy/include/hwy/detect_targets.h
  -- Installing: C:/install/hwy/include/hwy/foreach_target.h
  -- Installing: C:/install/hwy/include/hwy/highway_export.h
  -- Installing: C:/install/hwy/include/hwy/highway.h
  -- Installing: C:/install/hwy/include/hwy/nanobenchmark.h
  -- Installing: C:/install/hwy/include/hwy/ops/arm_neon-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/arm_sve-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/emu128-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/generic_ops-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/inside-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/ppc_vsx-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/rvv-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/scalar-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/set_macros-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/shared-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/wasm_128-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/x86_128-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/x86_256-inl.h
  -- Installing: C:/install/hwy/include/hwy/ops/x86_512-inl.h
  -- Installing: C:/install/hwy/include/hwy/per_target.h
  -- Installing: C:/install/hwy/include/hwy/print-inl.h
  -- Installing: C:/install/hwy/include/hwy/print.h
  -- Installing: C:/install/hwy/include/hwy/profiler.h
  -- Installing: C:/install/hwy/include/hwy/robust_statistics.h
  -- Installing: C:/install/hwy/include/hwy/targets.h
  -- Installing: C:/install/hwy/include/hwy/timer-inl.h
  -- Installing: C:/install/hwy/include/hwy/timer.h
  -- Installing: C:/install/hwy/lib/hwy_contrib.lib
  -- Installing: C:/install/hwy/include/hwy/contrib/bit_pack/bit_pack-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/dot/dot-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/image/image.h
  -- Installing: C:/install/hwy/include/hwy/contrib/math/math-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/matvec/matvec-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/random/random-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/sort/order.h
  -- Installing: C:/install/hwy/include/hwy/contrib/sort/shared-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/sort/sorting_networks-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/sort/traits-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/sort/traits128-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/sort/vqsort-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/sort/vqsort.h
  -- Installing: C:/install/hwy/include/hwy/contrib/thread_pool/futex.h
  -- Installing: C:/install/hwy/include/hwy/contrib/thread_pool/thread_pool.h
  -- Installing: C:/install/hwy/include/hwy/contrib/thread_pool/topology.h
  -- Installing: C:/install/hwy/include/hwy/contrib/algo/copy-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/algo/find-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/algo/transform-inl.h
  -- Installing: C:/install/hwy/include/hwy/contrib/unroller/unroller-inl.h
  -- Installing: C:/install/hwy/lib/hwy_test.lib
  -- Installing: C:/install/hwy/include/hwy/tests/hwy_gtest.h
  -- Installing: C:/install/hwy/include/hwy/tests/test_util-inl.h
  -- Installing: C:/install/hwy/include/hwy/tests/test_util.h
  -- Installing: C:/install/hwy/lib/pkgconfig/libhwy.pc
  -- Installing: C:/install/hwy/lib/pkgconfig/libhwy-contrib.pc
  -- Installing: C:/install/hwy/lib/pkgconfig/libhwy-test.pc
  -- Installing: C:/install/hwy/lib/cmake/hwy/hwy-config-version.cmake
  -- Installing: C:/install/hwy/lib/cmake/hwy/hwy-config.cmake
  -- Installing: C:/install/hwy/lib/cmake/hwy/hwy-config-release.cmake