tessel / t2-cli

Tessel 2 Command Line Interface
MIT License
114 stars 56 forks source link

Pre-compiled module is missing: uws@0.14.5. #1218

Open znzrIO opened 7 years ago

znzrIO commented 7 years ago

WARN Some assets in this project were not deployed (see: t2 run --help) WARN Pre-compiled module is missing: uws@0.14.5. WARN Please an file issue at https://github.com/tessel/t2-cli/issues/new with this warning. WARN WARN This warning might be caused by one of the following: WARN WARN 1. A pre-compiled binary has not yet been built for this module. WARN 2. The binary didn't compile correctly for the platform that you're developing on. WARN Binaries that are Linux-only or even OpenWRT-specific may cause this issue. WARN Try to npm install --force the affected module, then rerun your deployment command. WARN 3. The binary may be platform specific and impossible to compile for OpenWRT.

rwaldron commented 7 years ago

Looks like uws won't compile:

make: Entering directory '/root/build/package/build'
  CXX(target) Release/obj.target/uws/src/Extensions.o
  CXX(target) Release/obj.target/uws/src/Group.o
In file included from ../src/Hub.h:5:0,
                 from ../src/Group.cpp:2:
../src/Node.h: In member function 'uS::Socket* uS::Node::connect(const char*, int, bool, uS::NodeData*)':
../src/Node.h:96:35: error: 'to_string' is not a member of 'std'
         if (getaddrinfo(hostname, std::to_string(port).c_str(), &hints, &result) != 0) {
                                   ^
../src/Node.h: In member function 'bool uS::Node::listen(const char*, int, uS::TLS::Context, int, uS::NodeData*, void*)':
../src/Node.h:136:31: error: 'to_string' is not a member of 'std'
         if (getaddrinfo(host, std::to_string(port).c_str(), &hints, &result)) {
                               ^
In file included from ../src/Group.cpp:2:0:
../src/Hub.h: At global scope:
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::next_in' [-Wmissing-field-initializers]
     z_stream inflationStream = {};
                                 ^
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::avail_in' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::total_in' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::next_out' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::avail_out' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::total_out' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::msg' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::state' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::zalloc' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::zfree' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::opaque' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::data_type' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::adler' [-Wmissing-field-initializers]
../src/Hub.h:21:33: warning: missing initializer for member 'z_stream_s::reserved' [-Wmissing-field-initializers]
uws.target.mk:97: recipe for target 'Release/obj.target/uws/src/Group.o' failed
make: Leaving directory '/root/build/package/build'
make: *** [Release/obj.target/uws/src/Group.o] Error 1

I'll see what else I can learn and report back

rwaldron commented 7 years ago

Does anyone here have time to work through this issue with the module's authors?

HipsterBrown commented 7 years ago

From the module docs:

At installation uws will try to recompile itself using the system's C++11 compiler (GCC 4.8+, Clang 3.3, VC++ 2015+). If this fails it will silently fall back to using the precompiled binaries. NPM installation will never fail but require('uws') will throw if it cannot properly load the binary module.

Looking into this a bit more.

Edit:

Dependencies

First of all you need to install the required dependencies. This is very easily done with a good open source package manager like Homebrew for OS X, vcpkg for Windows or your native Linux package manager.

OpenSSL 1.x.x zlib 1.x libuv 1.3+ or Boost.Asio 1.x (both optional on Linux)

an-rahulpandey commented 7 years ago

I also got the same error today, when trying to run this program from here -

https://learn.sparkfun.com/tutorials/experiment-guide-for-the-johnny-five-inventors-kit/all#experiment-10-using-the-bme280

rahul@thinkubuntu:~/Desktop/github/tessel2/jfik$ t2 run monitor.js INFO Looking for your Tessel...
INFO Connected to InGen.
INFO Building project.
WARN Pre-compiled module is missing: uws@0.14.5.
WARN Please an file issue at https://github.com/tessel/t2-cli/issues/new with this warning.
WARN 
WARN This warning might be caused by one of the following:
WARN 
WARN 1. A pre-compiled binary has not yet been built for this module.
WARN 2. The binary didn't compile correctly for the platform that you're developing on.
WARN    Binaries that are Linux-only or even OpenWRT-specific may cause this issue.
WARN    Try to npm install --force the affected module, then rerun your deployment command.
WARN 3. The binary may be platform specific and impossible to compile for OpenWRT.
INFO Writing project to RAM on InGen (1613.312 kB)...
INFO Deployed.
INFO Running monitor.js...
1500623076921 Available Tessel 2 (InGen)  
/tmp/remote-script/node_modules/base64id/lib/base64id.js:1
(function (exports, require, module, __filename, __dirname) { var e=require("crypto"),t=()=>{};t.prototype.getRandomBytes=function(t){var s,r,n,a=this;return(t=t||12)>4096?e.randomBytes(t):(s=parseInt(4096/t),(r=parseInt(.85*s))?(null==this.bytesBufferIndex&&(this.bytesBufferIndex=-1),this.bytesBufferIndex==s&&(this.bytesBuffer=null,this.bytesBufferIndex=-1),(-1==this.bytesBufferIndex||this.bytesBufferIndex>r)&&(this.isGeneratingBytes||(this.isGeneratingBytes=!0,e.randomBytes(4096,(e,t)=>{a.bytesBuffer=t,a.bytesBufferIndex=0,a.isGeneratingBytes=!1})),-1==this.bytesBufferIndex)?e.randomBytes(t):(n=this.bytesBuffer.slice(t*this.bytesBufferIndex,t*(this.bytesBufferIndex+1)),this.bytesBufferIndex++,n)):e.randomBytes(t))},t.prototype.generateId=function(){var t=new Buffer(15);return t.writeInt32BE?(this.sequenceNumber=this.sequenceNumber+1|0,t.writeInt32BE(this.sequenceNumber,11),e.randomBytes?this.getRandomBytes(12).copy(t):[0,4,8].forEach(e=>{t.writeIn

TypeError: Cannot set property 'getRandomBytes' of undefined
    at Object.<anonymous> (/tmp/remote-script/node_modules/base64id/lib/base64id.js:1:122)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/tmp/remote-script/node_modules/engine.io/lib/server.js:1:1729)
    at Module._compile (module.js:570:32)
rwaldron commented 7 years ago

@an-rahulpandey ~There are several project variations on that page (all of which I wrote myself :D), can you clarify which one you were on that encountered this issue?~

Nevermind, I see now that uws is in engine.io's optionalDependencies, at version ~0.14.4, which means it will install the incompatible 0.14.5

rwaldron commented 7 years ago

We're updating the J5IK guides to instruct readers to use socket.io@1.4.8, which predates the uws dep and is actually the version we used to develop the examples. You'll also want to update t2-cli to t2-cli@0.1.9

vishnu888 commented 7 years ago

Is there a guide somewhere to precompiling modules which I can try by myself?

HipsterBrown commented 7 years ago

@vishnu888 We use t2-compiler to compile modules for Tessel -> https://github.com/tessel/t2-compiler

vishnu888 commented 7 years ago

I'm using the t2 compiler as well but it fails to compile some of the dependencies. Was wondering if there is a way to compile and bundle it manually rather than relying on t2.

rwaldron commented 7 years ago

fails to compile some of the dependencies

Can you elaborate on this? If a module has compiled add-on deps, then those need to be compiled separately.

t2-compiler isn't really useful for end users, as it's used to pre-compile binary modules and then they must be deployed to our module server. To use it locally, you'd need to untar the gzipped tarballs located in out/* and mv the resulting directory to ~/.tessel/binaries/

The contents of those looks like...

...But that process was never meant to be the burden of end developers. If there are specific binary modules that you need pre-compiled, please file a bug with both the module name and version and someone (likely me) will update our pre-compiled module host.

The other thing to remember is that the module may not compile for mips.

battuashwik commented 7 years ago

@rwaldron we basically have a MT7320A chip on one of our projects, we are planning to use tessel2-openwrt on that chip so that we can program the chip on node, we won't have the additional controller (SAMD21 coprocessor) that tessel uses. We will just use the wifi code and some additional websockets code to connect to cloud which are written in node. We might write additional C++ node addons for UART on MT7320A which we need to compile to work with tessel2.

Two questions: 1) For this kind of use case is it good to use tessel? 2) If yes then how do we port the c++ addons we write on node?

rwaldron commented 7 years ago
  1. For this kind of use case is it good to use tessel?

If you don't need any of GPIO, I2C, ADC, SPI or UART, then sure!

  1. If yes then how do we port the c++ addons we write on node?

That's a very broad question with many possible answers that potentially all depend on each other, or not at all. If you're writing node.js c++ addons, then write them the way you would write anything like that for node.js and publish them to npm. We will do our best to ensure the pre-compiled modules get built. Eventually that part will be automated.

vishnu888 commented 7 years ago

Thanks for the help.