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

libffi-sys fails to build on riscv64gc-unknown-linux-gnu #47

Closed
piggynl opened this issue Jan 15, 2022 · 2 comments · Fixed by #49
Closed

libffi-sys fails to build on riscv64gc-unknown-linux-gnu #47

piggynl opened this issue Jan 15, 2022 · 2 comments · Fixed by #49

Comments

@piggynl
Copy link
Contributor

piggynl commented Jan 15, 2022

Rust uses riscv64gc-unknown-linux-gnu while ./configure uses riscv64-unknown-linux-gnu. One solution is the patch below. Is there a better way to handle this?

diff --git a/libffi-sys-rs/build/not_msvc.rs b/libffi-sys-rs/build/not_msvc.rs
index e41e076..634b710 100644
--- a/libffi-sys-rs/build/not_msvc.rs
+++ b/libffi-sys-rs/build/not_msvc.rs
@@ -53,7 +53,11 @@ pub fn configure_libffi(prefix: PathBuf, build_dir: &Path) {
 
     let target = std::env::var("TARGET").unwrap();
     if target != std::env::var("HOST").unwrap() {
-        command.arg(format!("--host={}", target.to_string()));
+        if target == "riscv64gc-unknown-linux-gnu" {
+            command.arg("--host=riscv64-unknown-linux-gnu");
+        } else {
+            command.arg(format!("--host={}", target));
+        }
     }
 
     command.current_dir(&build_dir);
@yorickpeterse
Copy link
Collaborator

If these are indeed the exact same architectures (just using different names) I think a change like this plus a comment describing why should be fine.

@piggynl
Copy link
Contributor Author

piggynl commented Feb 1, 2022

Thanks! I will do it in a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants