Open clotodex opened 5 months ago
Okay this is REALLY weird
It seems to be something with how i execute cargo and nix getting confused.
If I execute the cargo command directly from the devenv folder with maniefest_path then everything works.
Example command:
cargo lambda build --manifest-path lambdas/rustproject/Cargo.toml --release --arm64 --no-default-features --features "static_ssl"
BUT, when executed through python with subprocess call - nothing works and I get cross compilation errors. This is part of a build process with aws-cdk - that is why python runs the call to build it
subprocess.check_call(cmd, shell=False, env=os.environ.copy())
Is the execution through node/python etc somehow changing the way it works?? I am super lost
Alright I found the culprit. When running aws-cdk there is randomly a new ENV variable.
LD_LIBRARY_PATH=/home/user/projects/repo/backend/cdk/.devenv/profile/lib:/nix/store/7v7c61ikm7cbd3kbimk9qr8h7pdmyccn-manylinux2014/lib:/nix/store/c2yb135iv4maadia5f760b3xhbh6jh61-gcc-13.2.0-lib/lib
I have no clue why or how - i checked the nix source for aws-cdk and found nothing. I checked their repo and found nothing. I have no clue why this variable gets added.
I will leave this open in the off-chance this has somthing to do with devenv. Feel free to close though, since my direct problem is resolved.
Same underlying issue as https://github.com/cachix/devenv/issues/1111.
I for the life of me cannot figure out how to set up cross compilation with rust. I have checked out https://github.com/cachix/devenv/blob/main/examples/rust-wasm-cross/devenv.nix but that just sets up wasm.
What I am doing is:
And my problem is that the rust compiler (or zig linker more specifically) cannot see any system libraries. So sqlite, ring and openssl-sys are unable to build. Outside of the nix env everything works (traditional setup) so I can guarantee that my rust setup etc works.
Do you have any pointers for me?