zeromq / zeromq.js

:zap: Node.js bindings to the ØMQ library
http://zeromq.github.io/zeromq.js/
MIT License
1.48k stars 210 forks source link

Build for Linux 32-bit #269

Closed chaitanya-cherukuri closed 1 month ago

chaitanya-cherukuri commented 6 years ago

Hello,

I'm working on Linux 32 bit system. Could anyone let me know how do I build for Linux 32-bit system?

Thanks, Chaitanya

n-riesco commented 6 years ago

@chaitanya-cherukuri Having the prerequisites listed here should be enough for npm install zeromq to work.

chaitanya-cherukuri commented 6 years ago

@n-riesco thank you for your prompt response. I apologze for minimal expanation in my previous post. I am using a 64bit system but want a set of 32bit binaries. I was running following commands to generate 32bit binaries __node-gyp clean configure build --verbose --target_arch=x32 npm install zeromq__

this is the error that I receive when I use zmq.node in my application: Error: /usr/lib/node_modules/zeromq/build/Release/zmq.node: wrong ELF class: ELFCLASS64

Is there anything that I missed for generating 32-bit binaries?

Thanks, Chaitanya

n-riesco commented 6 years ago

@chaitanya-cherukuri you need to install the 32bit binaries of node.js.

To check that you're running the 32bit binaries, you should get this:

$ ./node -e "console.log(process.arch)"
ia32
chaitanya-cherukuri commented 6 years ago

@n-riesco thank you, installing 32bit binaries of node.js helped. How do I pass a couple flags through (CXXFLAGS, LDFLAGS) node. Now i see this error:

_Error: /usr/lib/node_modules/zeromq/build/Release/zmq.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorE_

Thanks, Chaitanya

n-riesco commented 6 years ago

@chaitanya-cherukuri You can use ZMQ_BUILD_OPTIONS, but I don't think is necessary shouldn't be necessary.

See the Dockerfile here for instructions on building zeromq fro linux-32bit.

I tested it and it still works for me:

$ git clone  https://github.com/zeromq/zeromq.js.git
$ cd zeromq.js
$ npm install

[...]

make: Leaving directory '/home/user/tmp/node-ia32/zeromq.js/build'
added 560 packages in 76.838s
$
chaitanya-cherukuri commented 6 years ago

@n-riesco thank you for the detailed instructions and docker file. I was able to build but I still have runtime error that I have mentioned before.

__Error: /usr/lib/node_modules/zeromq/build/Release/zmq.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorE

Dynamic symbol report shows that x86-32 uses GLIBC_2.0, C runtime library whereas ARM uses GLIBC_2.4. They both use the same C++ library, GLIBCXX_3.4.

n-riesco commented 6 years ago

@chaitanya-cherukuri Could you describe in what way your machine is different from the one described in the Dockerfile? What commands are you running to build zeromq?

We know it's working in machine. We need to find out what's different in yours.

chaitanya-cherukuri commented 6 years ago

@n-riesco I'm running Ubuntu 14.04 and followed the same commands as mentioned in Dockerfile. I used " npm install" command to build zeromq.

I'm copying the zmq.node to the docker(custom 32bit linux) where we emulate our application.

n-riesco commented 6 years ago

@chaitanya-cherukuri Oh, I missed your comment about ARM. Are you cross compiling targeting ARM? If so, have a look at the script https://github.com/zeromq/zeromq.js/blob/master/scripts/cross_compile.sh

aminya commented 2 months ago

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