We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

SerialPort with node v8.10.0?



  • I'm trying to get the npm package serialport to work with the latest firmware, npm v5.6.0 and node v8.10.0, but to my knowledge there isn't any precompiled binaries for this version. I've tried building from source, but get this output where ld returns with an error /usr/bin/ld: cannot find -lpthread.

    BusyBox v1.28.3 () built-in shell (ash)
    
       ****____       _             ____
      / __ \___  (_)__  ___    / __ \__ _  ___ ___ ____ _
     / /_/ / _ \/ / _ \/ _ \  / /_/ /  ' \/ -_) _ `/ _ `/
     \____/_//_/_/\___/_//_/  \____/_/_/_/\__/\_, /\_,_/
     W H A T  W I L L  Y O U  I N V E N T ?  /___/
     -----------------------------------------------------****
       O-ware: 0.3.2 b218
     -----------------------------------------------------
    root@Omega-2F49:~# node --max_old_space_size=64 $(which npm) install serialport
    --unsafe-perm --build-from-source
    
    > @serialport/bindings@2.0.7 install /root/node_modules/@serialport/bindings
    > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
    
    make: Entering directory '/root/node_modules/@serialport/bindings/build'
      CXX(target) Release/obj.target/bindings/src/serialport.o
      CXX(target) Release/obj.target/bindings/src/serialport_unix.o
      CXX(target) Release/obj.target/bindings/src/poller.o
      CXX(target) Release/obj.target/bindings/src/serialport_linux.o
      SOLINK_MODULE(target) Release/obj.target/bindings.node
    /usr/bin/ld: cannot find -lpthread
    collect2: error: ld returned 1 exit status
    make: *** [bindings.target.mk:128: Release/obj.target/bindings.node] Error 1
    make: Leaving directory '/root/node_modules/@serialport/bindings/build'
    gyp ERR! build error
    gyp ERR! stack Error: `make` failed with exit code: 2
    gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_module                                                                                     s/node-gyp/lib/build.js:262:23)
    gyp ERR! stack     at emitTwo (events.js:126:13)
    gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces                                                                                     s.js:198:12)
    gyp ERR! System Linux 4.14.81
    gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gy                                                                                     p/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /root/node_modules/@serialport/bindings
    gyp ERR! node -v v8.10.0
    gyp ERR! node-gyp -v v3.8.0
    gyp ERR! not ok
    npm WARN enoent ENOENT: no such file or directory, open '/root/package.json'
    npm WARN root No description
    npm WARN root No repository field.
    npm WARN root No README data
    npm WARN root No license field.
    
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! @serialport/bindings@2.0.7 install: `prebuild-install --tag-prefix @ser                                                                                     ialport/bindings@ || node-gyp rebuild`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the @serialport/bindings@2.0.7 install script.
    npm ERR! This is probably not a problem with npm. There is likely additional log                                                                                     ging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /root/.npm/_logs/2019-03-19T08_25_29_634Z-debug.log
    

    If I try to

    opkg install libpthread
    

    I get

    Package libpthread (1.1.19-1) installed in root is up to date.
    

    I have the latest versions of make (4.2.1-2) and gcc version 5.4.0 (OpenWrt GCC 5.4.0) with threadmodel: posix

    Did anyone else have luck installing serialport or know how to do it, or do I have to bite the dust and use older firmware to get an older, working package?

    regards



  • I ran into this problem a couple of weeks ago and just now had time to dig into it a little more, I found a thread that provided this solution:

    run
    ar -rc /usr/lib/libpthread.a
    to create an archive file that is missing.

    Also, for serialport specifically it looks like someone has tackled that:

    https://community.onion.io/topic/1537/serial-ports-usb-and-nodejs-support



Looks like your connection to Community was lost, please wait while we try to reconnect.