Compiling native node addon with c++ 17 inside fails during npm install on ubuntu

Home / Uncategorized / Compiling native node addon with c++ 17 inside fails during npm install on ubuntu

Question:
I have native add-on for nodejs that uses c++17 features, specifically "shared_mutex". When I call npm install which downloads and compiles the add-on i get an error:
The linux machine has GCC 6.0 installed.

My Binding.gyp uses the following config to catch os type and add flags accordingly:’conditions’: [
[‘OS=="linux"’, {
‘CXXFLAGS’: [
‘-std=c++1z’
]}],

** i’ve also tried with ‘-std=c++17’, ‘-std=c++1z’.

What am I missing?

Update: 1. Updated ubuntu 16.04 to GCC 16.04 and made it default. 2. It seems that when i try to compile it manualy using node-gyp rebuild "CXXFLAGS=’-std=c++17’" it works and brings only one error: "shared_,utex in namespace std does not name a type std::shared_mutex file mutex" (the last error)


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *