Rust - sorry, unimplemented: 64-bit mode not compiled in
Asked Answered
X

2

1

When I cargo run, I get met with

error: failed to run custom build command for `ring v0.16.20`

  --- stderr
  running "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "include" "-Wall" "-Wextra" "-std=c1x" "-Wbad-function-cast" "-Wnested-externs" "-Wstrict-prototypes" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-g3" "-DNDEBUG" "-c" "-oC:\\Users\\Derpboimoon\\documents\\rust\\phosphorus\\target\\debug\\build\\ring-d6190243a10e7549\\out\\aes_nohw.o" "crypto/fipsmodule/aes/aes_nohw.c"
  crypto/fipsmodule/aes/aes_nohw.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
   /* Copyright (c) 2019, Google Inc.

  thread 'main' panicked at 'execution failed', C:\Users\Pat\.cargo\registry\src\github.com-1ecc6299db9ec823\ring-0.16.20\build.rs:656:9

Here is my Cargo.toml file:

[package]
name = "phosphorus"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio = { version = "1.7.0", default-features = false, features = ["macros", "sync", "rt-multi-thread"] }
twilight-http = "0.3"

I am using rustup default stable-x86_64-pc-windows-gnu if that helps.

I read around stack overflow and it seems that I need to set the gcc target to x86_64. How do I do that? I suspect the error is from tokio, but not sure.

Any help would be appreciated!

Xerophilous answered 27/6, 2021 at 9:58 Comment(2)
From Building ring: Supported Toolchains: "On Windows, ring supports the x86_64-pc-windows-msvc and i686-pc-windows-msvc targets best. [...] Patches to get it working on other variants, including in particular [...] the -gnu targets (#330) are welcome."Often
The dependency on ring comes from twilight-http, via hyper-rustls (which is an optional, but default, dependency): see the "TLS" section in its README.Often
L
3

I took this approach to solve the "failed to run custom build command for ring" issue using rust-musl-builder:

  1. Add the target to rust toolchain:
rustup target add x86_64-unknown-linux-musl
  1. Define alias to run a docker container
alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder'
  1. Build your project using the container
rust-musl-builder cargo build --release

Here is a list of supported targets: https://doc.rust-lang.org/rustc/platform-support.html

Length answered 8/1, 2022 at 1:7 Comment(0)
A
1

This might hels someone else on Windows:

  1. Install Visual Studio; make sure you select; .NET desktop development, Desktop development with C++, and Universal Windows Platform development.
  2. Show the installed toolchain rustup show.
  3. Then change and set the toolchain by running rustup default stable-x86_64-pc-windows-msvc.

This worked for me after weeks of not getting a working solution.

Antisthenes answered 23/10, 2022 at 17:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.