|
| 1 | +## BKMs |
| 2 | + |
| 3 | +* Oh my god somebody please help node-gyp build takes too long time it compiles almost all C++ files every time somebody please help me out... |
| 4 | + |
| 5 | + Use the below shell script to build (with extra benefits) |
| 6 | + |
| 7 | + ``` |
| 8 | + # Workaround of node-gyp build issue |
| 9 | + target=`ls build/*.mk` |
| 10 | + alter=`ls build/*.mk`".new" |
| 11 | + sed 's/widl\ FORCE_DO_CMD/widl/' -r $target > $alter |
| 12 | + cp -f $alter $target |
| 13 | + |
| 14 | + # Build current add-on |
| 15 | + node-gyp build |
| 16 | + |
| 17 | + # Lint tool -- Make your code great again by making lint happy again |
| 18 | + if [ $? -eq 0 ]; then |
| 19 | + # Save current dir |
| 20 | + saved=`pwd` |
| 21 | + |
| 22 | + cd ../../ && python tools/node_modules/widl-nan/tools/lint.py --base=master |
| 23 | + |
| 24 | + # Test: to do, or not to do |
| 25 | + if [ $# -gt 0 ] && [ $1 == "test" ]; then |
| 26 | + cd $saved && mocha |
| 27 | + else |
| 28 | + echo "Note: to run test, type '$0 test'" |
| 29 | + fi |
| 30 | + fi |
| 31 | + ``` |
| 32 | +
|
| 33 | +* How to debug node addon |
| 34 | +``` |
| 35 | +node-gyp rebuild --debug |
| 36 | +gdb --args `which node` sample.js |
| 37 | +// In gdb |
| 38 | +gdb> b main |
| 39 | +gdb> r |
| 40 | +gdb> b [SOME_FUNCTION_NAME/LINE_NUMBER] |
| 41 | +gdb> c |
| 42 | +gdb> l |
| 43 | +gdb> s/n |
| 44 | +``` |
| 45 | +
|
| 46 | +* How to debug mocha |
| 47 | +
|
| 48 | +``` |
| 49 | + >gdb --args `which node` `which mocha` |
| 50 | +``` |
| 51 | +
|
| 52 | +* ZR300 can't work on Ubuntu |
| 53 | + * Install udev rules |
| 54 | +``` |
| 55 | +sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/ |
| 56 | +sudo udevadm control --reload-rules |
| 57 | +sudo udevadm trigger |
| 58 | +``` |
| 59 | + * Above steps should be automatically executed if install librealsense via [PPA](https://code.launchpad.net/~halton-huo/+junk/librealsense). |
| 60 | +
|
| 61 | +* Can't connect to camera again if previous run crashed. |
| 62 | + * Current solution: disconnect and reconnect camera from/to your system. |
| 63 | +* Crash occurs when addon is running smoothly, and then can't connect to RealSense camera again in a restart |
| 64 | + * The solution: disconnect the camera and then reconnect |
| 65 | +
|
| 66 | +Error message of the 1st crash: |
| 67 | +``` |
| 68 | +terminate called after throwing an instance of 'std::runtime_error' |
| 69 | + what(): VIDIOC_DQBUF error 19, No such device |
| 70 | +Aborted (core dumped) |
| 71 | +``` |
| 72 | +
|
| 73 | +Error message of later failure to connect: |
| 74 | +
|
| 75 | +``` |
| 76 | +terminate called after throwing an instance of 'rs::error' |
| 77 | + what(): UVCIOC_CTRL_QUERY:UVC_SET_CUR error 5, Input/output error |
| 78 | +Aborted (core dumped) |
| 79 | +``` |
| 80 | + |
| 81 | +* If you use add-on directly and has forgotten to inherit from `Node.js` `EventEmitter`, you'll hit the following error (or the like) |
| 82 | +``` |
| 83 | +/usr/bin/nodejs[24777]: ../src/node.cc:1345:v8::Local<v8::Value> node::MakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*): Assertion `cb_v->IsFunction()' failed. |
| 84 | + 1: node::Abort() [node] |
| 85 | + 2: node::Assert(char const* const (*) [4]) [node] |
| 86 | + 3: node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, char const*, int, v8::Local<v8::Value>*) [node] |
| 87 | + 4: FutureMakeCallback::TimerCallback(unsigned long) [/home/yunfei/00_yunfei/github/node-realsense/src/object-recognition/build/Release/realsense_object_recognition.node] |
| 88 | + 5: WIDLNANTimer::TimerCallbackProc(uv_timer_s*) [/home/yunfei/00_yunfei/github/node-realsense/src/object-recognition/build/Release/realsense_object_recognition.node] |
| 89 | + 6: 0x13774f5 [node] |
| 90 | + 7: uv_run [node] |
| 91 | + 8: node::Start(int, char**) [node] |
| 92 | + 9: __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6] |
| 93 | +10: _start [node] |
| 94 | +Aborted (core dumped) |
| 95 | +``` |
| 96 | +Solution: to inherit from `EventEmitter` or to `require` the `Node.js` wrapper module |
| 97 | +
|
| 98 | +* `sudo snap login <your_email>` failed |
| 99 | +Edit your `http_proxy`, https_proxy` to /etc/environment, then `sudo service snapd restart` |
0 commit comments