waf cannot find an existing library

守給你的承諾、 提交于 2019-12-13 14:34:29

问题


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.


回答1:


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')


来源:https://stackoverflow.com/questions/9151304/waf-cannot-find-an-existing-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!