I'm having this issue when trying to compile speak.js. In emscripten.sh when the compiler reaches this line:
$EMSCRIPTEN/emcc -O2 --js-transform "python bundle.py" speak.bc -o speak.raw.js
I get this error (previous parts work fine):
emscripten
fs.js:338
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'C:\tmp\tmp0Ak4ij.txt'
at Object.fs.openSync (fs.js:338:18)
at Object.fs.readFileSync (fs.js:182:15)
at read (C:\opt\emscripten\src\compiler.js:36:37)
at Object.<anonymous> (C:\opt\emscripten\src\compiler.js:120:29)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Traceback (most recent call last):
File "/opt/emscripten/emcc", line 871, in <module>
final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args)
File "/opt/emscripten/tools/shared.py", line 736, in emscripten
assert os.path.exists(filename + '.o.js') and len(open(filename + '.o.js', 'r').read()) > 0, 'Emscripten failed to generate .js: ' + str(compiler_output)
AssertionError: Emscripten failed to generate .js:
cat: speak.raw.js: No such file or directory
I'm running cygwin under windows 7; all emscripten sanity checks worked fine, and I tried changing emscripten /tmp config (.escripten in the home folder) to several values, granting permissions, etc. It seems that the temp file is never created, so when it tries to access it again, it breaks.
Any help/guidance/suggestion is welcome.
In case someone is interested , I'm posting an answer.
unfortunately, I couldn't find the underlying cause, but it doesn't work with cygwin under windows 7 x64.
I was able to compile, however, installing clang, llvm visual studio express ant the rest of the tools in this link
Using emscripten with VS 2010
and do the same thing that's in emscripten.sh with windows console. However it won´t compile with
emcc -O2 --js-transform "python bundle.py" speak.bc -o speak.raw.js
you have to remove the -02 option, and it works. I'm testing the different languages/phonemes and let you know how does it work
Related
I'm using NPM programmatically in a project which is compiled to binary in the end. Upon using npm.commands.install when running the binary file the following error is thrown:
[2018/09/08 19:55:59:0503] LOG: POST -> /processor/mutator/install
{ Error: Cannot find module 'node-gyp/bin/node-gyp'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
at Function.Module._resolveFilename (module.js:545:15)
at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1278:46)
at resolveFileName (/snapshot/chisel/node_modules/npm/node_modules/npm-lifecycle/node_modules/resolve-from/index.js:29:39)
at resolveFrom (/snapshot/chisel/node_modules/npm/node_modules/npm-lifecycle/node_modules/resolve-from/index.js:43:9)
at module.exports (/snapshot/chisel/node_modules/npm/node_modules/npm-lifecycle/node_modules/resolve-from/index.js:46:41)
at Object.<anonymous> (/snapshot/chisel/node_modules/npm/node_modules/npm-lifecycle/index.js:18:31)
at Module._compile (pkg/prelude/bootstrap.js:1252:22)
at Object.Module._extensions..js (module.js:661:10)
at Module.load (module.js:563:32)
at tryModuleLoad (module.js:503:12)
at Function.Module._load (module.js:495:3)
at Module.require (module.js:594:17)
at Module.require (pkg/prelude/bootstrap.js:1157:31)
at require (internal/module.js:11:18)
at Object.<anonymous> (/snapshot/chisel/node_modules/npm/lib/utils/lifecycle.js:4:19)
at Module._compile (pkg/prelude/bootstrap.js:1252:22) code: 'MODULE_NOT_FOUND', pkg: true }
I've tried doing npm install node-gyp inside node_modules/npm and also inside my own project to have Pkg include it inside the binary.
Not sure if switching to child_process is possible while Node.js and NPM are packed inside the binary file (I'm trying to keep the binary file independent of Node.js and NPM).
Any help/alternatives would be appreciated.
pkg compiler bundles all your node_module script into the compiled binary. But when, one of dependencies using some external binaries like node-gyp executable (inside node_modules/node-gyp/bin/node-gyp), phanthom js and etc, the pkg cannot do the compilation. You will have to avoid those dependencies if you want to compile your code with pkg module.
Otherwise you can refactor the node-gyp module and separate the executable them ship it with your compiled binary, which could be an advanced alternative and time consuming.
When datejs is installed using npm and when a script (below) is executed, the following error is obtained:
Error: Cannot find module 'datejs'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
datejs module exists under correct node_modules.Thanks in advance.
Try require('./node_modules/datejs/index.js');
I’m installing scrypt (https://www.npmjs.com/package/scrypt) from npm. The installation involves a node-gyp build step that builds a native node.js extension. When I then start my app, it fails with the following error:
node index.js
module.js:568
return process.dlopen(module, path._makeLong(filename));
^
Error: /package/host/localhost/gcc-4/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/xxxx/xxxx/node_modules/scrypt/build/Release/scrypt.node)
at Error (native)
at Object.Module._extensions..node (module.js:568:18)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/xxxx/xxxx/node_modules/scrypt/index.js:3:20)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/xxxx/xxxx/node_modules/unfun-cms/lib/utils/password.js:3:16)
which is not so surprising, because
[xxxx#xxxx nodeapp]$ strings /package/host/localhost/gcc-4/lib64/libstdc++.so.6 | grep "GLIBCXX_3\.4\.21"
[xxxx#xxxx nodeapp]$
while
[xxxx#xxxx nodeapp]$ strings /package/host/localhost/gcc-5/lib64/libstdc++.so.6 | grep "GLIBCXX_3\.4\.21"
GLIBCXX_3.4.21
[xxxx#xxxx nodeapp]$
I have
export PATH=/package/host/localhost/gcc-5/bin:$PATH
export LD_LIBRARY_PATH=/package/host/localhost/gcc-5/lib64:$LD_LIBRARY_PATH
in my .bashrc, and gcc --version shows 5.2.0 correctly, so I assume these settings are alright.
So the question is, how do I tell scrypt the path to the correct libstdc++.so.6, namely the one at /package/host/localhost/gcc-5/lib64/libstdc++.so.6? (And why does it even get it wrong?)
EDIT:
This is a CentOS machine. I’m using node.js version 6.1.0, npm version 3.8.6, and I’m trying to install scrypt version 6.0.3, which is the latest version at the time of this writing.
EDIT 2:
I tried to statically link the library by editing node_modules/scrypt/binding.gyp, adding
'libraries': ['/package/host/localhost/gcc-5/lib64/libstdc++.so.6'],
to each of the four specified targets, and then running node-gyp rebuild.
I also tried changing this to
'libraries': ['-L/package/host/localhost/gcc-5/lib64', '-lstdc++'],
, which appears to be syntactically valid, too—but still, it tries to load the library from the wrong path at runtime.
I stubled with a similar trouble and had resolve it with a trick uses dynamic load of libstdc++.so.6 through LD_PRELOAD:
LD_PRELOAD='/path/to/lib/libstdc++.so.6' /usr/bin/nodejs app.js
When I compile code with
\> jx package bin/www.js myApp
\> packaging...
\> [OK] compiled file is ready (myApp.jx)
it successfully created myApp.jx and myApp.jxp
But when I executed command
\> jx myApp.jx
It gives errors as:
C:\**\node_modules\express-session\node_modules\debug*node.js.jx*:72
exports.formatters.o = function(v) {
^
TypeError: Cannot set property 'o' of undefined
at Object. (C:\**\node_modules\express-session\node_modules\debug\node.js.jx:72:22)
at Module._compile (module.js:519:26)
at Object.Module._extensions..jx (module.js:1604:7)
at Module.load (module.js:346:36)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:378:17)
at require (module.js:396:17)
at Object. (C:\**\node_modules\express-session*index.js.jx:17:13*)
at Module._compile (module.js:519:26)
at Object.Module._extensions..jx (module.js:1604:7)
at Module.load (module.js:346:36)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:378:17)
at require (module.js:396:17)
at Object. (C:\***server.js.jx*:7:15)
at Module._compile (module.js:519:26)
I dont think,the problem is with NPM, step by step compile each of the .js file, and introduce required NPM package one by one , you will get the solution.
Since it is not a JXcore issue (the app fails with node too), you might want to seek the problem related with js-bson: Failed to load c++ bson extension, using pure JS version.
For example I saw this answer: Failed to load c++ bson extension, and they say it could be fixed by reinstalling modules with npm install.
I am newbie to MEAN stack and Linux hence please forgive me if my question is too obvious and stupid.
I have hosted a Nodejs application on Openshift. While trying to start the application I am facing following error due to GLIBC library version missmatch:
[Error: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /var/lib/openshift/550be20dfcf93378d600015e/app-root/runtime/repo/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/build/Release/bson.node)]
js-bson: Failed to load c++ bson extension, using pure JS version
/var/lib/openshift/550be20dfcf93378d600015e/app-root/runtime/repo/node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js:8
var ObjectId = require('mongodb').BSONPure.ObjectID;
^
TypeError: Cannot read property 'ObjectID' of undefined
at Object.<anonymous> (/var/lib/openshift/550be20dfcf93378d600015e/app-root/runtime/repo/node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js:8:43)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/var/lib/openshift/550be20dfcf93378d600015e/app-root/runtime/repo/node_modules/mongoose/lib/types/objectid.js:18:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
Current version of GLIBC on Opneshift is 2.12.
One obvious solution which I know is to upgrade GLIBC on Openshift. However that is not feasible as I am not having sudo rights on openshift.
Is there any possible workaround to solve the same issue?