-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
secp256k1-sys
v0.10.1 fails to compile on thumbv7em-none-eabi
target
#766
Comments
I think this should be fixed by #663. |
Ah, no, this is different from #663. This is about string.h in lax_der_parsing. Interesting. This standards page says that a freestanding implementation must have stdint.h; possibly your compiler does not support C99. But string.h is not required and in theory even a confirming C99 compiler might not have it (but we use e.g. Possibly there is way to configure your compiler to provide paths to standard headers? For the things we're doing in this library you could maybe also define your own versions somewhere. |
This seems the same situation I mentioned in #585 for riscv targets. I still don't know what's the clean solution, but patching the diff --git a/secp256k1-sys/build.rs b/secp256k1-sys/build.rs
index 49d02e3..072ec71 100644
--- a/secp256k1-sys/build.rs
+++ b/secp256k1-sys/build.rs
@@ -12,13 +12,31 @@
extern crate cc;
use std::env;
+use std::process::Command;
fn main() {
+ let output = Command::new("riscv64-unknown-elf-gcc")
+ .arg("-print-sysroot")
+ .output()
+ .ok();
+ let sysroot = output
+ .as_ref()
+ .and_then(|o| std::str::from_utf8(&o.stdout).ok())
+ .unwrap_or("")
+ .trim();
+
+ let gcc_toolchain = if sysroot.is_empty() {
+ String::from("/usr/include/")
+ } else {
+ format!("{sysroot}/include")
+ };
+
// Actual build
let mut base_config = cc::Build::new();
base_config.include("depend/secp256k1/")
.include("depend/secp256k1/include")
.include("depend/secp256k1/src")
+ .include(gcc_toolchain)
.flag_if_supported("-Wno-unused-function") // some ecmult stuff is defined but not used upstream
.flag_if_supported("-Wno-unused-parameter") // patching out printf causes this warning
.define("SECP256K1_API", Some("")) |
That sounds like a bug either in the cc crate, or more realistically in your cc. Generally a C compiler should include its systole by default. Maybe try a different distro? |
Alternately I wonder if If not I wouldn't mind adding some extra env variables to our build.rs (e.g. |
When I try to compile a crate including
secp256k1
withcargo build --target thumbv7em-none-eabi
, I run into the error printed below.is it expected that this crate will fail to compile on this target? Perhaps you've encountered this issue before and, if so, perhaps you might have pointers on how to avoid it?
The text was updated successfully, but these errors were encountered: