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

Feature Req: Set the target directory #292

Closed
flukejones opened this issue Jan 11, 2018 · 6 comments
Closed

Feature Req: Set the target directory #292

flukejones opened this issue Jan 11, 2018 · 6 comments

Comments

@flukejones
Copy link

I was evaluating how I could use Neon to leverage Rust for use on AWS Lambdas and bumped up against a small issue.

The Lambdas require building against amazon Linux if you want to use native code due to the Amazon glibc being a different version to most Linux distros - as such I do all my compilation for them through a Docker image. This results in the final compiled libraries being located in target/x86_64-unknown-linux-gnu/<release/debug> though, and so the neon build (or npm install) fails since it can't find the library in target/release.

Is there a way to set the directory that neon build gets the compiled library from?

@muditsaurabh
Copy link

@flukejones
Copy link
Author

That is helpful, but not convenient at all for local development.

@kjvalencik
Copy link
Member

kjvalencik commented Mar 6, 2018

Would something like this work?

FROM lambci/lambda:build-nodejs6.10

RUN curl https://sh.rustup.rs -sSf | sh /dev/stdin -y

ENV PATH="$PATH:/root/.cargo/bin"
docker build -t lambda-neon-dev .

docker run --rm \
    -w /src \
    -v $(pwd):/src \
    -v $(pwd)/node_modules/.cargo/registry:/root/.cargo/registry \
  lambda-neon-dev npm install

I don't use lambda, but I do all of my development in docker and this pattern works well. You can substitute any preferered location for the shared cargo cache. It can even be removed, but keeping it improves build times.

@dherman
Copy link
Collaborator

dherman commented Mar 9, 2018

@Luke-Nukem Totally legit request! Right now we're just inferring the target info from the current machine, which means we don't support cross-compilation. I've filed an RFC issue here:

neon-bindings/rfcs#16

In the meantime can any of the suggestions above get you unstuck? If not we can try to prioritize getting the CLI options fleshed out and implemented.

@kjvalencik
Copy link
Member

Workaround is using .cargo/config to set target directory.

@kjvalencik
Copy link
Member

This was fixed in neon-cli, but is also not relevant for cargo-cp-artifact which reads metadata directly from cargo output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants