Homekit Lightswitch with hap-nodejs
-
I'm trying to control GPIO pins via homekit using hap-nodejs
I've installed node, however I cannot get through the installation of hap-nodejs dependancies due to the lack of "make". Would it be feasible to build these dependancies elsewhere and copy them over. Otherwise would it be possible to install 'make' on the omega 2?
This had been discussed previously here - https://community.onion.io/topic/178/using-omega-with-homekit-bridge-project/7
-
The general approach would be to cross-compile them and copy them over. This is a good candidate for creating an OpenWRT module and doing the cross-compile within there.
-
@Marc-Nicholas Can you elaborate further? I, too, have been stumped with how to do this. I haven't actually had to do any cross-compiling for node before, but do you mean that you'd have to do a cross compile for just the "node-gyp" and "hap-nodejs" modules?
I get that the target would be some sort of linux mips, but any kind of "getting started" guide for this stuff would be a great addition to the wiki.
-
I try this for hours. I don't know. I tried to use crosstool ng to compile evert native npm module for the onion but it is not working. We really need a getting started guid for this or someone who explain this to us how we can compile node native addons for the onion.
-
It is an old topic. Not sure if it will be helpful to Warren et al. Just wants to share my experience struggling with hap-nodejs with my omega2+. Obviously you need to setup the compilers on the omega2+. Please see the documentation on setting up a compiler for details. It turns out that 128M ram does not cut it either. So you also need to set up a swap file or a swap partition. Again, please check the documentation for how to do that. At last, Omega2's C compiler does not need the -lpthread. In fact, there is no libpthread provided. Just create a dummy libpthread.so, like using a C file as this:
static void __dummy()
{
}Say, you save it as dummy.c, and compile it as
gcc -c -fPIC -o dummy.o dummy.c
gcc -shared -fPIC -Wl,soname,libpthread.so -o libpthread.so dummy.o -lcthen move the created libpthread.so to /usr/lib.
Hopefully you will then have a working hap-nodejs.