Stream: beginners

Topic: make roc test ignore errors?


view this post on Zulip Pei Yang Ching (Mar 29 2024 at 11:31):

is there a command that runs roc test, ignoring some errors, like roc run does?

view this post on Zulip Brendan Hansknecht (Mar 29 2024 at 18:54):

I don't think so. Though I know there was discussion about his before. I think we made a plan to add a flag, but would need to dig things up in #ideas, not sure if an issue got filed for it...

view this post on Zulip Pei Yang Ching (Apr 01 2024 at 17:23):

I'd like to add this feature myself (or at least try to) can you give me any pointers on where to start?

view this post on Zulip Anton (Apr 01 2024 at 17:46):

Hi @Pei Yang Ching,
Thanks for helping out!

I'd like to add this feature myself (or at least try to) can you give me any pointers on where to start?

The flag itself (e.g. --ignore-errors) should be added in crates/cli/src/lib.rs, I also recommend checking out how ignoring errors is handled by CMD_RUN in the same file. The cursor.sh editor can also assist you in finding stuff.

view this post on Zulip Pei Yang Ching (Apr 02 2024 at 22:06):

thanks for the pointers! I created a draft PR here: https://github.com/roc-lang/roc/pull/6623

but I couldn't build roc for some reason, neither cargo build nor nix build works, I'm using nix on MacOS (x86_64), someone knows something,
logs: https://pastebin.com/KR3t3ES0

It seems like it couldn't link against c++ stdlib and llvm libs for some reason?

view this post on Zulip Anton (Apr 03 2024 at 07:26):

I usually use nix develop followed by cargo build --release --bin roc, can you try that?

view this post on Zulip Pei Yang Ching (Apr 04 2024 at 21:44):

hey @Anton ! After a bit of digging around, this patch seems to have fixed the issue:

diff --git a/crates/cli/build.rs b/crates/cli/build.rs
index 5d171b71c..1adcd79a4 100644
--- a/crates/cli/build.rs
+++ b/crates/cli/build.rs
@@ -1,6 +1,6 @@
 fn main() {
     // workaround for issue https://github.com/NixOS/nixpkgs/issues/166205 . This println can be removed when this issue is fixed. Upgrading to LLVM 14 could also fix this iss
ue.
     // also see https://github.com/NixOS/nixpkgs/pull/181485
-    #[cfg(all(target_os = "macos", target_arch = "aarch64"))]
-    println!("cargo:rustc-link-lib=c++abi")
+    #[cfg(all(target_os = "macos"))]
+    println!("cargo:rustc-link-arg=-lc++abi")
 }

in short, it seems this build flag, which is currently used by MacOS ARM, is also needed for x86_64 MacOS. I'd make a PR, but would like to first run this through someone familiar with the MacOS+nix side, if there's anyone like that please do let me know, thanks again :)

view this post on Zulip Anton (Apr 05 2024 at 08:38):

Looks like this has recently been fixed. I'll try updating to the latest nix in the coming days to see if we can get rid of this workaround. I'll let you know when the update is merged :)

view this post on Zulip Anton (Apr 12 2024 at 10:17):

@Pei Yang Ching, PR#6631 was merged, I was able to remove the workaround in build.rs


Last updated: Jul 06 2025 at 12:14 UTC