Rust Embedded ESP32C6 STD (Does Ring support the target "riscv32imac-esp-espidf" ?)
Hello,
I think I am missing a rustflag that is preventing the compiler to finish. If not could someone point myself in the right direction ?
config.toml
[build]
target = "riscv32imac-esp-espidf"
[target.riscv32imac-esp-espidf]
linker = "ldproxy"
runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x
rustflags = ["--cfg", "espidf_time64", "-C", "default-linker-libraries"]
[unstable]
build-std = ["std", "panic_abort"]
[env]
MCU="esp32c6"
# Note: this variable is not used by the pio builder (`cargo build --features pio`)
ESP_IDF_VERSION = "v5.1.1"
ESP_IDF_SDKCONFIG = "sdkconfig.defaults"`
Error:
error: failed to run custom build command for `ring v0.16.20`
Caused by:
process didn't exit successfully: `/home/silveira/bluefreedom/microcontroller/std/wifi-app/target/debug/build/ring-3c9642843c6b7cde/build-script-build` (exit status: 101)
--- stderr
thread 'main' panicked at /home/silveira/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:358:10:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: 0x55dac60e74ec - std::backtrace_rs::backtrace::libunwind::trace::h1fbf870cefe9105e
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x55dac60e74ec - std::backtrace_rs::backtrace::trace_unsynchronized::h978b11b27e2f243b
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x55dac60e74ec - std::sys_common::backtrace::_print_fmt::habb025370c831f53
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/sys_common/backtrace.rs:67:5
3: 0x55dac60e74ec - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h175d0c4e72d8b01b
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/sys_common/backtrace.rs:44:22
4: 0x55dac610e6a0 - core::fmt::rt::Argument::fmt::h71591df08c361895
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/core/src/fmt/rt.rs:142:9
5: 0x55dac610e6a0 - core::fmt::write::h878da2805c06feb0
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/core/src/fmt/mod.rs:1117:17
6: 0x55dac60e43df - std::io::Write::write_fmt::hce996c3c2e33dbfb
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/io/mod.rs:1762:15
7: 0x55dac60e72d4 - std::sys_common::backtrace::_print::h7b2452fe1769eb8d
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/sys_common/backtrace.rs:47:5
8: 0x55dac60e72d4 - std::sys_common::backtrace::print::hfa5833c6d1916a1a
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/sys_common/backtrace.rs:34:9
9: 0x55dac60e9107 - std::panicking::default_hook::{{closure}}::h44e0919432853577
10: 0x55dac60e8e6f - std::panicking::default_hook::h93e4296aa60de0bc
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panicking.rs:292:9
11: 0x55dac60e9588 - std::panicking::rust_panic_with_hook::hcdbdbaebb0a43fc3
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panicking.rs:731:13
12: 0x55dac60e9439 - std::panicking::begin_panic_handler::{{closure}}::hf55fea61efc61efe
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panicking.rs:601:13
13: 0x55dac60e79b6 - std::sys_common::backtrace::__rust_end_short_backtrace::h4c571597a30d8d60
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/sys_common/backtrace.rs:170:18
14: 0x55dac60e91d2 - rust_begin_unwind
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panicking.rs:597:5
15: 0x55dac6046675 - core::panicking::panic_fmt::ha700422250cfa942
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/core/src/panicking.rs:72:14
16: 0x55dac6046713 - core::panicking::panic::hb6a41ca25c8149c4
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/core/src/panicking.rs:127:5
17: 0x55dac604a2e0 - core::option::Option<T>::unwrap::heda08372157f4253
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/core/src/option.rs:925:21
18: 0x55dac604fb7c - build_script_build::build_c_code::hf7b15b536bf8c7a9
at /home/silveira/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:352:34
19: 0x55dac604f09a - build_script_build::ring_build_rs_main::h2298d5e6524edb11
at /home/silveira/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:279:5
20: 0x55dac604e8cd - build_script_build::main::hcb4196fdf3283bd6
at /home/silveira/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:240:13
21: 0x55dac604cd0b - core::ops::function::FnOnce::call_once::hd15b02c7eab37ab9
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/core/src/ops/function.rs:250:5
22: 0x55dac604c3ee - std::sys_common::backtrace::__rust_begin_short_backtrace::hcff1030303f512f6
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/sys_common/backtrace.rs:154:18
23: 0x55dac604c641 - std::rt::lang_start::{{closure}}::h7f5b3cb90e888fa9
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/rt.rs:167:18
24: 0x55dac60e0247 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h1f1b6918a869ec3c
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/core/src/ops/function.rs:284:13
25: 0x55dac60e0247 - std::panicking::try::do_call::heb9d85f4a283fb38
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panicking.rs:504:40
26: 0x55dac60e0247 - std::panicking::try::h7ac2a8aaebc8c7bb
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panicking.rs:468:19
27: 0x55dac60e0247 - std::panic::catch_unwind::h671ff94179299ebf
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panic.rs:142:14
28: 0x55dac60e0247 - std::rt::lang_start_internal::{{closure}}::h07d605ae212634ca
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/rt.rs:148:48
29: 0x55dac60e0247 - std::panicking::try::do_call::h7804545faa597905
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panicking.rs:504:40
30: 0x55dac60e0247 - std::panicking::try::hdf522b3210f130cf
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panicking.rs:468:19
31: 0x55dac60e0247 - std::panic::catch_unwind::h0b13f1af76b11520
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/panic.rs:142:14
32: 0x55dac60e0247 - std::rt::lang_start_internal::h3c9d98a55d8fa02b
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/rt.rs:148:20
33: 0x55dac604c61a - std::rt::lang_start::hbd29d149da853461
at /rustc/0039d739d40a076334e111488946441378d11cd7/library/std/src/rt.rs:166:17
34: 0x55dac6054fde - main
35: 0x7f1824629d90 - __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
36: 0x7f1824629e40 - __libc_start_main_impl
at ./csu/../csu/libc-start.c:392:3
37: 0x55dac6046d95 - _start
38: 0x0 - <unknown>
warning: build failed, waiting for other jobs to finish...
Cheers,
Closing this issue due the lack of answers from the repository contributors.
Cheers,
ring 0.17 is the first version that has implementations of every algorithm that could work on every target. But, we do have an allowlist of target architectures and target operating systems. I do not know what riscv32imac-esp-espidf but it looks like riscv32 which has a good chance of working. The main question is whether the getrandom crate supports that target and if not then we probably need PR #1754 to be merged.
Hi @briansmith ,
thank you for your answer.
getrandom supports the target riscv32imac-esp-espidf with no problem for STD rust embedded apps.
[target.'cfg(all(target_arch = "riscv32imac",target_os = "espidf"))'.dependencies]
getrandom = { git = "https://github.com/rust-random/getrandom.git" }
So, does ring have support for riscv32 ?
The following warnings were emitted during compilation:
warning: [email protected]: cc: error: unrecognized argument in option ‘-mabi=ilp32’
warning: [email protected]: cc: note: valid arguments to ‘-mabi=’ are: ms sysv
warning: [email protected]: cc: error: unrecognized argument in option ‘-mcmodel=medany’
warning: [email protected]: cc: note: valid arguments to ‘-mcmodel=’ are: 32 kernel large medium small
error: failed to run custom build command for `ring v0.17.4`
Caused by:
process didn't exit successfully: `/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/debug/build/ring-ecda5d3cd61702a7/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_4_
OPT_LEVEL = Some("z")
TARGET = Some("riscv32imac-esp-espidf")
HOST = Some("x86_64-unknown-linux-gnu")
cargo:rerun-if-env-changed=CC_riscv32imac-esp-espidf
CC_riscv32imac-esp-espidf = None
cargo:rerun-if-env-changed=CC_riscv32imac_esp_espidf
CC_riscv32imac_esp_espidf = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
RUSTC_LINKER = Some("ldproxy")
cargo:rerun-if-env-changed=CROSS_COMPILE
CROSS_COMPILE = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("a,c,m")
cargo:rerun-if-env-changed=CFLAGS_riscv32imac-esp-espidf
CFLAGS_riscv32imac-esp-espidf = None
cargo:rerun-if-env-changed=CFLAGS_riscv32imac_esp_espidf
CFLAGS_riscv32imac_esp_espidf = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: "cc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-march=rv32imac" "-mabi=ilp32" "-mcmodel=medany" "-I" "include" "-I" "/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/riscv32imac-esp-espidf/debug/build/ring-436cec22a770a0d7/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-g3" "-DNDEBUG" "-o" "/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/riscv32imac-esp-espidf/debug/build/ring-436cec22a770a0d7/out/crypto/curve25519/curve25519.o" "-c" "crypto/curve25519/curve25519.c"
cargo:warning=cc: error: unrecognized argument in option ‘-mabi=ilp32’
cargo:warning=cc: note: valid arguments to ‘-mabi=’ are: ms sysv
cargo:warning=cc: error: unrecognized argument in option ‘-mcmodel=medany’
cargo:warning=cc: note: valid arguments to ‘-mcmodel=’ are: 32 kernel large medium small
exit status: 1
--- stderr
error occurred: Command "cc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-march=rv32imac" "-mabi=ilp32" "-mcmodel=medany" "-I" "include" "-I" "/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/riscv32imac-esp-espidf/debug/build/ring-436cec22a770a0d7/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-g3" "-DNDEBUG" "-o" "/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/riscv32imac-esp-espidf/debug/build/ring-436cec22a770a0d7/out/crypto/curve25519/curve25519.o" "-c" "crypto/curve25519/curve25519.c" with args "cc" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
Cheers,
The following warnings were emitted during compilation:
warning: [email protected]: cc: error: unrecognized argument in option ‘-mabi=ilp32’ warning: [email protected]: cc: note: valid arguments to ‘-mabi=’ are: ms sysv warning: [email protected]: cc: error: unrecognized argument in option ‘-mcmodel=medany’ warning: [email protected]: cc: note: valid arguments to ‘-mcmodel=’ are: 32 kernel large medium small
You need to set TARGET_CC or equivalent to the C compiler for the target.
See also https://github.com/briansmith/ring/issues/1787 where I describe a bit of what's wrong with getrandom's implementation on this target.
The following warnings were emitted during compilation:
warning: [email protected]: cc: error: unrecognized argument in option ‘-mabi=ilp32’ warning: [email protected]: cc: note: valid arguments to ‘-mabi=’ are: ms sysv warning: [email protected]: cc: error: unrecognized argument in option ‘-mcmodel=medany’ warning: [email protected]: cc: note: valid arguments to ‘-mcmodel=’ are: 32 kernel large medium smallYou need to set
TARGET_CCor equivalent to the C compiler for the target.See also #1787 where I describe a bit of what's wrong with
getrandom's implementation on this target.
Regrading getrandom
I am using getrandom in other places and I have no problems with it. Should I wait for the "in-library DRBG" for this to work with the ring library ?
Regarding the ring library:
I think I am doing something wrong. I have already tried several types of configurations but I am not able to compile the ring crate.
I have the "riscv-gnu-toolchain" with the enable-multilib meaning it would work for both 64-bits and 32 bits.
riscv64-unknown-elf-gcc () 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Do I need some special configuration or flag to be added to the compiler ?
Errors: ->include/ring-core/target.h:63:2: error: #error "Unknown target CPU" ->crypto/curve25519/../internal.h:210:2: error: #error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
Configuration
TARGET_CC=/opt/riscv/bin/riscv64-unknown-elf-gcc cargo build --release
The following warnings were emitted during compilation:
warning: [email protected]: In file included from include/ring-core/base.h:74,
warning: [email protected]: from include/ring-core/mem.h:60,
warning: [email protected]: from crypto/curve25519/curve25519.c:22:
warning: [email protected]: include/ring-core/target.h:63:2: error: #error "Unknown target CPU"
warning: [email protected]: 63 | #error "Unknown target CPU"
warning: [email protected]: | ^~~~~
warning: [email protected]: In file included from crypto/curve25519/internal.h:20,
warning: [email protected]: from crypto/curve25519/curve25519.c:24:
warning: [email protected]: crypto/curve25519/../internal.h:210:2: error: #error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
warning: [email protected]: 210 | #error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
warning: [email protected]: | ^~~~~
warning: [email protected]: crypto/curve25519/../internal.h:223:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: 223 | static inline crypto_word_t value_barrier_w(crypto_word_t a) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:223:45: error: unknown type name 'crypto_word_t'
warning: [email protected]: 223 | static inline crypto_word_t value_barrier_w(crypto_word_t a) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:235:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: 235 | static inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:235:49: error: unknown type name 'crypto_word_t'
warning: [email protected]: 235 | static inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:240:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: 240 | static inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:240:53: error: unknown type name 'crypto_word_t'
warning: [email protected]: 240 | static inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:255:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: 255 | static inline crypto_word_t constant_time_is_nonzero_w(crypto_word_t a) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:255:56: error: unknown type name 'crypto_word_t'
warning: [email protected]: 255 | static inline crypto_word_t constant_time_is_nonzero_w(crypto_word_t a) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:260:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: 260 | static inline crypto_word_t constant_time_eq_w(crypto_word_t a,
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:260:48: error: unknown type name 'crypto_word_t'
warning: [email protected]: 260 | static inline crypto_word_t constant_time_eq_w(crypto_word_t a,
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:261:48: error: unknown type name 'crypto_word_t'
warning: [email protected]: 261 | crypto_word_t b) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:268:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: 268 | static inline crypto_word_t constant_time_select_w(crypto_word_t mask,
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:268:52: error: unknown type name 'crypto_word_t'
warning: [email protected]: 268 | static inline crypto_word_t constant_time_select_w(crypto_word_t mask,
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:269:52: error: unknown type name 'crypto_word_t'
warning: [email protected]: 269 | crypto_word_t a,
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:270:52: error: unknown type name 'crypto_word_t'
warning: [email protected]: 270 | crypto_word_t b) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:282:46: error: unknown type name 'crypto_word_t'
warning: [email protected]: 282 | static inline uint8_t constant_time_select_8(crypto_word_t mask, uint8_t a,
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:299:59: error: unknown type name 'crypto_word_t'
warning: [email protected]: 299 | const crypto_word_t mask) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h: In function 'constant_time_conditional_memcpy':
warning: [email protected]: crypto/curve25519/../internal.h:304:14: warning: implicit declaration of function 'constant_time_select_8' [-Wimplicit-function-declaration]
warning: [email protected]: 304 | out[i] = constant_time_select_8(mask, in[i], out[i]);
warning: [email protected]: | ^~~~~~~~~~~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:304:14: warning: nested extern declaration of 'constant_time_select_8' [-Wnested-externs]
warning: [email protected]: crypto/curve25519/../internal.h: At top level:
warning: [email protected]: crypto/curve25519/../internal.h:313:59: error: unknown type name 'crypto_word_t'
warning: [email protected]: 313 | const crypto_word_t mask) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h: In function 'constant_time_conditional_memxor':
warning: [email protected]: crypto/curve25519/../internal.h:318:15: warning: implicit declaration of function 'value_barrier_w' [-Wimplicit-function-declaration]
warning: [email protected]: 318 | out[i] ^= value_barrier_w(mask) & in[i];
warning: [email protected]: | ^~~~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:318:15: warning: nested extern declaration of 'value_barrier_w' [-Wnested-externs]
warning: [email protected]: crypto/curve25519/../internal.h: At top level:
warning: [email protected]: crypto/curve25519/../internal.h:350:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: 350 | static inline crypto_word_t constant_time_declassify_w(crypto_word_t v) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/../internal.h:350:56: error: unknown type name 'crypto_word_t'
warning: [email protected]: 350 | static inline crypto_word_t constant_time_declassify_w(crypto_word_t v) {
warning: [email protected]: | ^~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/curve25519.c: In function 'x25519_ge_scalarmult_small_precomp':
warning: [email protected]: crypto/curve25519/curve25519.c:724:35: warning: implicit declaration of function 'constant_time_eq_w' [-Wimplicit-function-declaration]
warning: [email protected]: 724 | cmov(&e, &multiples[j-1], 1&constant_time_eq_w(index, j));
warning: [email protected]: | ^~~~~~~~~~~~~~~~~~
warning: [email protected]: crypto/curve25519/curve25519.c:724:35: warning: nested extern declaration of 'constant_time_eq_w' [-Wnested-externs]
error: failed to run custom build command for `ring v0.17.5`
Caused by:
process didn't exit successfully: `/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/release/build/ring-e475624193d1286e/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_5_
OPT_LEVEL = Some("s")
TARGET = Some("riscv32imac-esp-espidf")
HOST = Some("x86_64-unknown-linux-gnu")
cargo:rerun-if-env-changed=CC_riscv32imac-esp-espidf
CC_riscv32imac-esp-espidf = None
cargo:rerun-if-env-changed=CC_riscv32imac_esp_espidf
CC_riscv32imac_esp_espidf = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = Some("/opt/riscv/bin/riscv64-unknown-elf-gcc")
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("a,c,m")
cargo:rerun-if-env-changed=CFLAGS_riscv32imac-esp-espidf
CFLAGS_riscv32imac-esp-espidf = None
cargo:rerun-if-env-changed=CFLAGS_riscv32imac_esp_espidf
CFLAGS_riscv32imac_esp_espidf = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: "/opt/riscv/bin/riscv64-unknown-elf-gcc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=rv32imac" "-mabi=ilp32" "-mcmodel=medany" "-I" "include" "-I" "/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/riscv32imac-esp-espidf/release/build/ring-5511d174fa612989/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-g3" "-DNDEBUG" "-o" "/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/riscv32imac-esp-espidf/release/build/ring-5511d174fa612989/out/crypto/curve25519/curve25519.o" "-c" "crypto/curve25519/curve25519.c"
cargo:warning=In file included from include/ring-core/base.h:74,
cargo:warning= from include/ring-core/mem.h:60,
cargo:warning= from crypto/curve25519/curve25519.c:22:
cargo:warning=include/ring-core/target.h:63:2: error: #error "Unknown target CPU"
cargo:warning= 63 | #error "Unknown target CPU"
cargo:warning= | ^~~~~
cargo:warning=In file included from crypto/curve25519/internal.h:20,
cargo:warning= from crypto/curve25519/curve25519.c:24:
cargo:warning=crypto/curve25519/../internal.h:210:2: error: #error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
cargo:warning= 210 | #error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
cargo:warning= | ^~~~~
cargo:warning=crypto/curve25519/../internal.h:223:15: error: unknown type name 'crypto_word_t'
cargo:warning= 223 | static inline crypto_word_t value_barrier_w(crypto_word_t a) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:223:45: error: unknown type name 'crypto_word_t'
cargo:warning= 223 | static inline crypto_word_t value_barrier_w(crypto_word_t a) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:235:15: error: unknown type name 'crypto_word_t'
cargo:warning= 235 | static inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:235:49: error: unknown type name 'crypto_word_t'
cargo:warning= 235 | static inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:240:15: error: unknown type name 'crypto_word_t'
cargo:warning= 240 | static inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:240:53: error: unknown type name 'crypto_word_t'
cargo:warning= 240 | static inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:255:15: error: unknown type name 'crypto_word_t'
cargo:warning= 255 | static inline crypto_word_t constant_time_is_nonzero_w(crypto_word_t a) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:255:56: error: unknown type name 'crypto_word_t'
cargo:warning= 255 | static inline crypto_word_t constant_time_is_nonzero_w(crypto_word_t a) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:260:15: error: unknown type name 'crypto_word_t'
cargo:warning= 260 | static inline crypto_word_t constant_time_eq_w(crypto_word_t a,
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:260:48: error: unknown type name 'crypto_word_t'
cargo:warning= 260 | static inline crypto_word_t constant_time_eq_w(crypto_word_t a,
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:261:48: error: unknown type name 'crypto_word_t'
cargo:warning= 261 | crypto_word_t b) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:268:15: error: unknown type name 'crypto_word_t'
cargo:warning= 268 | static inline crypto_word_t constant_time_select_w(crypto_word_t mask,
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:268:52: error: unknown type name 'crypto_word_t'
cargo:warning= 268 | static inline crypto_word_t constant_time_select_w(crypto_word_t mask,
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:269:52: error: unknown type name 'crypto_word_t'
cargo:warning= 269 | crypto_word_t a,
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:270:52: error: unknown type name 'crypto_word_t'
cargo:warning= 270 | crypto_word_t b) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:282:46: error: unknown type name 'crypto_word_t'
cargo:warning= 282 | static inline uint8_t constant_time_select_8(crypto_word_t mask, uint8_t a,
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:299:59: error: unknown type name 'crypto_word_t'
cargo:warning= 299 | const crypto_word_t mask) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h: In function 'constant_time_conditional_memcpy':
cargo:warning=crypto/curve25519/../internal.h:304:14: warning: implicit declaration of function 'constant_time_select_8' [-Wimplicit-function-declaration]
cargo:warning= 304 | out[i] = constant_time_select_8(mask, in[i], out[i]);
cargo:warning= | ^~~~~~~~~~~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:304:14: warning: nested extern declaration of 'constant_time_select_8' [-Wnested-externs]
cargo:warning=crypto/curve25519/../internal.h: At top level:
cargo:warning=crypto/curve25519/../internal.h:313:59: error: unknown type name 'crypto_word_t'
cargo:warning= 313 | const crypto_word_t mask) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h: In function 'constant_time_conditional_memxor':
cargo:warning=crypto/curve25519/../internal.h:318:15: warning: implicit declaration of function 'value_barrier_w' [-Wimplicit-function-declaration]
cargo:warning= 318 | out[i] ^= value_barrier_w(mask) & in[i];
cargo:warning= | ^~~~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:318:15: warning: nested extern declaration of 'value_barrier_w' [-Wnested-externs]
cargo:warning=crypto/curve25519/../internal.h: At top level:
cargo:warning=crypto/curve25519/../internal.h:350:15: error: unknown type name 'crypto_word_t'
cargo:warning= 350 | static inline crypto_word_t constant_time_declassify_w(crypto_word_t v) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/../internal.h:350:56: error: unknown type name 'crypto_word_t'
cargo:warning= 350 | static inline crypto_word_t constant_time_declassify_w(crypto_word_t v) {
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=crypto/curve25519/curve25519.c: In function 'x25519_ge_scalarmult_small_precomp':
cargo:warning=crypto/curve25519/curve25519.c:724:35: warning: implicit declaration of function 'constant_time_eq_w' [-Wimplicit-function-declaration]
cargo:warning= 724 | cmov(&e, &multiples[j-1], 1&constant_time_eq_w(index, j));
cargo:warning= | ^~~~~~~~~~~~~~~~~~
cargo:warning=crypto/curve25519/curve25519.c:724:35: warning: nested extern declaration of 'constant_time_eq_w' [-Wnested-externs]
exit status: 1
--- stderr
error occurred: Command "/opt/riscv/bin/riscv64-unknown-elf-gcc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=rv32imac" "-mabi=ilp32" "-mcmodel=medany" "-I" "include" "-I" "/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/riscv32imac-esp-espidf/release/build/ring-5511d174fa612989/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-g3" "-DNDEBUG" "-o" "/home/silveira/bluefreedom/microcontroller/std/prototype-app/target/riscv32imac-esp-espidf/release/build/ring-5511d174fa612989/out/crypto/curve25519/curve25519.o" "-c" "crypto/curve25519/curve25519.c" with args "riscv64-unknown-elf-gcc" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
Hi, @briansmith
Is there any solution for this issue ?
Does Ring support our "riscv32imac-esp-espidf" target ? I have looked in the CI and did not find our target there.
Happy new year, cheers.
For me it fails due to riscv32-esp-elf-gcc not being supported - same error message.
Issue #1943 is related to this. PR #1944 is taking a step toward getting this working.
Usually I use Ubuntu, and also ring's CI normally runs on UBuntu. It would accelerate the process of supporting this target if somebody could document how to install the toolchain for this target on Ubuntu so that I can test that the build succeeds,
Pointers to other projects that support this target that have GitHub Actions working would also be appreciated.
It would be even better if somebody could submit a PR that modifies mk/{install-build-tools.sh,cargo.sh} and .github/workflows/ci.yml to add this target to CI, at least so that cargo.sh test --norun works.