luizperes / simdjson_nodejs

Node.js bindings for the simdjson project: "Parsing gigabytes of JSON per second"
https://arxiv.org/abs/1902.08318
Apache License 2.0
549 stars 25 forks source link

Debian Stretch 9.11 Docker Build Fails #22

Closed NicoVogel closed 4 years ago

NicoVogel commented 4 years ago

I try to run npm i sindjson and get the following error. In the main project you advice to use the gcc-8 so i tried to install it (gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 is currently installed). The issue here is that I could not figure out how to get the experimental version to work. I am still new to linux...

node@1e2ecaefc3ce:/workspaces/node-ms/test/json$ npm i simdjson

> simdjson@0.2.1 install /workspaces/node-ms/test/json/node_modules/simdjson
> node-gyp rebuild

make: Entering directory '/workspaces/node-ms/test/json/node_modules/simdjson/build'
make: Warning: File 'simdjson.target.mk' has modification time 48042 s in the future
  CXX(target) Release/obj.target/simdjson-avx2/simdjson/main.o
In file included from ../simdjson/bindings.h:3:0,
                 from ../simdjson/main.cpp:3:
../simdjson/src/simdjson.h:36731:23: fatal error: string_view: No such file or directory
 #include <string_view>
                       ^
compilation terminated.
simdjson-avx2.target.mk:113: recipe for target 'Release/obj.target/simdjson-avx2/simdjson/main.o' failed
make: *** [Release/obj.target/simdjson-avx2/simdjson/main.o] Error 1
make: Leaving directory '/workspaces/node-ms/test/json/node_modules/simdjson/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.9.184-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /workspaces/node-ms/test/json/node_modules/simdjson
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm WARN json@1.0.0 No description
npm WARN json@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! simdjson@0.2.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the simdjson@0.2.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2020-02-04T00_38_19_085Z-debug.log

Here some more information about the system

cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

lsb_release -a

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.11 (stretch)
Release:        9.11
Codename:       stretch

uname -r

4.9.184-linuxkit

npm config list

; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.13.4 node/v12.14.1 linux x64"

; globalconfig /usr/local/etc/npmrc
prefix = "/usr/local/share/npm-global"

; node bin location = /usr/local/bin/node
; cwd = /workspaces/node-ms/test/json
; HOME = /home/node
; "npm config ls -l" to show all defaults.

Use the following steps to reproduce the error:

  1. install vs code
  2. install docker
  3. install vs code extension Remote - Containers
  4. open empty folder in vs code
  5. run vs code action Remote-Containers: Add Development Container Configuration Files...
  6. select Node 12 and Typescript
  7. add to the Dockerfile USER node and then ARG HOME=/home/node
  8. run vs code action Remote-Containers: Open Folder in Container...
  9. run in bash npm init
  10. run npm i simdjson
luizperes commented 4 years ago

Hi @NicoVogel,

As far as I can see in your logs, the problem seems to be in the string_view, which was included only in C++17 as I see here. I believe that it might exist a problem in my binding.gyp file where I do not include your environment properly.

I think I need a little more info. Can you post here the contents of your file /home/node/.npm/_logs/2020-02-04T00_38_19_085Z-debug.log?

luizperes commented 4 years ago

Hey @NicoVogel, I think I figured out your problem, the version of your gcc seems to be actually 6, not gcc-8, as per:

gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516

This topic here mentions that c++17 was only given support on gcc-7 onwards. If you did install gcc-8, then it is possible that your main CXX compiler is still pointing to version 6.

Hope that helps!

luizperes commented 4 years ago

I am closing this bug as there was no follow-up. Feel free to reopen it if you still have trouble with that @NicoVogel, thanks!