Node-expat错误的ELF类:ELFCLASS64

时间:2014-02-25 06:29:56

标签: c++ node.js elf

我必须在构建计算机上构建我的节点应用程序,然后将应用程序移动到目标计算机,因为我无法根据某些依赖项的要求在目标计算机上编译C.

我遇到了node-expat的编译错误,它正在吐出上面的ELF类错误。我已经尝试在32位和64位版本的linux上重建我的节点应用程序,但是当我将它移植到我的目标机器(据称是64位机器)时似乎已经解决了这个问题。

我在构建时遇到这些错误:

node-gyp rebuild

make: Entering directory `/root/lumos/runner/node_modules/logbook/node_modules/simple-xmpp/node_modules/node-xmpp/node_modules/node-expat/build'
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmltok.o
../deps/libexpat/lib/xmltok.c:471:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:471:1: warning: (near initialization for ‘latin1_encoding_ns.isName2’)
../deps/libexpat/lib/xmltok.c:484:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:484:1: warning: (near initialization for ‘latin1_encoding.isName2’)
../deps/libexpat/lib/xmltok.c:504:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:504:1: warning: (near initialization for ‘ascii_encoding_ns.isName2’)
../deps/libexpat/lib/xmltok.c:517:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:517:1: warning: (near initialization for ‘ascii_encoding.isName2’)
../deps/libexpat/lib/xmltok.c:730:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:730:1: warning: (near initialization for ‘little2_encoding_ns.isName2’)
../deps/libexpat/lib/xmltok.c:749:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:749:1: warning: (near initialization for ‘little2_encoding.isName2’)
../deps/libexpat/lib/xmltok.c:762:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:762:1: warning: (near initialization for ‘internal_little2_encoding_ns.isName2’)
../deps/libexpat/lib/xmltok.c:775:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:775:1: warning: (near initialization for ‘internal_little2_encoding.isName2’)
../deps/libexpat/lib/xmltok.c:871:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:871:1: warning: (near initialization for ‘big2_encoding_ns.isName2’)
../deps/libexpat/lib/xmltok.c:890:1: warning: missing initializer
../deps/libexpat/lib/xmltok.c:890:1: warning: (near initialization for ‘big2_encoding.isName2’)
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlrole.o
  AR(target) Release/obj.target/deps/libexpat/libexpat.a
  COPY Release/libexpat.a
  CXX(target) Release/obj.target/node_expat/node-expat.o
  SOLINK_MODULE(target) Release/obj.target/node_expat.node
  SOLINK_MODULE(target) Release/obj.target/node_expat.node: Finished
  COPY Release/node_expat.node
make: Leaving directory `/root/lumos/runner/node_modules/logbook/node_modules/simple-xmpp/node_modules/node-xmpp/node_modules/node-expat/build'

虽然它在我正在建立的机器上运行良好。当我尝试在目标机器上运行它时,我得到以下内容:

module.js:356
  Module._extensions[extension](this, filename);
                               ^
Error: /root/lumos/runner/node_modules/logbook/node_modules/simple-xmpp/node_modules/node-xmpp/node_modules/node-expat/build/Release/node_expat.node: wrong ELF class: ELFCLASS64
    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> (/root/lumos/runner/node_modules/logbook/node_modules/simple-xmpp/node_modules/node-xmpp/node_modules/node-expat/lib/node-expat.js:4:13)
    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)
bash-4.1#

ELFCLASS64是否告诉我该应用程序正在尝试调用64位库或32位库?可以通过node-gyp / npm?

强制node-expat使用正确的libs进行编译

1 个答案:

答案 0 :(得分:0)

  

ELFCLASS64是否告诉我应用程序正在尝试调用64位库或32位库?

它告诉您32位进程尝试dlopen 64位库。

从您的描述中不清楚如何调用node,但是您在目标计算机上调用的二进制文件是32位二进制文​​件,它无法加载64位共享库。

您需要调用64位二进制文​​件,或者以32位模式构建库。