eclipse-iceoryx / iceoryx2

Eclipse iceoryx2™ - true zero-copy inter-process-communication in pure Rust
https://iceoryx.io
Apache License 2.0
444 stars 22 forks source link

Cannot build for target `i686-pc-windows-msvc` #235

Closed Chaoses-Ib closed 1 week ago

Chaoses-Ib commented 1 week ago

Required information

Operating system: Windows 11 24H2 10.0.26100.712

Rust version: rustc 1.80.0-nightly (9cdfe285c 2024-05-22)

Cargo version: cargo 1.80.0-nightly (84dc5dc11 2024-05-20)

iceoryx2 version: main branch

Observed result or behaviour:

> cargo build --target i686-pc-windows-msvc
...
error: failed to run custom build command for `iceoryx2-pal-posix v0.3.0 (https://github.com/eclipse-iceoryx/iceoryx2.git?branch=main#1f5c8a3d)`

Caused by:
  process didn't exit successfully: `C:\test\target\debug\build\iceoryx2-pal-posix-bcebb1f44bc964b5\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=src/c/posix.h
  cargo:rerun-if-env-changed=TARGET
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_i686-pc-windows-msvc
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_i686_pc_windows_msvc
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
  cargo:rerun-if-changed=src/c/posix.h

  --- stderr
  src/c/posix.h:32:10: fatal error: 'arpa/inet.h' file not found
  thread 'main' panicked at C:\Users\Chaoses\.cargo\git\checkouts\iceoryx2-1e1d4490bb91753f\1f5c8a3\iceoryx2-pal\posix\build.rs:44:18:
  Unable to generate bindings: ClangDiagnostic("src/c/posix.h:32:10: fatal error: 'arpa/inet.h' file not found\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Obviously, posix.h only handles _WIN64, not _WIN32: https://github.com/eclipse-iceoryx/iceoryx2/blob/1f5c8a3dbe6a4fdcb786a97e181b2b3637575fc7/iceoryx2-pal/posix/src/c/posix.h#L31-L46

Is 32-bit Windows not in the support list of iceoryx2?

Expected result or behaviour: Build successfully.

Conditions where it occurred / Performed steps: i686-pc-windows-msvc target

elfenpiff commented 1 week ago

@Chaoses-Ib This is a platform we did not yet think of, but 32-bit support should generally be supported.

I think this may be easily fixed by changing the line 31 in posix.h into #if defined(_WIN64) || defined(_WIN32). Let me check it out. If this works I will create a pull request.

Chaoses-Ib commented 1 week ago

FYI, _WIN32 is "defined as 1 when the compilation target is 32-bit ARM, 64-bit ARM, x86, or x64", not only for 32-bit. The doc is here: https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170

elfenpiff commented 1 week ago

@Chaoses-Ib thanks for the hint! I could reproduce your bug and fix it by adding some defined(_WIN32) here and there and by adjusting a usize variable to u64.