zeromq.js
zeromq.js copied to clipboard
Electron, clang: error: no such file or directory: './Release/../../zmq/lib/libzmq.a'
I'm hoping to get this working with Electron.
I've ran npm rebuild zeromq --runtime=electron --target=1.4.5, but when I run Electron I get
Uncaught Error: Cannot find module '../build/Release/zmq.node'
I then tried ./node_modules/.bin/electron-rebuild which eventually fails with
clang: error: no such file or directory: './Release/../../zmq/lib/libzmq.a'
make: *** [Release/zmq.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/trusktr/src/MyProject/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:180:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/Cellar/node/10.5.0_1/bin/node" "/Users/trusktr/src/MyProject/node_modules/.bin/node-gyp" "rebuild" "--target=1.7.9" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source"
gyp ERR! cwd /Users/trusktr/src/MyProject/node_modules/zeromq
gyp ERR! node -v v9.11.2
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Failed with exit code: 1
at SafeSubscriber._error (/Users/trusktr/src/MyProject/node_modules/spawn-rx/lib/src/index.js:277:84)
at SafeSubscriber.__tryOrUnsub (/Users/trusktr/src/MyProject/node_modules/rxjs/Subscriber.js:242:16)
at SafeSubscriber.error (/Users/trusktr/src/MyProject/node_modules/rxjs/Subscriber.js:201:26)
at Subscriber._error (/Users/trusktr/src/MyProject/node_modules/rxjs/Subscriber.js:132:26)
at Subscriber.error (/Users/trusktr/src/MyProject/node_modules/rxjs/Subscriber.js:106:18)
at MapSubscriber.Subscriber._error (/Users/trusktr/src/MyProject/node_modules/rxjs/Subscriber.js:132:26)
at MapSubscriber.Subscriber.error (/Users/trusktr/src/MyProject/node_modules/rxjs/Subscriber.js:106:18)
at SafeSubscriber._next (/Users/trusktr/src/MyProject/node_modules/spawn-rx/lib/src/index.js:251:65)
at SafeSubscriber.__tryOrUnsub (/Users/trusktr/src/MyProject/node_modules/rxjs/Subscriber.js:242:16)
at SafeSubscriber.next (/Users/trusktr/src/MyProject/node_modules/rxjs/Subscriber.js:189:22)
How exactly do we get this running in Electron?
(My goal is not to use --zmq-external, as I'd like to zip up my project folder and run it on any similar machine)
Hey, check if there's spaces in the path of your app. OC
So did you give up on this...? It seems like everyone just stops responding after they ask questions. I'm wondering if they're funneling into a different solution?
My guess is since this uses native dependencies we're going to have to always compile the binaries on the platform itself to get any success out of this at all?
Is it ever meant to run as a client for a user? or is the goal of the project as a whole to be used in like node-server side apps with predictable server environment?
Seems like there is value in having a simple ZMQ sub-only library. Is this even possible?
I have this exact same problem. Found no solution so far.
@EricLambrecht the project I was building is OSS so you can look at my source and see if you can get it going... it's based on electron-boilerplate but somehow I managed to get it working so it can build from package.json script. https://github.com/openpilot-community/workbench
@jfrux Thanks! But I didn't find anything useful in your source code unfortunately.
Alright… in app/package.json is where the native dependencies are placed. You’ll have to build the binaries per platform. On Jan 15, 2019, 10:00 AM -0500, Eric Lambrecht [email protected], wrote:
Thanks! But I didn't find anything useful in your source code unfortunately. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
@jfrux Thanks. The problem is that I'm not even depending on zeromq directly. It is required in an npm package I'm using. I can't really do anything about that. Also, I'm not using electron, just node.
Edit: And I don't have problems with different platforms. It's just my local dev machine.
Even if it’s used in another module you have to build the binaries or it’ll bomb… The only way it’ll work is if the npm module is building the binaries upon npm install which there is a solid chance that it isn’t…
Probably will have to dig into that npm module and learn more about what it’s doing upon npm install via it’s package.json.
That’s best advice I think I can give at this point! :)
Good luck! On Jan 15, 2019, 10:07 AM -0500, Eric Lambrecht [email protected], wrote:
@jfrux Thanks. The problem is that I'm not even depending on zeromq directly. It is required in an npm package I'm using. I can't really do anything about that. Also, I'm not using electron, just node. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I also encountered the same problem, first of all, my solution: This is a problem caused by the failure to download the zeromq-xxx.tar.gz package, just make sure the network is normal and the package is downloaded properly and can be decompressed, the subsequent compilation can be completed.
My environment: macOS 10.15.7 x64 architecture cpu zeromq.js version: 5.3.1 nodejs v18.14.2
Then is the order of my problem, I use pnpm:
-
First I install the dependency
env CC=clang CXX=clang++ pnpm add zeromq@5 --config.build-from-sourceand get the errorclang: error: no such file or directory: '. /Release/... /... /zmq/lib/libzmq.a' -
I clone zeromq.js and searched for
libzmq.aand found this line in thebinding.gypfile:'libraries': ['<(PRODUCT_DIR)/... /... /zmq/lib/libzmq.a'],,libzmq.awas compiled in the previous step, but I can't find it now, and I can't find thelibfolder, so I'm sure this is a compilation problem. Also I found a strange fileBUILD_SUCCESSunder this path, although the build didn't work.
-
Next, I'm looking at the
'action': ['node', '<(PRODUCT_DIR)/...' inbinding.gyp. /... /scripts/prepare.js'],to find theprepare.jsfile and search forBUILD_SUCCESSin the file and find this method
function buildZMQ(scriptPath, zmqDir) {
console.log("Building libzmq for " + process.platform);
console.log("Building libzmq scriptPath " + scriptPath);
const child = spawnSync("/bin/sh", [scriptPath, ZMQ, ARCH], {
stdio: ['inherit', 'inherit', 'inherit'],
});
if (!child.status) {
return console.error("child process exited with code " + child.status);
}
const message = "Succesfully build libzmq on " + Date();
console.log("write " + zmqDir, message);
fs.writeFileSync(path.join(zmqDir, "BUILD_SUCCESS"), message)
}
By debugging I found the build script file zeromq.js/scripts/build_libzmq.sh
- Continuing debugging
/build_libzmq.shI found the code intest -d "${ZMQ_SRC_DIR}" || tar xzf zeromq-$ZMQ.tar.gzThis line exits, and I manually executed the decompression and got the error:
cd zmq/
tar xzf zeromq-4.2.2.tar.gz
zeromq-4.2.2/config/libtool.m4: truncated gzip input
tar: Error exit delayed from previous errors.
Then I found out that zeromq-4.2.2.tar.gz is not complete. After deleting the contents of zmq/, I ran env CC=clang CXX=clang++ pnpm install again to make sure the network was correct, and it compiled fine, and the contents of zmq/ changed to
and everything works fine next
Or you can just download zeromq-4.2.2.tar.gz and put it under the zmq path.
Unfortunately I don't have the ability to change the code, but I think zeromq.js/scripts/build_libzmq.sh would be strange after executing the script and generating the file BUILD_SUCCESS, which shouldn't be a correct behavior.
This is just what I encountered, hope it helps there
v6 was released. Please try again with the latest version, and report back if the issue still persists. https://github.com/zeromq/zeromq.js/releases/tag/v6.0.0