ykjit / yk

yk packages
https://ykjit.github.io/yk/
Other
28 stars 7 forks source link

Minimally allow `cargo check` to work on non-Linux. #1251

Closed ltratt closed 1 month ago

ltratt commented 1 month ago

Although yk can only run on Linux at the moment, cargo check fails on non-Linux, which means that rust-analyzer fails. Having got sufficiently fed up with not having any LSP help, I finally got around to working out the minimal (hopefully) changes necessary for cargo check to succeed on OpenBSD (but cargo test doesn't work, and I'm not worried about that for now).

Most of these changes are probably good things full stop -- it makes clearer that hwt can only work on x86_64/Linux, for example. One annoying thing is that Cargo workspaces can't be conditionally compiled, so hwtracer must always be compilable. It's easy to make its lib.rs not compile anything useful, but harder for build.rs. To add insult to injury build::main must always be a top-level function. I've therefore resorted to a slightly evil "inner mod" trick for hwtracer/build.rs

Still, overall, these changes aren't too intrusive, and they will probably help us when eventually we want to get yk actually working on non-Linux.

ltratt commented 1 month ago

Hmm, running tryci produces this error:

     Running unittests src/bin/dump_ir.rs (target/debug/deps/dump_ir-f2d9f7d592830776)
/ci/target/debug/deps/dump_ir-f2d9f7d592830776: error while loading shared libraries: libLLVMCore.so.18git: cannot open shared object file: No such file or directory
error: test failed, to rerun pass `-p tests --bin dump_ir`

Any idea what might cause that? I don't really know what that test does TBH.

vext01 commented 1 month ago

That binary prints the embedded LLVM IR. Since we will be removing the LLVM backend, we could just remove it?

vext01 commented 1 month ago

I don't object to this, but how are we going to make sure it always "cargo check"s on OpenBSD? Are you OK with manually checking this periodically?

(I keep meaning to try out distant which I believe would allow you to run a nvim locally, but do all the building/analysing on a remote vim)

ltratt commented 1 month ago

I don't object to this, but how are we going to make sure it always "cargo check"s on OpenBSD? Are you OK with manually checking this periodically?

I am very fine with doing so! This is very much intended to be just a "best effort", rather than a "supported", thing right now.

That binary prints the embedded LLVM IR. Since we will be removing the LLVM backend, we could just remove it?

Should I also remove bin/ir_dump?

vext01 commented 1 month ago

Should I also remove bin/ir_dump

If it just wraps the binary, then yeah, go ahead.

ltratt commented 1 month ago

Solved this in a different way in https://github.com/ykjit/yk/pull/1251/commits/a14bd44f1fc0c1a001e8f9c0001b2995c78ee212.

vext01 commented 1 month ago

LGTM. Do you want to squash?

ltratt commented 1 month ago

Squashed.