Upon specifying -t node7-linux-armv7 as the only target on a MacOS host, pkg downloads the armv7 base binary, but then starts to (attempt to) build a macos-armv7 base binary from source. This is illogical and unnecessary. I stopped it after noticing what it was doing, so I don't know if it would subsequently attempt to make a win-armv7 binary as well.
Transcript of attempted build:
$ pkg . --targets node7-linux-armv7
> Fetching base Node.js binaries to: ~/.pkg-cache
fetched-v7.6.0-linux-armv7 [====================] 100%
fetched-v7.6.0-macos-armv7 [====================] 100%
> Error! 404 Not Found
https://github.com/zeit/pkg-fetch/releases/download/v1.9/uploaded-v1.9-node-v7.6.0-macos-armv7
> Asset 'v1.9/uploaded-v1.9-node-v7.6.0-macos-armv7' not found by direct link
> Not found in GitHub releases:
{"tag":"v1.9","name":"uploaded-v1.9-node-v7.6.0-macos-armv7"}
> Building base binary from source:
built-v7.6.0-macos-armv7
> Cloning Node.js repository from GitHub...
git [======== ] 40%^C
Update: it does not attempt to make a macos-armv7 target when running on an actual linux-armv7 host (i.e., a Raspberry Pi 3). So it's not using the default linux,macos,win targets, but apparently trying to build a host-native version as well as the specified target.
Update 2: Upon attempting a node6-macos-x64 build on the armv7 host, the same pattern followed where pkg attempted to build a host-native version of the target arch (in this case, node6-linux-x64) but crashed in the attempt:
$ pkg . -t node6-macos-x64
> Fetching base Node.js binaries to: ~/.pkg-cache
fetched-v6.10.0-macos-x64 [====================] 100%
fetched-v6.10.0-linux-x64 [====================] 100%
/home/pi/.pkg-cache/v1.9/fetched-v6.10.0-linux-x64: 1: /home/pi/.pkg-cache/v1.9/fetched-v6.10.0-linux-x64: cannot create $�x@��x@@%@@@@@�@@@@L�kL�k �k����(s� 0�k0��0��0@@DDP�td�O住住����Q�td/lib64/ld-linux-x86-64.so.2GNUGNU�N�ޞ:^�m�zw���3�m���A�3G
: Directory nonexistent
/home/pi/.pkg-cache/v1.9/fetched-v6.10.0-linux-x64: 1: /home/pi/.pkg-cache/v1.9/fetched-v6.10.0-linux-x64: ELF: not found
/home/pi/.pkg-cache/v1.9/fetched-v6.10.0-linux-x64: 4: /home/pi/.pkg-cache/v1.9/fetched-v6.10.0-linux-x64: Syntax error: ")" unexpected
> Error! Error: Not able to compile for 'x64' here
at Socket.<anonymous> (/home/pi/.npm/lib/node_modules/pkg/lib-es5/producer.js:43:25)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at onwriteError (_stream_writable.js:313:10)
at onwrite (_stream_writable.js:331:5)
at WritableState.onwrite (_stream_writable.js:89:5)
at fireErrorCallbacks (net.js:448:13)
at Socket._destroy (net.js:486:3)
at WriteWrap.afterWrite (net.js:769:10)
Same issue. Build host is Mac OS.
$ pkg --target node7-linux-armv7 --out-dir dist .
> Fetching base Node.js binaries to: ~/.pkg-cache
fetched-v7.6.0-macos-armv7 [====================] 100%
> Error! 404 Not Found
https://github.com/zeit/pkg-fetch/releases/download/v1.9/uploaded-v1.9-node-v7.6.0-macos-armv7
> Asset 'v1.9/uploaded-v1.9-node-v7.6.0-macos-armv7' not found by direct link
> Not found in GitHub releases:
{"tag":"v1.9","name":"uploaded-v1.9-node-v7.6.0-macos-armv7"}
> Building base binary from source:
built-v7.6.0-macos-armv7
> Cloning Node.js repository from GitHub...
git [====================] 100%
> Checking out v7.6.0
> Applying patches
> Compiling Node.js from sources...
make [ ] 0%
To explain a bit: at this time pkg can do cross-platform-compilation (build for Windows on Linux), but not cross-CPU-compilation (build for ARM on x64). pkg _does_ work for ARM, but needs to be run on ARM hardware (Raspberry Pi, etc.).
As of https://github.com/zeit/pkg-fetch/commit/67c4a7b0823497704351638eb4216fb553006757 pkg will now throw an error when attempting to do this.
Most helpful comment
To explain a bit: at this time
pkgcan do cross-platform-compilation (build for Windows on Linux), but not cross-CPU-compilation (build for ARM on x64).pkg_does_ work for ARM, but needs to be run on ARM hardware (Raspberry Pi, etc.).As of https://github.com/zeit/pkg-fetch/commit/67c4a7b0823497704351638eb4216fb553006757
pkgwill now throw an error when attempting to do this.