tsur / node-sword

9 stars 1 forks source link

require Error: /home/andrew/work/bb/node_modules/node-sword/bin/sword.node: wrong ELF class: ELFCLASS32 #1

Open AndrewGoal opened 10 years ago

AndrewGoal commented 10 years ago

hi friend, help me : p

require('node-sword') Error: /home/andrew/work/bb/node_modules/node-sword/bin/sword.node: wrong ELF class: ELFCLASS32 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 repl:1:2 at REPLServer.self.eval (repl.js:110:21) at Interface. (repl.js:239:12) at Interface.EventEmitter.emit (events.js:95:17) at Interface._onLine (readline.js:202:10) at Interface._line (readline.js:531:8)

tsur commented 10 years ago

Hi AndrewGoal, thank you for opening the issue and welcome!,

The problem is related to the system architecture you're using. Specifically, I think it's due to the OS you're using is x86-64. The node-sword package includes the binary sword compiled on a x86 architecture, hence the issue.

This project was first developed as a internal and personal tool for another project in order to create a node wrapper over the sword project. In such a case, I had no issues regarding different system architectures. So I just needed to install node-sword and was right on the way with no need to compile the sword from source files. So, basically we have several workarounds:

A) To include the sword binary within node-sword for most system architectures out there. (faster: no compilation) B) Compile it at node-sword installation time from sword source files. (slower: compilation step)

I'll go for B option and try to fix this issue as soon as possible. Any comment is appreciated. Bye!

AndrewGoal commented 10 years ago

Hi my brother in the LORD

My English is pool, but I'll do my best : p

Thank you very much for replying me so quickly. and sorry for replying you so late. God give me a daughter, my first child on 2014-1-25, I'm very very happy and thankful.

You are right, my OS is x86-64.

andrew@andrew-Studio-1558:~$ uname -a
Linux andrew-Studio-1558 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

And I think your solution is nice!

In fact, I want to look up the bible verse from GoldenDict that can look up anything can be copied . If there is a bridge between GoldenDict and Sword, I can look up the bible verse from GoldenDict.

I want to make this bridge using nodejs, so I found your wrapper.

By the way, I knew a command line tool named diatheke from wikipedia sword project article. This tool have met my need for the moment, so you may take easy about this issue.

diatheke -b ESV -k Jn 3:16
diatheke -b ESV -s phrase -k "in the lord"

In GoldenDict , F3-Programs-Add...-

/usr/bin/diatheke -b ESV -k %GDWORD%
/usr/bin/diatheke -b ESV -s phrase -k "%GDWORD%"

I am going to write a bash and a nodejs shell to make this feature more clever, in a nutshell:

diatheke -b ESV -k `mynodeshell.js %GDWORD%`

May they be helpful : )

tsur commented 10 years ago

Hi Andrew and ... Congratulations! The Lord bless your daughter so much!

You should be able to use node-sword now, just install it again from npm. Take also a look at readme, since several function signatures have changed a bit.

Thank you for your comment concerning diatheke, if there is some special diatheke utility/option you'd also like to see in node-sword, just give me a shoot about it and we can implement it.

Whatever issue you face when installing node-sword, let me know. bye!

AndrewGoal commented 10 years ago

Hi my brother. Thank Lord and you very much! : )

When I update node-sword, there are some errors:

andrew@andrew-Studio-1558:~/work/bb$ npm update
npm http GET https://registry.npmjs.org/node-sword/latest
npm http 200 https://registry.npmjs.org/node-sword/latest
npm http GET https://registry.npmjs.org/node-sword
npm http 200 https://registry.npmjs.org/node-sword
npm http GET https://registry.npmjs.org/node-sword/-/node-sword-0.0.3-alpha.tgz
npm http 200 https://registry.npmjs.org/node-sword/-/node-sword-0.0.3-alpha.tgz
npm http GET https://registry.npmjs.org/node-sword/0.0.3-alpha
npm http 200 https://registry.npmjs.org/node-sword/0.0.3-alpha
npm http GET https://registry.npmjs.org/node-sword/-/node-sword-0.0.3-alpha.tgz
npm http 200 https://registry.npmjs.org/node-sword/-/node-sword-0.0.3-alpha.tgz

> node-sword@0.0.3-alpha install /home/andrew/work/bb/node_modules/node-sword
> node-gyp configure build

gyp http GET http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
gyp: /home/andrew/.node-gyp/0.10.25/common.gypi not found (cwd: /home/andrew/work/bb/node_modules/node-sword) while reading includes of binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.2.0-58-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/andrew/work/bb/node_modules/node-sword
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! node-sword@0.0.3-alpha install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sword@0.0.3-alpha install script.
npm ERR! This is most likely a problem with the node-sword package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-sword
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.2.0-58-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "update"
npm ERR! cwd /home/andrew/work/bb
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/andrew/work/bb/npm-debug.log
npm ERR! not ok code 0

When I install node-sword, the same error occurs:

andrew@andrew-Studio-1558:~/work/bb$ npm install node-sword
npm http GET https://registry.npmjs.org/node-sword
npm http 304 https://registry.npmjs.org/node-sword

> node-sword@0.0.3-alpha install /home/andrew/work/bb/node_modules/node-sword
> node-gyp configure build

gyp: /home/andrew/.node-gyp/0.10.25/common.gypi not found (cwd: /home/andrew/work/bb/node_modules/node-sword) while reading includes of binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.2.0-58-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/andrew/work/bb/node_modules/node-sword
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! node-sword@0.0.3-alpha install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sword@0.0.3-alpha install script.
npm ERR! This is most likely a problem with the node-sword package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-sword
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.2.0-58-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "node-sword"
npm ERR! cwd /home/andrew/work/bb
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/andrew/work/bb/npm-debug.log
npm ERR! not ok code 0
tsur commented 10 years ago

Hello brother, it looks like some issue with node-gyp.

Try to install node-gyp globally on your system and then install node-sword again in new fresh location :

sudo npm -g install node-gyp

Just in case if it still fails, then make sure that "pkg-config" is on your system:

pkg-config --version

when you compile and build sword on your system, it creates a "sword.pc" file located on "/usr/lib/pkgconfig/sword.pc", make sure that file exists. Node-sword requires sword engine and during the compilation step, it uses that file in order to successfully include the sword engine and its dependences

If no luck, then I'd need a detail output to know what's actually going wrong. So the best is that you clone this repo:

git clone https://github.com/Tsur/node-sword.git node-sword && cd node-sword

And then build the project:

node-gyp clean configure build

Let me know what output errors you get when building the project. Thank you!

AndrewGoal commented 10 years ago

hello brother, sorry I'm so late. My laptop were sent to repair last week, and it is fixed just now.

I follow your step and go here:

andrew@andrew-Studio-1558:~/work/testns/2/node-sword$ node-gyp clean configure build
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.2
gyp info using node@0.10.25 | linux | x64
gyp info spawn python
gyp info spawn args [ '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/andrew/work/testns/2/node-sword/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/andrew/.node-gyp/0.10.25/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/andrew/.node-gyp/0.10.25',
gyp info spawn args   '-Dmodule_root_dir=/home/andrew/work/testns/2/node-sword',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: /home/andrew/.node-gyp/0.10.25/common.gypi not found (cwd: /home/andrew/work/testns/2/node-sword) while reading includes of binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.2.0-58-generic
gyp ERR! command "node" "/usr/bin/node-gyp" "clean" "configure" "build"
gyp ERR! cwd /home/andrew/work/testns/2/node-sword
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok