Hello,
I'm using [Yocto 2.6.1](
https://www.yoctoproject.org/)
with
[meta-raspberrypi](
http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi)
layer to build the image for RaspberryPi Zero.
The gcc is `8.2.0` and the `node` is `8.12.0`.
The `grpc-node` is a dependency for a Node package I'm building. However, I'm now focused
on getting the `grpc-node` to work. It is the only package which contains native
code to be compiled. The precompiled version is for `armv7` as explained here:
https://github.com/googleapis/nodejs-speech/issues/12I'm well aware of the issue with `node-pre-gyp` mentioned there:
https://github.com/mapbox/node-pre-gyp/issues/348However, I think that it might not be the problem in my case since I'm building
my own toolchain, specifically tweaked for the target (RPI 0) architecture.
In fact, I'm already getting the `armv6` binary crosscompiled:
```
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "6"
Tag_CPU_arch: v6
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_FP_arch: VFPv2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
```
While the `arm` precompiled binary from the npm registry looks like:
```
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv3-D16
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
```
The runtime error I'm getting right now (`Illegall instruction` error is gone)
is:
```
root@raspberrypi0-wifi:~# node
> require('/usr/lib/node/firebase/node_modules/grpc')
Error: /usr/lib/node/firebase/node_modules/grpc/src/node/extension_binary/node-v57-linux-arm-glibc/grpc_node.node: undefined symbol: CRYPTO_set_locking_callback
at Object.Module._extensions..node (module.js:682:18)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
```
However, both pre-compiled (for `armv7`) and the cross-compiled (for `armv6`)
binaries seem to have this symbol undefined:
precompiled:
```
25: 00000000 0 NOTYPE GLOBAL DEFAULT UND CRYPTO_set_locking_callba
```
cross-compiled:
```
27: 00000000 0 NOTYPE GLOBAL DEFAULT UND CRYPTO_set_locking_callba
```
Do I need anything more than the `grpc_node.node` binary correctly compiled for
the target architecture?
Now I'm wondering what's the OpenSSL requirement of the `grpc`. Does it require
OpenSSL at compile time / at runtime?
I can see that there is an option for `BoringSSL` (I assume linked statically?)
or to use the `OpenSSL` dynamic library from the system - is that correct?
How one can choose which one to use? What would be the "default" setting for
the Node package on ARM Linux system, which depends on the `grpc-node` package?
As a side note, I faced some issues as descriebd in various GCC 8 issues like this one:
https://github.com/grpc/grpc/issues/18689 and silenced them down with gcc
flags: `"-Wno-class-memaccess -Wno-ignored-qualifiers -Wno-cast-function-type"`
to keep going.
Please note that I'm far from Node expert / dev. I work on various build
systems, mostly in embedded area. I'm willing to help in resolving the
cross-compilation issues. However, I would need to get some better understanding
of how the `grpc` is being built - especially it's requirements on the OpenSSL.
Thanks for any feedback