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

[multi] Improve native package compilation and docs #1904

Merged
merged 5 commits into from Dec 18, 2018

Conversation

matheusd
Copy link
Member

Main goals for this commit are:

  • Enable compilation of required modules in non-standard architectures (in particular: raspberry pis)
  • Allow ignoring compilation of non-required modules (grpc-tools & win32ipc in !windows platforms)
  • Improve documentation for native module building

This is basically the result of trying to run the latest version on raspberry pis, while testing and maintaining compatibility to the other platforms.

With SPV suport in the wallet, it's now become possible (if not yet terribly practical) to run decrediton on the latest Raspberry PIs. The main challenge was getting the native modules to compile on the arm7l arch using electron runtime (while ensuring other platforms weren't broken in the process).

In the end, the following changes were required:

  • grpc-tools was moved from dependencies to optionalDepencies. It's pretty much hopelessly broken in electron@arm, so it's install is simply ignored. This package isn't terribly needed anyway, given that the only point of this is to install protoc, and any dev that needs to run protoc to update the grpc in decrediton is likely to have it installed in the system anyway. I'd even vote to drop it completely as a dependency.
  • Added a conditional definition in the win32ipc module such that on non-windows platforms, it will not use the source code files referencing <windows.h> and therefore won't fail to compile (in effect, generating an empty module).
  • Hard coded an update to nan@2.11.1. I had to do this manually, by deleting the lines in yarn.lock and forcing recreation of the lock file. No amount of juggling requirements, updating, removing and re-adding direct and transitive dependencies generated the correct version requirement. This is the important bit in allowing compilation of grpc in platforms other than {windows,linux,macOS}. The current lockfile specifies version 2.8.0 for nan, which is incompatible with newer versions of the grpc library.
  • Added the rebuild-natives script, to be called on non-standard platforms so that the native modules are rebuilt targeting electron. This is was an added difficulty for trying to run on PI, because the module would usually target the node runtime instead electron, also causing all sorts of problems. This script causes the native modules in the app dir (which is the package the actually requires grpc - trying to rebuild the modules from the root dir doesn't work) to be correctly rebuilt in the current platform.
  • Rewritten large parts of the readme to improve the instructions for setting up a dev environment and calling out various tricks and pitfalls in specific platforms.

Copy link
Member

@vctt94 vctt94 left a comment

Choose a reason for hiding this comment

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

Good job on this PR.

I did not test on a raspberry though, but it is great that we can build on them.

If grpc-tools is used only to install protoc, I also believe we can remove it as to made changes on proto file, you probably will need to do them in another project, as well.

@alexlyp
Copy link
Member

alexlyp commented Dec 18, 2018

Right so really the only reason I added grpc-tools was to have some consistency when rebuilding grpc bindings. I found that if it was left to the dev, the version would shift and cause huge amounts of change in the built files.

Copy link
Member

@alexlyp alexlyp left a comment

Choose a reason for hiding this comment

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

Awesome work!

@alexlyp alexlyp merged commit f57b81f into decred:master Dec 18, 2018
@matheusd matheusd deleted the fix-pkgs-for-arm branch December 18, 2018 18:16
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

Successfully merging this pull request may close these issues.

None yet

3 participants