News for hackers. Stuff that matters.
Re:Single binary executable packages by fwsgonzo on Wednesday March 02, 2022 @11:47AM (#30529392)
Last time I tried to cross compile RISC-V with Rust it just didn't work at all. I even know how linkers work and tried my best with custom linker scripts and arguments, but the toolchain would not build a rv64gc. Perhaps they have fixed the issues now, though.

I would like to add that Zig is extremely cross-compilable. You can even use it to cross compile C/C++ projects.

And Nim is fairly easy to cross compile. Just output C or C++ and cross compile that. I don't know why people are saying that cross compiling C or C++ is so miserable. Yes, it's not always a one-liner, but that depends on the toolchain. For example, there is crosstool-ng. Also Linux distros tend to have cross compilers for many architectures right on the box these days.

Here is how to cross-compile to 64-bit RISC-V on my Ubuntu machine:

    sudo apt install gcc-10-riscv64-linux-gnu g++-10-riscv64-linux-gnu

Debugging RISC-V and a heap of other architectures:

    sudo apt install gdb-multiarch
Re:Single binary executable packages by pizza234 on Wednesday March 02, 2022 @12:05PM (#30529662)
> Last time I tried to cross compile RISC-V with Rust it just didn't work at all.

YMMV; my experience was actually the opposite, approximately an year ago. I was actually really surprised of being able to build na executable for RISC-V (that I then copied to a VM, and run) all by adding 4 lines to Cargo's config.toml.

Re:Single binary executable packages by isomel on Wednesday March 02, 2022 @12:19PM (#30529847)
Never done RISC-V, but for ARM, this is trivial, one just have to rustup the right target stdlib, and then pass --target to cargo and done. Well, at least that's that easy if what you try to compile don't have C dependencies. For C dependencies, there is cross <https://github.com/cross-rs/cross> which I had good experiences with.