Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with cross-compilation setup #1301

Open
clotodex opened this issue Jun 26, 2024 · 3 comments
Open

Help with cross-compilation setup #1301

clotodex opened this issue Jun 26, 2024 · 3 comments
Labels
question Further information is requested

Comments

@clotodex
Copy link
Contributor

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:

let
  pkgs-cross = pkgs.pkgsCross.aarch64-multiplatform;
in  ...

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?

@clotodex clotodex added the question Further information is requested label Jun 26, 2024
@clotodex
Copy link
Contributor Author

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

@clotodex
Copy link
Contributor Author

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.

@sandydoo
Copy link
Member

Same underlying issue as #1111.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants