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

Issue related to building in RISC-V #31

Open
Avimitin opened this issue Dec 11, 2021 · 0 comments
Open

Issue related to building in RISC-V #31

Avimitin opened this issue Dec 11, 2021 · 0 comments

Comments

@Avimitin
Copy link

I've encountered an error in building the ffmpeg-next crate. When running the build function, the env::var("CARGO_CFG_TARGET_ARCH").unwrap() function at line 214 in build.rs file return riscv64gc-unknown-linux-gnu which is a wrong RISC-V arch name. It should return riscv64-unknown-linux-gnu.

I try to fix this issue like below. But I found that I have to change multiple dependencies to build the final program. It will be easier to fix this bug in upstream.

--- B/build.rs	2021-12-11 15:28:22.479878768 +0800
+++ A/build.rs	2021-12-11 15:28:17.586545306 +0800
@@ -211,9 +211,13 @@
         let prefix = compiler[0..suffix_pos].trim_end_matches("-wr"); // "wr-c++" compiler
 
         configure.arg(format!("--cross-prefix={}-", prefix));
+        let arch_arg = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
         configure.arg(format!(
-            "--arch={}",
-            env::var("CARGO_CFG_TARGET_ARCH").unwrap()
+            "--arch={}", if arch_arg == "riscv64gc-unknown-linux-gnu" {
+                String::from("riscv64-unknown-linux-gnu")
+            } else {
+                arch_arg
+            }
         ));
         configure.arg(format!(
             "--target_os={}",
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

No branches or pull requests

1 participant