Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

waf cannot find an existing library

waf cannot find an existing library

Problem

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.

Problem courtesy of: reeaal

Solution

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')
Solution courtesy of: reeaal

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

waf cannot find an existing library

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×