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

Support Windows #121

Open
bradlarsen opened this issue Jan 29, 2024 · 7 comments
Open

Support Windows #121

bradlarsen opened this issue Jan 29, 2024 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed packaging Related to packaging and distribution

Comments

@bradlarsen
Copy link
Collaborator

bradlarsen commented Jan 29, 2024

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 bradlarsen added enhancement New feature or request help wanted Extra attention is needed packaging Related to packaging and distribution labels Jan 29, 2024
@bradlarsen
Copy link
Collaborator Author

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

@munntjlx
Copy link
Contributor

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

@munntjlx
Copy link
Contributor

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

@munntjlx
Copy link
Contributor

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

@bradlarsen
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

Note: the Vectorscan C++ code doesn't officially support windows and doesn't have any plans to do so: VectorCamp/vectorscan#314

It might be possible with some build system patches to get that building on Windows.

Getting vectorscan-rs building on Windows would be a necessary step for Nosey Parker to build on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed packaging Related to packaging and distribution
Projects
None yet
Development

No branches or pull requests

2 participants