Skip to content

Instantly share code, notes, and snippets.

@diorahman
Last active March 23, 2018 19:21
Show Gist options
  • Save diorahman/f745babe016df79bfcf8 to your computer and use it in GitHub Desktop.
Save diorahman/f745babe016df79bfcf8 to your computer and use it in GitHub Desktop.
Build and run rust-based node-addon (neon) on Linux

Neon on Linux

  • Install rust by executing this: $ curl -sSf https://static.rust-lang.org/rustup.sh | sh
  • Install node (v4.2.*), e.g. $ nvm install 4
  • Install neon: $ npm install -g neon-cli
  • Patch the templates/binding.gyp.hbs of the neon-cli using a patch from here: https://github.com/dherman/neon-cli/pull/6/commits
  • Take the advice to edit the ../<(static_lib) into <(PRODUCT_DIR)/../../<(static_lib)
  • Create a new neon project: $ neon new hello
  • $ cd hello
  • Edit the Cargo.toml deps to fetch the latest neon from git:
[dependencies]
neon = { git = 'https://github.com/dherman/neon.git' }
  • $ npm install
  • $ node -e 'require("./")'

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