nbind
nbind copied to clipboard
Nbind asm.js compilation error
Hello, I am trying to compile a C++ code to asm.js with Nbind, but no matter what I do I am getting the same error. I installed Emscripten and tested it, it works fine. However it is not working with nbind. I tried to compile the quick start example on nbind's website, I tried to compile my own code, and I tried to compile nbind-example-universal to asm.js, but I am always getting the same error. If you could help me to fix this issue, I would be grateful. Thank you in advance.
P.s: Nbind works properly when I want to compile something for Node.js.
Copying node_modules/nbind/src/pre.js to Release\obj\nbind\\pre.js
1 file(s) copied.
Copying node_modules/nbind/dist/em-api.js to Release\obj\nbind\\em-api.js
1 file(s) copied.
Copying node_modules/nbind/src/post.js to Release\obj\nbind\\post.js
1 file(s) copied.
hello.cc
common.cc
reflect.cc
Binding.cc
win_delay_load_hook.cc
..\node_modules\nbind\src\reflect.cc(6): error C2871: 'nbind': a namespace with this name does not exist [C:\Users\Kiva
nc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(6): error C2871: 'nbind': a namespace with this name does not exist [C:\Users\Kivan
c\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(8): error C2653: 'BaseSignature': is not a class or namespace name [C:\Users\Kivan
c\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(9): error C2653: 'nbind': is not a class or namespace name [C:\Users\Kivanc\Desktop
\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(12): error C2653: 'Status': is not a class or namespace name [C:\Users\Kivanc\Deskt
op\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(8): error C4430: missing type specifier - int assumed. Note: C++ does not support
default-int [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(14): error C2653: 'NBind': is not a class or namespace name [C:\Users\Kivanc\Deskto
p\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(8): error C2146: syntax error: missing ';' before identifier 'SignatureType' [C:\U
sers\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(14): error C2061: syntax error: identifier 'cbFunction' [C:\Users\Kivanc\Desktop\de
neme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(8): warning C4091: '': ignored on left of 'int' when no variable is declared [C:\U
sers\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(10): error C2065: 'NBindID': undeclared identifier [C:\Users\Kivanc\Desktop\deneme
\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(10): error C2146: syntax error: missing ')' before identifier 'classType' [C:\User
s\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(15): error C3861: 'getClassList': identifier not found [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(15): error C3861: '<begin>': identifier not found [C:\Users\Kivanc\Desktop\deneme\b
uild\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(10): error C2039: 'forward_list': is not a member of 'std' [C:\Users\Kivanc\Deskto
p\deneme\build\nbind.vcxproj]
predefined C++ types (compiler internal)(209): note: see declaration of 'std'
..\node_modules\nbind\src\common.cc(15): error C3312: no callable 'begin' function found for type 'unknown-type' [C:\Us
ers\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(10): error C2143: syntax error: missing ';' before '{' [C:\Users\Kivanc\Desktop\de
neme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(15): error C3861: '<end>': identifier not found [C:\Users\Kivanc\Desktop\deneme\bui
ld\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(10): error C2447: '{': missing function header (old-style formal list?) [C:\Users\
Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(15): error C3312: no callable 'end' function found for type 'unknown-type' [C:\User
s\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(47): error C2653: 'NBind': is not a class or namespace name [C:\Users\Kivanc\Deskt
op\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(16): error C2065: 'bindClass': undeclared identifier [C:\Users\Kivanc\Desktop\denem
e\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(48): error C2065: 'cbFunction': undeclared identifier [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(48): error C2065: 'outPrimitive': undeclared identifier [C:\Users\Kivanc\Desktop\d
eneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(18): error C2065: 'bindClass': undeclared identifier [C:\Users\Kivanc\Desktop\denem
e\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(49): error C2065: 'cbFunction': undeclared identifier [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(18): error C2227: left of '->getName' must point to class/struct/union/generic type
[C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(18): note: type is 'unknown-type'
..\node_modules\nbind\src\reflect.cc(49): error C2065: 'outType': undeclared identifier [C:\Users\Kivanc\Desktop\deneme
\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(18): error C3861: 'strcmp': identifier not found [C:\Users\Kivanc\Desktop\deneme\bu
ild\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(50): error C2065: 'cbFunction': undeclared identifier [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(19): error C2065: 'bindClass': undeclared identifier [C:\Users\Kivanc\Desktop\denem
e\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(50): error C2065: 'outClass': undeclared identifier [C:\Users\Kivanc\Desktop\denem
e\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(19): error C2227: left of '->setValueConstructorJS' must point to class/struct/unio
n/generic type [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(19): note: type is 'unknown-type'
..\node_modules\nbind\src\reflect.cc(51): error C2065: 'cbFunction': undeclared identifier [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(19): error C2065: 'func': undeclared identifier [C:\Users\Kivanc\Desktop\deneme\bui
ld\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(51): error C2065: 'outSuper': undeclared identifier [C:\Users\Kivanc\Desktop\denem
e\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(16): error C2044: illegal continue [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxp
roj]
..\node_modules\nbind\src\reflect.cc(52): error C2065: 'cbFunction': undeclared identifier [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(53): error C2065: 'outMethod': undeclared identifier [C:\Users\Kivanc\Desktop\dene
me\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(53): error C2182: 'reflect': illegal use of type 'void' [C:\Users\Kivanc\Desktop\d
eneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(53): error C2448: 'reflect': function-style initializer appears to be a function d
efinition [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(107): error C2653: 'NBind': is not a class or namespace name [C:\Users\Kivanc\Desk
top\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(67): error C2039: 'forward_list': is not a member of 'std' [C:\Users\Kivanc\Desktop
\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(107): error C4430: missing type specifier - int assumed. Note: C++ does not suppor
t default-int [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
predefined C++ types (compiler internal)(209): note: see declaration of 'std'
..\node_modules\nbind\src\reflect.cc(107): error C2146: syntax error: missing ';' before identifier 'queryType' [C:\Use
rs\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(67): error C2143: syntax error: missing ';' before '<' [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(110): error C2143: syntax error: missing ';' before '{' [C:\Users\Kivanc\Desktop\d
eneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(67): error C4430: missing type specifier - int assumed. Note: C++ does not support
default-int [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\reflect.cc(110): error C2447: '{': missing function header (old-style formal list?) [C:\Users
\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(67): error C2653: 'nbind': is not a class or namespace name [C:\Users\Kivanc\Deskto
p\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(67): error C2143: syntax error: missing ';' before '{' [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(67): error C2447: '{': missing function header (old-style formal list?) [C:\Users\K
ivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(74): error C2039: 'forward_list': is not a member of 'std' [C:\Users\Kivanc\Desktop
\deneme\build\nbind.vcxproj]
predefined C++ types (compiler internal)(209): note: see declaration of 'std'
..\node_modules\nbind\src\common.cc(74): error C2143: syntax error: missing ';' before '<' [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(74): error C4430: missing type specifier - int assumed. Note: C++ does not support
default-int [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(74): error C2086: 'int forward_list': redefinition [C:\Users\Kivanc\Desktop\deneme\
build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(67): note: see declaration of 'forward_list'
..\node_modules\nbind\src\common.cc(74): error C2653: 'nbind': is not a class or namespace name [C:\Users\Kivanc\Deskto
p\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(74): error C2143: syntax error: missing ';' before '{' [C:\Users\Kivanc\Desktop\den
eme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(74): error C2447: '{': missing function header (old-style formal list?) [C:\Users\K
ivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(81): error C2653: 'nbind': is not a class or namespace name [C:\Users\Kivanc\Deskto
p\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(97): error C2653: 'nbind': is not a class or namespace name [C:\Users\Kivanc\Deskto
p\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(99): error C2065: 'Typer': undeclared identifier [C:\Users\Kivanc\Desktop\deneme\bu
ild\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(99): error C2062: type 'void' unexpected [C:\Users\Kivanc\Desktop\deneme\build\nbin
d.vcxproj]
..\node_modules\nbind\src\common.cc(99): error C2039: 'makeID': is not a member of '`global namespace'' [C:\Users\Kivan
c\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(100): error C2039: 'makeID': is not a member of '`global namespace'' [C:\Users\Kiva
nc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(101): error C2039: 'string': is not a member of 'std' [C:\Users\Kivanc\Desktop\dene
me\build\nbind.vcxproj]
predefined C++ types (compiler internal)(209): note: see declaration of 'std'
..\node_modules\nbind\src\common.cc(101): error C2039: 'makeID': is not a member of '`global namespace'' [C:\Users\Kiva
nc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(103): error C2039: 'makeID': is not a member of '`global namespace'' [C:\Users\Kiva
nc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(104): error C2039: 'makeID': is not a member of '`global namespace'' [C:\Users\Kiva
nc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(105): error C2039: 'makeID': is not a member of '`global namespace'' [C:\Users\Kiva
nc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(106): error C2039: 'makeID': is not a member of '`global namespace'' [C:\Users\Kiva
nc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(108): error C2143: syntax error: missing ';' before '}' [C:\Users\Kivanc\Desktop\de
neme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(110): error C2059: syntax error: 'return' [C:\Users\Kivanc\Desktop\deneme\build\nbi
nd.vcxproj]
..\node_modules\nbind\src\common.cc(111): error C2059: syntax error: '}' [C:\Users\Kivanc\Desktop\deneme\build\nbind.vc
xproj]
..\node_modules\nbind\src\common.cc(111): error C2143: syntax error: missing ';' before '}' [C:\Users\Kivanc\Desktop\de
neme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(113): error C2653: 'nbind': is not a class or namespace name [C:\Users\Kivanc\Deskt
op\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(113): error C2143: syntax error: missing ';' before '{' [C:\Users\Kivanc\Desktop\de
neme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(113): error C2447: '{': missing function header (old-style formal list?) [C:\Users\
Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(117): error C2653: 'nbind': is not a class or namespace name [C:\Users\Kivanc\Deskt
op\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(119): error C2061: syntax error: identifier 'funcPtr' [C:\Users\Kivanc\Desktop\dene
me\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(124): error C3861: 'getFunctionList': identifier not found [C:\Users\Kivanc\Desktop
\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(124): error C2228: left of '.emplace_front' must have class/struct/union [C:\Users\
Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(124): note: type is 'unknown-type'
..\node_modules\nbind\src\common.cc(124): error C2065: 'ptr': undeclared identifier [C:\Users\Kivanc\Desktop\deneme\bui
ld\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(124): error C2065: 'num': undeclared identifier [C:\Users\Kivanc\Desktop\deneme\bui
ld\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(124): error C2065: 'signature': undeclared identifier [C:\Users\Kivanc\Desktop\dene
me\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(124): error C2065: 'flags': undeclared identifier [C:\Users\Kivanc\Desktop\deneme\b
uild\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(129): error C2065: 'Int64': undeclared identifier [C:\Users\Kivanc\Desktop\deneme\b
uild\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(129): error C4430: missing type specifier - int assumed. Note: C++ does not support
default-int [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\node_modules\nbind\src\common.cc(129): error C2448: 'NBIND_CLASS': function-style initializer appears to be a functi
on definition [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\hello.cc(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\Users\Ki
vanc\Desktop\deneme\build\nbind.vcxproj]
..\hello.cc(17): error C2065: 'sayHello': undeclared identifier [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\hello.cc(17): error C3861: 'NBIND_METHOD': identifier not found [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\hello.cc(17): error C3861: 'NBIND_EXPAND': identifier not found [C:\Users\Kivanc\Desktop\deneme\build\nbind.vcxproj]
..\hello.cc(18): warning C4508: 'NBIND_CLASS': function should return a value; 'void' return type assumed [C:\Users\Kiv
anc\Desktop\deneme\build\nbind.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "build" "--asmjs=1"
gyp ERR! cwd C:\Users\Kivanc\Desktop\deneme
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "--" "node-gyp" "configure" "build" "--asmjs=1"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] node-gyp: `node-gyp "configure" "build" "--asmjs=1"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] node-gyp script 'node-gyp "configure" "build" "--asmjs=1"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the deneme package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp "configure" "build" "--asmjs=1"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs deneme
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls deneme
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Kivanc\Desktop\deneme\npm-debug.log```
[npm-debug.log.pdf](https://github.com/charto/nbind/files/1136092/npm-debug.log.pdf)
I've gotten the same error with node v8.11.2 and v10.5.0, so it doesn't appear to be due to some backwards compatibility issue with node v6.11.0.
I suspect that this is due to emscripten being required for asm.js compilation. Should maybe be mentioned in the quick-start section of README?
Anyway, I for one unfortunately can't test it because I actually don't need to compile to asm.js and installing emscripten is a nightmare (clashing Python versions - might just be my machine though).
I have emscripten working and am still dealing with this.
I am running into the exact same issue. I find it very suspicious that node-gyp is insisting on using MSBuild/vcxproj files on Windows, even though in this case we really want it to use make/emscripten.