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

Add node multi-arch/cross-compilation support #195

Merged

Conversation

dennisameling
Copy link
Contributor

@dennisameling dennisameling commented Feb 12, 2021

Needed for Apple Silicon/Windows arm64/Windows ia32

Ref signalapp/Signal-Desktop#3745 (comment)
Ref signalapp/Signal-Desktop#1636 (comment)
Ref signalapp/Signal-Desktop#4461

How to test:

npm_config_arch is only needed when you're cross-compiling from a x64 host, e.g. x64 to ia32.

Branch with generated binaries: https://github.com/dennisameling/libsignal-client-node/tree/cross-compilation-compat/build

export npm_config_arch=ia32
yarn install
yarn tsc

Tested on:

  • Windows ia32
  • Windows x64
  • Windows arm64
  • MacOS arm64 (Apple Silicon)
  • MacOS x64
  • Linux x64

@dennisameling dennisameling changed the title [WIP] Add multi-arch/cross-compilation support [WIP] Add node multi-arch/cross-compilation support Feb 12, 2021
@dennisameling dennisameling changed the title [WIP] Add node multi-arch/cross-compilation support Add node multi-arch/cross-compilation support Feb 12, 2021
@dennisameling dennisameling marked this pull request as ready for review February 12, 2021 12:48
Copy link
Contributor

@jrose-signal jrose-signal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This seems pretty straightforward to me.

node/index.ts Outdated Show resolved Hide resolved
print('ERROR: --node_arch is required')
return 1
if node_arch.startswith('..\\'):
node_arch = node_arch[3:]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jack-signal, do you remember what this ..\ check is for? It doesn't seem like any of these would come up in arguments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's certainly not supposed to. But it was showing up when invoked via gyp on Windows. I think the way gyp (or possibly Python) are parsing command line arguments on Windows is wrong, but fixing that was more than I wanted to deal with.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I also had it show up on Windows, very weird indeed... I think it's Python's parsing of command line arguments on Windows though, rather than Gyp, IIRC

.github/workflows/build_and_test.yml Outdated Show resolved Hide resolved
@dennisameling dennisameling force-pushed the add-cross-compilation-support branch from 6e2cfba to e20408c Compare February 13, 2021 00:25
package.json Outdated Show resolved Hide resolved
@dennisameling dennisameling force-pushed the add-cross-compilation-support branch from ed9cfa5 to 0042e0d Compare February 13, 2021 00:45
- name: Get Node version from .nvmrc
id: get-nvm-version
shell: bash
run: echo "::set-output name=node-version::$(cat .nvmrc)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because the Windows image doesn't have nvm installed

@dennisameling
Copy link
Contributor Author

Alright, this should be good to go now @jrose-signal. Thanks for the feedback! 🚀

@jrose-signal jrose-signal merged commit 65c6efd into signalapp:master Feb 13, 2021
@jrose-signal
Copy link
Contributor

Thanks for the contribution, and for working through all the follow-up!

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

Successfully merging this pull request may close these issues.

3 participants