Skip to content

Compilation error in v0.8 on 32-bit architectures #68

Description

@kylebarron

In developmentseed/zarrista#102 I tried to update my library to use dlpark v0.8 but it failed to compile, and it looks like it's due to assumptions about 32-bit architectures.

error[E0080]: attempt to compute `40_usize - 48_usize`, which would overflow
   --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dlpark-0.8.0/src/ffi.rs:162:26
    |
162 |     ["Size of DLTensor"][::std::mem::size_of::<DLTensor>() - 48usize];
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `ffi::_` failed here

error[E0080]: attempt to compute `48_usize - 64_usize`, which would overflow
   --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dlpark-0.8.0/src/ffi.rs:186:33
    |
186 |     ["Size of DLManagedTensor"][::std::mem::size_of::<DLManagedTensor>() - 64usize];
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `ffi::_` failed here

error[E0080]: attempt to compute `64_usize - 80_usize`, which would overflow
   --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dlpark-0.8.0/src/ffi.rs:213:10
    |
213 |         [::std::mem::size_of::<DLManagedTensorVersioned>() - 80usize];
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `ffi::_` failed here

error[E0080]: attempt to compute `12_usize - 16_usize`, which would overflow
   --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dlpark-0.8.0/src/ffi.rs:282:41
    |
282 |     ["Size of DLPackExchangeAPIHeader"][::std::mem::size_of::<DLPackExchangeAPIHeader>() - 16usize];
    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `ffi::_` failed here

error[E0080]: attempt to compute `32_usize - 56_usize`, which would overflow
   --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dlpark-0.8.0/src/ffi.rs:309:35
    |
309 |     ["Size of DLPackExchangeAPI"][::std::mem::size_of::<DLPackExchangeAPI>() - 56usize];
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `ffi::_` failed here

For more information about this error, try `rustc --explain E0080`.
error: could not compile `dlpark` (lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_BUILD_EXTENSION_MODULE="1" PYO3_CONFIG_FILE="/home/runner/work/zarrista/zarrista/target/maturin/pyo3-config-wasm32-unknown-emscripten-3.14.txt" "cargo" "rustc" "--features" "pyo3/extension-module" "--no-default-features" "--target" "wasm32-unknown-emscripten" "--message-format" "json-render-diagnostics" "--manifest-path" "/home/runner/work/zarrista/zarrista/Cargo.toml" "--lib" "--" "-C" "link-arg=-sSIDE_MODULE=2" "-C" "link-arg=-sWASM_BIGINT"`
Error: The process '/home/runner/work/_temp/e38b3336-a765-4e74-b379-e9f56f276aa2/maturin' failed with exit code 1
    at ExecState._setResult (file:///home/runner/work/_actions/PyO3/maturin-action/v1/dist/index.js:45748:25)
    at ExecState.CheckComplete (file:///home/runner/work/_actions/PyO3/maturin-action/v1/dist/index.js:45731:18)
    at ChildProcess.<anonymous> (file:///home/runner/work/_actions/PyO3/maturin-action/v1/dist/index.js:45627:27)
    at ChildProcess.emit (node:events:509:28)
    at maybeClose (node:internal/child_process:1124:16)
    at ChildProcess._handle.onexit (node:internal/child_process:306:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions