Closed spacepope closed 7 years ago
Tried to include with extern C in the pfio.cc file like
#include <node.h>
#include <v8.h>
extern "C" {
#include <pifacedigital.h>
}
But still no success :(
To hopefully get more info on the linking process, i added 'ldflags': ['-Wl,--verbose']
to the binding.gyp file.
The output shows that the library files are found:
==================================================
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/crti.o succeeded
/usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/crti.o
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/crtbeginS.o succeeded
/usr/lib/gcc/arm-linux-gnueabihf/4.9/crtbeginS.o
attempt to open Release/obj.target/pfio/pfio.o succeeded
Release/obj.target/pfio/pfio.o
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libmcp23s17.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libmcp23s17.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libmcp23s17.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libmcp23s17.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../libmcp23s17.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../libmcp23s17.a failed
attempt to open /lib/arm-linux-gnueabihf/libmcp23s17.so failed
attempt to open /lib/arm-linux-gnueabihf/libmcp23s17.a failed
attempt to open /usr/lib/arm-linux-gnueabihf/libmcp23s17.so failed
attempt to open /usr/lib/arm-linux-gnueabihf/libmcp23s17.a failed
attempt to open /usr/local/lib/libmcp23s17.so failed
attempt to open /usr/local/lib/libmcp23s17.a succeeded
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libpifacedigital.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libpifacedigital.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libpifacedigital.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libpifacedigital.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../libpifacedigital.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../libpifacedigital.a failed
attempt to open /lib/arm-linux-gnueabihf/libpifacedigital.so failed
attempt to open /lib/arm-linux-gnueabihf/libpifacedigital.a failed
attempt to open /usr/lib/arm-linux-gnueabihf/libpifacedigital.so failed
attempt to open /usr/lib/arm-linux-gnueabihf/libpifacedigital.a failed
attempt to open /usr/local/lib/libpifacedigital.so failed
attempt to open /usr/local/lib/libpifacedigital.a succeeded
(/usr/local/lib/libpifacedigital.a)pifacedigital.o
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libstdc++.so succeeded
-lstdc++ (/usr/lib/gcc/arm-linux-gnueabihf/4.9/libstdc++.so)
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libm.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libm.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libm.so succeeded
-lm (/usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libm.so)
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so succeeded
opened script file /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so
opened script file /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so
attempt to open libgcc_s.so.1 failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so.1 succeeded
libgcc_s.so.1 (/usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so.1)
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc.a succeeded
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libpthread.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libpthread.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libpthread.so succeeded
opened script file /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libpthread.so
opened script file /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libpthread.so
attempt to open /lib/arm-linux-gnueabihf/libpthread.so.0 succeeded
/lib/arm-linux-gnueabihf/libpthread.so.0
attempt to open /usr/lib/arm-linux-gnueabihf/libpthread_nonshared.a succeeded
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libc.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libc.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libc.so succeeded
opened script file /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libc.so
opened script file /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libc.so
attempt to open /lib/arm-linux-gnueabihf/libc.so.6 succeeded
/lib/arm-linux-gnueabihf/libc.so.6
attempt to open /usr/lib/arm-linux-gnueabihf/libc_nonshared.a succeeded
attempt to open /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 succeeded
/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so succeeded
opened script file /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so
opened script file /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so
attempt to open libgcc_s.so.1 failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so.1 succeeded
libgcc_s.so.1 (/usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc_s.so.1)
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc.a succeeded
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/4.9/crtendS.o succeeded
but ldd -r piface/build/Release/pfio.node
shows
linux-vdso.so.1 (0x7ef08000)
/usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f06000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x76e18000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76d9d000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x76d70000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x76d48000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76c07000)
/lib/ld-linux-armhf.so.3 (0x54ae2000)
undefined symbol: mcp23s17_wait_for_interrupt (../piface/build/Release/pfio.node)
undefined symbol: _ZN2v816FunctionTemplate11GetFunctionEv (../piface/build/Release/pfio.node)
undefined symbol: mcp23s17_read_bit (../piface/build/Release/pfio.node)
undefined symbol: mcp23s17_disable_interrupts (../piface/build/Release/pfio.node)
undefined symbol: _ZN2v87Integer3NewEPNS_7IsolateEi (../piface/build/Release/pfio.node)
undefined symbol: mcp23s17_write_bit (../piface/build/Release/pfio.node)
undefined symbol: _ZNK2v85Value12IntegerValueEv (../piface/build/Release/pfio.node)
undefined symbol: mcp23s17_read_reg (../piface/build/Release/pfio.node)
undefined symbol: mcp23s17_write_reg (../piface/build/Release/pfio.node)
undefined symbol: _ZN2v811HandleScopeC1EPNS_7IsolateE (../piface/build/Release/pfio.node)
undefined symbol: _ZN2v86Object3SetENS_5LocalINS_5ValueEEES3_ (../piface/build/Release/pfio.node)
undefined symbol: _ZNK2v87Integer5ValueEv (../piface/build/Release/pfio.node)
undefined symbol: mcp23s17_open (../piface/build/Release/pfio.node)
undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEi (../piface/build/Release/pfio.node)
undefined symbol: node_module_register (../piface/build/Release/pfio.node)
undefined symbol: mcp23s17_enable_interrupts (../piface/build/Release/pfio.node)
undefined symbol: _ZN2v811HandleScopeD1Ev (../piface/build/Release/pfio.node)
undefined symbol: _ZN2v88Function7SetNameENS_5LocalINS_6StringEEE (../piface/build/Release/pfio.node)
undefined symbol: _ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS0_13NewStringTypeEi (../piface/build/Release/pfio.node)
undefined symbol: _ZN2v87Isolate10GetCurrentEv (../piface/build/Release/pfio.node)
Wow, solved it by accident. Order of linked library matters!
-lpifacedigital must be first in binding.gyp, then -lmcp23s17
Hi,
i just forked your wrapper project with the intention to update it to the official libpifacedigital, as the package from Thomas macPherson now refers to use that instead of his project.. There are also some more functionalities like interrupt enabling which would be nice to have.
What i've done so far:
But i could not get it to work: the install process and gyp rebuild succeed with
but a small test with
fails with
The libraries and includes are present,
ls -l /usr/local/lib && ls -l /usr/local/include
showsnm -C piface/build/Release/pfio.node
givesI have absolutely no clue why mcp23s17_open is undefined or not found at runtime, but i have no experience on native node wrappers and gyp. Do you have any hint what's going wrong here?