waf找不到现有库 [英] waf cannot find an existing library
问题描述
我想为node.js编写一个C ++模块。
节点正在使用waf作为构建器。
I'm trying to program a C++ module for node.js. Node is using waf as builder.
我想检查配置,如果库sigar存在。
我试图这样做:
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')
当我运行node-waf configure时,消息:
When I run "node-waf configure", I get the following message:
Checking for library sigar : not found
但是libsigar.so存在:
But libsigar.so exists:
# whereis libsigar
libsigar: /lib64/libsigar.so
我还在安装libsigar库后运行ldconfig。
节点模块编译,链接和工作无错误。
在配置时可以找到像libm,libboost_system等其他库。
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.
有人可以告诉我我做错了什么?
安装库比在库路径上复制* .so并运行ldconfig有什么特别的事情吗?
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?
感谢您的帮助。 / p>
Thanks for any help.
推荐答案
我自己解决。
它非常有用的运行配置与-vvv选项,非常详细的输出。
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
在检查libsigar之前添加一个链接器标志解决了这个问题:
Adding a linker flag before checking for libsigar solved the problem:
conf.env.append_value('LINKFLAGS', '-ldl')
这篇关于waf找不到现有库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!