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

IBM z/Architecture (s390x) support #139

Closed
raulcabello opened this issue Jan 27, 2022 · 3 comments
Closed

IBM z/Architecture (s390x) support #139

raulcabello opened this issue Jan 27, 2022 · 3 comments
Assignees

Comments

@raulcabello
Copy link
Contributor

raulcabello commented Jan 27, 2022

I got an error with the ring crate when compiling kwctl for s390x. It is the same error described here briansmith/ring#986

I get the same error compiling ring on a s390x VM and cross compiling with cargo build --target s390x-unknown-linux-gnu.
musl does not work on s390x, cargo build --target s390x-unknown-linux-musl fails because std is not available https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-3

This PR briansmith/ring#1297 adds support for s390x, but it looks like it's not in active development and needs more work. I successfully compiled ring from this PR on s390x, but rustls does not compile because there were some changes done in ring 0.17. I got the following error:

   Compiling rustls v0.19.1

error[E0061]: this function takes 3 arguments but 4 arguments were supplied
   --> /root/.cargo/registry/src/github.com-eae4ba8cbf2ce1c7/rustls-0.19.1/src/suites.rs:109:22
    |
109 |           let secret = ring::agreement::agree_ephemeral(self.privkey, &peer_key, (), |v| {
    |  ______________________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^_------------__---------__--__-
    | |                      |
    | |                      expected 3 arguments
110 | |             let mut r = Vec::new();
111 | |             r.extend_from_slice(v);
112 | |             Ok(r)
113 | |         });
    | |_________- supplied 4 arguments


249 | pub fn agree_ephemeral<B: AsRef<[u8]>, R>(
    |        ^^^^^^^^^^^^^^^

error[E0061]: this function takes 3 arguments but 2 arguments were supplied
   --> /root/.cargo/registry/src/github.com-eae4ba8cbf2ce1c7/rustls-0.19.1/src/sign.rs:297:9
    |
297 |         EcdsaKeyPair::from_pkcs8(sigalg, &der.0)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^ ------  ------ supplied 2 arguments
    |         |
    |         expected 3 arguments

I can compile kwctl if I remove rustls, then the following error is deployed when executing kwctl run

thread 'main' panicked at 'not implemented: Unimplemented relocation S390xPCRel32Dbl', /root/.cargo/registry/src/github.com-eae4ba8cbf2ce1c7/wasmtime-cranelift-0.30.0/src/obj.rs:454:26

Summary of what we would need:

  • Add s390x support for ring (there is already a PR, but it looks like it's not in active development and needs more work)
  • Modify rustls to use the ring version with s390x support
  • Fix issue with wasmtime on s390x
@flavio
Copy link
Member

flavio commented Jan 27, 2022

Maybe it would be possible to build with ring and openssl, not with rusttls... You could do a quick test by replacing rusttls with openssl-sys inside of all our crates. Do something hackish, like changing all the Cargo.toml

@raulcabello
Copy link
Contributor Author

raulcabello commented Jan 28, 2022

@flavio I removed rustls from all crates and I could compile kwctl on s390x. I also had to remove mdcat because it was using rustls.
I got the following error when executing kwctl run

thread 'main' panicked at 'not implemented: Unimplemented relocation S390xPCRel32Dbl', /root/.cargo/registry/src/github.com-eae4ba8cbf2ce1c7/wasmtime-cranelift-0.30.0/src/obj.rs:454:26

I tried to use wasmtime 0.33.0 to see if this issue was fixed. For that I used wasmtime-provider v1.0.0-alpha.0, then I got this error:

error[E0277]: the trait bound `Result<WasmtimeEngineProvider, wasmtime_provider::errors::Error>: WebAssemblyEngineProvider` is not satisfied
   --> /root/policy-evaluator/src/policy_evaluator.rs:131:47
    let wapc_host = WapcHost::new(Box::new(engine), wapc_callback)?;
     ------------- ^^^^^^^^^^^^^^^^ the trait `WebAssemblyEngineProvider` is not implemented for   `Result<WasmtimeEngineProvider, wasmtime_provider::errors::Error>`
    required by a bound introduced by this call

Anyway it looks like relocation S390xPCRel32Dbl is still not implemented https://github.com/bytecodealliance/wasmtime/blob/main/crates/cranelift/src/obj.rs#L439

@flavio
Copy link
Member

flavio commented Jan 28, 2022

Ouch, thanks a lot for the investigation. This is useful information

@raulcabello raulcabello self-assigned this Jan 28, 2022
viccuad pushed a commit to viccuad/kwctl that referenced this issue Aug 13, 2024
Signed-off-by: Cintia Sanchez Garcia <cynthiasg@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants