Closed manixate closed 7 years ago
Hi @manixate,
Thanks for submitting this!
A few questions:
lib/binding/binding.node
?I will try to answer your questions as best as I can:
lib/binding/binding.node
. After the build is completed it will be pushed to the releases page of the specific tag that was built. You can go to my repo: https://github.com/manixate/node-bluetooth-hci-socket/releases/tag/0.5.2 to see what I am talking about. This step is done possible because of this node-pre-gyp-github.windows-build-tools
but that also downloads around 3 GB of files most of which is the Windows SDK. That is the reason I suggested to use the CI's to build the binaries beforehand.@manixate thanks!
Please remove lib/binding/binding.node
from this pull request, you can see it as a new added file.
Accidentally added that file. Now removed.
Hi @sandeepmistry, did you get any time to look into this?
@manixate thanks!
I'll make a 0.5.2 tag, can you review the release artifacts once the CI builds are done? Then I can publish to npm.
I've removed the badge from the read me for now, because the build status was only valid for tags.
@sandeepmistry it is working. See this: https://ci.appveyor.com/project/manixate/node-bluetooth-hci-socket/build/1.0.31 for Windows artifacts and this: https://travis-ci.org/manixate/node-bluetooth-hci-socket/builds/169988903 for Linux artifacts.
@manixate well those files are for your account right?
Please take a look at these ones: https://github.com/sandeepmistry/node-bluetooth-hci-socket/releases/tag/0.5.2
Also, if you run npm install
from GitHub master, does node-pre-gyp
try to pull the versions from Github Releases?
@sandeepmistry I tested on Linux and Windows and it works. It downloads the prebuilt binaries instead of building them. It does have to build node-usb
package though but that is only on Linux because it doesn't provide linux built binaries.
@manixate awesome, thanks for trying it out!
What do you think about taking a similar approach to node-usb
for Linux, and only providing pre-built binaries for Linux?
I think it's easier for them to get the build deps and in general they a bit more technical. Currently, the Travis CI only provides 64-bit builds, not 32-bit and ARM.
actually I've been working on building docker images for arm* architectures which can be (probably) reused for building noble for different archiectures: https://github.com/oroce/docker-alpine-armhf (it's in early stage but it is achievable).
Also we can try the hypriot's docker image.
@oroce cool, thanks for the heads up!
Would this be compatible with Travis CI?
@sandeepmistry All we need is docker, and since TravisCI does support docker it should work. The solution I posted above uses qemu to emulate certain architectures, which makes the process slow but we can build release for as many architectures and operating systems as needed.
@oroce great!
Do you have time to try this out and submit a PR?
I'll look into 32-bit Linux support, node-serialport supports this: https://github.com/EmergingTechnologyAdvisors/node-serialport/blob/master/.travis.yml
@sandeepmistry sure, I'm running some experiments with the docker stuff and I'm gonna come back with the results.
@oroce cool!
I've been testing out cross-compiling in the following branch: https://github.com/sandeepmistry/node-bluetooth-hci-socket/blob/pre-gyp-32-bit/.travis.yml
I'm not sure if the ARM version works yet, we need Travis CI to whitelist the g++-4.8-arm-linux-gnueabihf
package to test. Only Node.js 0.12 for ARM builds with the regular g++-arm-linux-gnueabihf
. Request to whitelist can be found here: https://github.com/travis-ci/apt-package-whitelist/issues/3464
quick update from me.
I'm able to run custom architecture on travisci (arm64 and armv7l): https://travis-ci.org/oroce/node-bluetooth-hci-socket-fork/builds/172748607#L328-L336
I'm gonna restructure the build script to be able to compile the source on those archs.
Wow, it was faster than I though it'll be, I managed to have arm build:
The code can be found here: https://github.com/sandeepmistry/node-bluetooth-hci-socket/compare/master...oroce:docker-arm-build (the number of commits and log are mess, it's really hard to test this:()
The process is pretty slow right now, but it works. It can be enhanced fortunately:
apt-get
My biggest concern right now is that node-pre-gyp
uses the architecture arm
, but I thought the goal is having multiple arm builds (for example rpi1 is armv6 while rpi2 is armhf). Unfortunately I'm not a pre-gyp
expert, @manixate don't you have experience with pre-gyp
and arm builds?
@oroce cool, thanks for sharing your progress!
@manixate looks like node-pre-gyp-github
now requires Node.js 4 or higher, so we'll have to disable pre-gyp for 0.12
Sorry I was pretty busy in my schedule so couldn't get into the thread.
@oroce I also don't know much about the internals of node-pre-gyp but from what I can see if the binary is compiled on the target arch it will build it. See this node-serialport. Apparently it is able to run on armv6
and armv7
without any different configuration, only the code needs to be compatible.
@sandeepmistry Where did you find that node-pre-gyp-github
requires node.js 4 or higher? From what I know, node-pre-gyp-github
is just required to publish the binaries to github releases tag so it should not be too much dependent on node.js version.
@manixate
Where did you find that node-pre-gyp-github requires node.js 4 or higher?
npm install -g node-gyp node-pre-gyp-github
C:\Users\appveyor\AppData\Roaming\npm\node-pre-gyp-github -> C:\Users\appveyor\AppData\Roaming\npm\node_modules\node-pre-gyp-github\bin\node-pre-gyp-github.js
npm : npm WARN engine request@2.78.0: wanted: {"node":">= 4"} (current: {"node":"0.12.16","npm":"2.15.1"})
At line:1 char:1
+ npm install -g node-gyp node-pre-gyp-github
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (npm WARN engine...npm":"2.15.1"}):String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
From what I know, node-pre-gyp-github is just required to publish the binaries to github releases tag so it should not be too much dependent on node.js version.
Any suggestions on how to move forward then?
@sandeepmistry I don't know why you are not able to install it, may be the warning is set to cause an error on your system. I used this docker image for npm to install it and it installed.
/ # npm --version
2.15.11
/ # node --version
v0.12.17
/ # npm install -g node-pre-gyp
npm WARN engine request@2.78.0: wanted: {"node":">= 4"} (current: {"node":"0.12.17","npm":"2.15.11"})
/usr/bin/node-pre-gyp -> /usr/lib/node_modules/node-pre-gyp/bin/node-pre-gyp
node-pre-gyp@0.6.31 /usr/lib/node_modules/node-pre-gyp
├── semver@5.3.0
├── mkdirp@0.5.1 (minimist@0.0.8)
├── nopt@3.0.6 (abbrev@1.0.9)
├── rc@1.1.6 (ini@1.3.4, strip-json-comments@1.0.4, deep-extend@0.4.1, minimist@1.2.0)
├── tar@2.2.1 (inherits@2.0.3, block-stream@0.0.9, fstream@1.0.10)
├── tar-pack@3.3.0 (uid-number@0.0.6, once@1.3.3, debug@2.2.0, fstream@1.0.10, readable-stream@2.1.5, fstream-ignore@1.0.5)
├── rimraf@2.5.4 (glob@7.1.1)
├── npmlog@4.0.0 (set-blocking@2.0.0, console-control-strings@1.1.0, are-we-there-yet@1.1.2, gauge@2.6.0)
└── request@2.78.0 (is-typedarray@1.0.0, aws-sign2@0.6.0, oauth-sign@0.8.2, forever-agent@0.6.1, tunnel-agent@0.4.3, caseless@0.11.0, stringstream@0.0.5, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, aws4@1.5.0, node-uuid@1.4.7, qs@6.3.0, combined-stream@1.0.5, tough-cookie@2.3.2, form-data@2.1.1, mime-types@2.1.12, hawk@3.1.3, http-signature@1.1.1, har-validator@2.0.6)
/ # node-pre-gyp --version
v0.6.31
/ # npm install -g node-pre-gyp-github
/usr/bin/node-pre-gyp-github -> /usr/lib/node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js
node-pre-gyp-github@1.3.1 /usr/lib/node_modules/node-pre-gyp-github
├── commander@2.9.0 (graceful-readlink@1.0.1)
└── github@0.2.4 (mime@1.3.4)
But after checking the code of https://github.com/request/request I found that it will indeed not working properly on node.js v0.12.x so I created a pull request for node-pre-gyp
to support older version of request
because node-pre-gyp
is still expecting their project to be compatible with node versions >=0.10.x. The pull request is here: https://github.com/mapbox/node-pre-gyp/pull/252
It makes it easier to install because of the hassle to download build tools for the platforms. Specially on Windows where node-gyp requires around 3GB of download of build tools.
To make it work you need to do the following:
Create personal access token for both CIs
Windows
Linux
If you need any help you can contact me