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

Use cross-rs or some customized cargo wrapper to build loongarch64-unknown-linux-{gnu,musl} #1645

Open
Myriad-Dreamin opened this issue Dec 17, 2024 · 0 comments

Comments

@Myriad-Dreamin
Copy link

Myriad-Dreamin commented Dec 17, 2024

First, thanks for the awesome project. It does save me a lot of time to setup and release targets and the generated announcement looks beautiful. However, I had a hard time to build with cargo-dist, I put some feedback here.

Problem

My second problem is that cargo zigbuild cannot build loongarch64-unknown-linux-{gnu,musl} for me.

https://github.com/Myriad-Dreamin/tinymist/actions/runs/12358673816/job/34489778932

Here are the critical log lines (this is a known zigbuild issue):

          LLVM ERROR: Cannot select: 0x7f5af23f1f50: i64 = fp_to_fp16 0x7f5af2a07030
            0x7f5af2a07030: f32,ch = CopyFromReg 0x7f5af2c54540, Register:f32 %11
              0x7f5af2a09360: f32 = Register %11
          In function: __fixhfsi
error: could not compile `tinymist` (bin "tinymist") due to 1 previous error

My Temporary Solution

I then seeked solution to add my "custom build script", but I encountered some problems then:

First, I didn't find a way to replace the generated local-artifact action with my manually crafted one. Is there a right way to do that? I read documentation and cannot find the answer. Thus, I have to patch my owned cargo-dist to customize it.

Second, I added a quick-hacking build wrapper that wraps cross-rs. I edited cargo-dist/src/build/cargo.rs:

@@ -190,6 +190,10 @@ pub fn make_build_cargo_target_command(
+  Some(CargoBuildWrapper::Cross) => {
+     command = Cmd::new("cross", "build your app with Cross");
+      if auditable {
+          command.arg("auditable");
+      }
+      command.arg("build");
+  }
  Some(CargoBuildWrapper::ZigBuild) => {

But cargo-dist seems to fail to find bins in the metadata yielded by the cross-rs.(https://github.com/Myriad-Dreamin/tinymist/actions/runs/12360708661/job/34509288504).

Here is the critical log line:

  × failed to find bin tinymist for path+file:///home/runner/work/tinymist/tinymist/crates/tinymist#0.12.12
  help: did the above build fail?

I have no knowledge about whether cargo-dist or the cargo_metadata crate failed.

Last, not a problem but a small question about contributing cargo-dist. How can I develop and debug building from my owned branch. I faced complicated situation and GitHub action hide all useful information for me.

Proposed Improvement

Add support to use cross-rs or some customized "cargo wrapper". From a long-term view, we may gain more benefit if there is a customized point to use a different "cargo wrapper" by configuration. With this ,we can put some temporary hacking, instrumentation to debug cargo-dist in the wrapper script, and more.

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