Reputation: 346
I'm trying to program a C++ module for node.js. Node is using waf as builder.
I want to check on configure, if the library "sigar" exists. What I'm trying to do so:
def configure(conf):
conf.check_cxx(lib='sigar')
When I run "node-waf configure", I get the following message:
Checking for library sigar : not found
But libsigar.so exists:
# whereis libsigar
libsigar: /lib64/libsigar.so
I also ran ldconfig after installing the "libsigar" library. The node module compiles, links and works without errors. Other libraries like libm, libboost_system and so on can be found on configure.
Can someone tell me what I am doing wrong? Is there anything special to do for installing a library than only copying a *.so to the library path and running ldconfig?
Thanks for any help.
Upvotes: 3
Views: 3463
Reputation: 346
Solved it on my own. Its pretty helpful to run configure with the -vvv option, for very verbose output.
20:31:48 runner system command -> ['/usr/bin/g++', 'Release/test_1.o', '-o', '/home/reeaal/workspace/hwmonitor/build/.conf_check_0/testbuild/Release/testprog', '-Wl,-Bdynamic', '-lsigar']
When I tried to recompile the programm, I got a linker error which really helped:
g++ test.cpp -Bdynamic -lsigar
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/libsigar.so: undefined reference to `dlsym'
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/libsigar.so: undefined reference to `dlopen'
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/libsigar.so: undefined reference to `dlclose'
collect2: ld returned 1 exit status
Adding a linker flag before checking for libsigar solved the problem:
conf.env.append_value('LINKFLAGS', '-ldl')
Upvotes: 5