Building Linux only feature on OSX IDE

I'm writing a tool that runs on Linux, but my development platform of choice at the moment is OSX. Normally this isn't a problem as the two are close enough that most things just work. However, this tool needs to make a Linux specific syscall that is gated on operating system. So if I open it in an IDE on OSX, I get the expected "not found" error - but it works fine on Linux as you'd expected.

I'm currently using Emacs with the Rust LSP plugin (works really well). Is it possible to configure it so that it assumes a different operating system than the one its running on? I've cross compiled for Linux just fine, but I'm not sure where to start with LSP :slight_smile:

You can set the rust-analyzer.cargo.target config to the target for which you are developing.

(Which would be the lsp-rust-analyzer-cargo-target setting in Emacs.)

Perfect, thanks!

The lsp-rust-analyzer-cargo-target setting helped me get on the right track. With Doom emacs I was able to configure it by adding:

(setq lsp-rust-analyzer-cargo-target "x86_64-unknown-linux-gnu")

at the end of ~/.doom.d/config.el

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.