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

Move to prebuild #665

Closed
recrsn opened this issue Oct 22, 2018 · 6 comments · Fixed by #890
Closed

Move to prebuild #665

recrsn opened this issue Oct 22, 2018 · 6 comments · Fixed by #890

Comments

@recrsn
Copy link
Collaborator

recrsn commented Oct 22, 2018

node-pre-gyp has been causing a lot of installation errors. Move to prebuilt. This should fix most of the installation errors.

This task is high priority

@hroland
Copy link

hroland commented Feb 27, 2020

+1

@thom-nic
Copy link
Contributor

thom-nic commented Sep 3, 2021

I've created a branch that uses prebuildify. https://github.com/thom-nic/node.bcrypt.js/tree/prebuildify-and-docker-build

It builds locally on darwin-x64 and I can create prebuilds in a Docker container for linux-x64. I have Dockerfile definitions to cross-build for armhf and aarch64. Builds succeed on both of those environments however unit tests fail. I would love to get some eyes on the failing tests.

Basic prebuildify usage:

npm i -g prebuildify node-gyp
npm run build   # calls `prebuildify`

To start with Docker for cross-platform build, do this from my branch:

# Build everything and run unit tests:
docker build -t thom/bcryptjs-linux-x64-builder .   
# Create a container just so we can copy the artifacts from the container to host (for deployment)
docker create --name donut thom/bcryptjs-linux-x64-builder
docker cp donut:/usr/local/opt/bcrypt-js/prebuilds .

Then you'll see (on MacOS, have already built locally):

± ls -lF prebuilds
total 0
drwxr-xr-x  3 thom  staff  96 Sep  2 22:20 darwin-x64/
drwxr-xr-x  3 thom  staff  96 Sep  2 22:20 linux-x64/

To run the armhf build, it is similar but add -f to choose a different docker file:

docker build -t thom/bcryptjs-linux-aarch64-builder -f Dockerfile-aarch64 .

To not run the failing tests then start an interactive session for test/debugging, do:

docker build -t thom/bcryptjs-linux-aarch64-builder -f Dockerfile-aarch64 --build-arg=RUN_TESTS=false .
docker run -it --name donut-aarch64 thom/bcryptjs-linux-aarch64-builder /bin/bash -l

As a baseline I'm going to try running the unit tests on a native armhf device and see if unit tests pass or fail there.

The docker files were inspired by node-sqlite3 and I've adapted it for cross-platform builds with prebuildify in that project. Feedback welcome.

@recrsn
Copy link
Collaborator Author

recrsn commented Sep 4, 2021

Thanks a lot @thom-nic

@thom-nic
Copy link
Contributor

@recrsn would you like me to submit a PR? I made some tweaks so it is as merge-friendly as possible.

@recrsn
Copy link
Collaborator Author

recrsn commented Sep 13, 2021

@thom-nic Please submit a PR, I can check why the tests are failing

@JasonMan34
Copy link

@recrsn Any idea when v6 will be released?

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

Successfully merging a pull request may close this issue.

4 participants