noseyparker icon indicating copy to clipboard operation
noseyparker copied to clipboard

Support Windows

Open bradlarsen opened this issue 1 year ago • 6 comments

It would be useful if Nosey Parker would build and run on Windows. The releases should also include prebuilt Windows binary releases.

I've not tried building on Windows. It should work in theory, but:

  • The cmake-related bits for Vectorscan and zlib might cause trouble
  • There may be some platform-specific code in Nosey Parker
  • The scripts/release.zsh script is pretty unix-specific

bradlarsen avatar Jan 29 '24 21:01 bradlarsen

I haven't tried on a native Windows machine, but tried a cross build from macOS:

$ cargo install -f cross
$ export TARGET="x86_64-pc-windows-gnu" ; rustup target add "$TARGET" ; export RUSTFLAGS="-C target-feature=+crt-static"
$ cross build --target "$TARGET" --release

This fails with the following error:

error: failed to run custom build command for `vectorscan-sys v0.0.0 (/project/crates/vectorscan-sys)`

Caused by:
  process didn't exit successfully: `/target/release/build/vectorscan-sys-887de5b3182866e7/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-link-lib=stdc++
  CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-gnu = None
  CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_gnu = None
  TARGET_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-pc-windows-gnu = None
  CMAKE_GENERATOR_x86_64_pc_windows_gnu = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-pc-windows-gnu = None
  CMAKE_PREFIX_PATH_x86_64_pc_windows_gnu = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-pc-windows-gnu = None
  CMAKE_x86_64_pc_windows_gnu = None
  TARGET_CMAKE = None
  CMAKE = None
  running: cd "/target/x86_64-pc-windows-gnu/release/build/vectorscan-sys-9325e5473307dfb1/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/project/crates/vectorscan-sys/vectorscan" "-DCMAKE_INSTALL_INCLUDEDIR=/target/x86_64-pc-windows-gnu/release/build/vectorscan-sys-9325e5473307dfb1/out/include" "-DFAT_RUNTIME=ON" "-DBUILD_AVX512=OFF" "-DBUILD_EXAMPLES=OFF" "-DBUILD_BENCHMARKS=OFF" "-DBUILD_UNITTESTS=OFF" "-DBUILD_DOCS=OFF" "-DBUILD_TOOLS=OFF" "-DCMAKE_SYSTEM_NAME=Windows" "-DCMAKE_SYSTEM_PROCESSOR=AMD64" "-DCMAKE_INSTALL_PREFIX=/target/x86_64-pc-windows-gnu/release/build/vectorscan-sys-9325e5473307dfb1/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc-posix" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++-posix" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc-posix" "-DCMAKE_BUILD_TYPE=Release"
  -- The C compiler identification is GNU 7.3.0
  -- The CXX compiler identification is GNU 7.3.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc-posix - 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: /usr/bin/x86_64-w64-mingw32-g++-posix - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Performing Test ARCH_X86_64
  -- Performing Test ARCH_X86_64 - Success
  -- Performing Test ARCH_IA32
  -- Performing Test ARCH_IA32 - Failed
  -- Performing Test ARCH_AARCH64
  -- Performing Test ARCH_AARCH64 - Failed
  -- Performing Test ARCH_ARM32
  -- Performing Test ARCH_ARM32 - Failed
  -- Performing Test ARCH_PPC64EL
  -- Performing Test ARCH_PPC64EL - Failed
  -- Build type RELEASE
  -- using release build
  -- Boost version: 1.83.0
  -- Build date: 2024-01-29
  -- Building static libraries
  -- gcc version 7.3.0
  -- gcc will tune for broadwell, broadwell
  -- ARCH_C_FLAGS   : -msse4.2
  -- ARCH_CXX_FLAGS : -msse4.2
  -- g++ version 7.3.0
  -- Configuring incomplete, errors occurred!
  See also "/target/x86_64-pc-windows-gnu/release/build/vectorscan-sys-9325e5473307dfb1/out/build/CMakeFiles/CMakeOutput.log".
  See also "/target/x86_64-pc-windows-gnu/release/build/vectorscan-sys-9325e5473307dfb1/out/build/CMakeFiles/CMakeError.log".

  --- stderr
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 2.8.12 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:264 (message):
    A minimum of g++ 9 is required for C++17 support


  thread 'main' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:

  command did not execute successfully, got: exit status: 1

  build script failed, must exit now
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

bradlarsen avatar Jan 29 '24 21:01 bradlarsen

Looks like you need to target a HIGHER version of GCC and g++ but I suspect you already know that!

munntjlx avatar Feb 16 '24 17:02 munntjlx

Have you looked at mingw? Its a different compiler for windows.

munntjlx avatar Feb 16 '24 17:02 munntjlx

You could also look at making a 'cygwin' compatible version which might be faster for a native build..

munntjlx avatar Feb 16 '24 17:02 munntjlx

Thanks @munntjlx, all reasonable suggestions. I haven't spent more than cursory time looking into this. The results from above were trying to use the cross tool for cross-platform building using Docker containers, without any kind of environment customization.

bradlarsen avatar Feb 16 '24 20:02 bradlarsen

Note for posterity: apparently the native Linux release binaries work without trouble on Windows using WSL1.

WSL2 is reported as being problematic for requiring nested virtualization support or something else.

bradlarsen avatar Jul 26 '24 19:07 bradlarsen