Closed onsails closed 1 year ago
I'll look into it. By the way, you don't need fenix
here at all :)
Figured out workaround:
env.RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [
openssl.dev
]) ++ (lib.optionals stdenv.isDarwin (with darwin.apple_sdk; [
"-L${libiconv}/lib"
"-L framework=${frameworks.Security}/Library/Frameworks"
]));
Also that's how devshell solves this.
Hey! Could you make a PR adding this to languages/rust.nix?
Hey! Sure, as soon as I figure out the most clean API design which lets user customize RUSTFLAGS predefined by the rust language module.
Can we reopen this? It breaks devenv buidls on darwin, see details at https://github.com/cachix/devenv/pull/283#discussion_r1070561727
Fixed!
I see problem with that solution, if RUSTFLAGS
environment variable is set, then Rust will ignore rustflags
defined in .cargo/config
file, which mean that for example Elixir projects that use Rustler will not compile, as it is required to set some additional flags there.
Is there a way to tell Rust to just prepend those?
AFAIK Rust will utilise regular LDFLAGS
when available, this is how it worked in "regular Nix shells" with Rust as I never had such problem with these.
Ok, it seems more complex, but for whatever reason when I use "plain" Nixpkgs shell instead of Devenv it works perfectly fine. I cannot find the reason why this fails in Devenv so while I really like this idea, I cannot use it right now.
Could you post the gist to reproduce this issue?
i see this issue when trying to install foundry
https://github.com/rainprotocol/binmaskflag
try this, devenv shell
for me gives errors about security framework on imac M1
Could you open a new issue - this one slipped my attention since it's closed.
@domenkozar the problem lies with not running the setup-hooks (thanks to my naked shell change :sob: ). Especially problematic is the lack of NIX_CFLAGS_COMPILE
env var. As this env var is used to pass down configurations to the Rust-underlying Clang (MacOS) / gcc (Linux) compiler.
It's a really hard problem though, as this means that we must run the setup-hooks if we want to get to feature parity with normal nix-shell. Will have to think about this.
Figured this out via:
devenv shell
nix-shell -p darwin.apple_sdk.frameworks.Security
env | sort > nix-shell.env
exit
env | sort > devenv.env
diff devenv.env nix-shell.env
Describe the bug When compiling some rust code which requires openssl or other Security-related dependencies compilation fails with
To Reproduce https://gist.github.com/onsails/d2d33a63d88a5e7d656048bd5fa5a6b9.
Version
0.5