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

neon build --target #16

Closed
dherman opened this issue Mar 9, 2018 · 10 comments
Closed

neon build --target #16

dherman opened this issue Mar 9, 2018 · 10 comments

Comments

@dherman
Copy link
Contributor

dherman commented Mar 9, 2018

We need an RFC for cross-compilation flags. The design should try to mirror the UX of Cargo as much as possible.

@cgdusek
Copy link

cgdusek commented Sep 18, 2019

Has there been any progress made on cross-compilation or a manual workaround? Currently looking to build for iOS and Android toolchains from Linux.

@kjvalencik
Copy link
Member

The rust side of this is actually pretty easy and works today. Since neon-cli passes on environment variables, cargo will respect the TARGET variable.

Unfortunately, the complexity of cross compiling node-gyp is where this becomes problematic (required by neon-runtime). Due to that complexity, I believe that this is blocked by N-API support which will eliminate node-gyp.

There is no timeline for N-API.

neon-bindings/neon#202
neon-bindings/neon#440

@cgdusek
Copy link

cgdusek commented Sep 18, 2019

http://www.janeasystems.com/blog/support-native-modules-node-js-mobile-apps/ They have a modified node-gyp

@ShinySaana
Copy link

Hello,

What is the current status of this feature?
Does it exist any workaround as of today, and if not, is there anything we can do to help?

@kjvalencik
Copy link
Member

@ShinySaana It's not being worked on. The legacy backend requires node-gyp which does not easily handle cross compiling.

The good news is that the N-API backend does support cross compiling and only uses cargo to build.

Try npm init neon my-project to create a new N-API project.

@ShinySaana
Copy link

As my neon project already used N-API, it was a breeze to migrate to the new backend. I just tested it and it worked wonders. Thank you very much for saving me a lot of headaches !

@JRedOW
Copy link

JRedOW commented Aug 16, 2021

I'm a little confused between the information on the wiki and here. If I create a project today with npm init neon my-project, can I compile for windows, mac, etc. on linux and how?

@kjvalencik
Copy link
Member

@JRedOW Additional arguments to cargo can be passed after the npm command. npm run build -- --target ....

Cross compiling documentation for Rust applies equally to Neon. (At the end it's just a Rust shared library)

@JRedOW
Copy link

JRedOW commented Aug 16, 2021

@JRedOW Additional arguments to cargo can be passed after the npm command. npm run build -- --target ....

Cross compiling documentation for Rust applies equally to Neon. (At the end it's just a Rust shared library)

Thanks!

@bergundy
Copy link

@JRedOW if you're looking for an example of cross compilation from macs of a neon project you can check out the Temporal Node.js SDK:

https://github.com/temporalio/sdk-node/blob/main/docs/building.md
https://github.com/temporalio/sdk-node/blob/main/.github/workflows/ci.yml#L73

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

No branches or pull requests

6 participants