waf 找不到现有库

发布于 2025-01-02 20:32:19 字数 583 浏览 5 评论 0原文

我正在尝试为 node.js 编写 C++ 模块。 Node 使用 waf 作为构建器。

我想检查配置,如果库“sigar”存在。 我正在尝试这样做:

def configure(conf):
    conf.check_cxx(lib='sigar')

当我运行“node-waf configure”时,我收到以下消息:

Checking for library sigar               : not found 

但是 libsigar.so 存在:

# whereis libsigar
libsigar: /lib64/libsigar.so

安装“libsigar”库后我还运行了 ldconfig。 节点模块编译、链接和工作没有错误。 其他库如 libm、libboost_system 等可以在configure 中找到。

有人可以告诉我我做错了什么吗? 除了将 *.so 复制到库路径并运行 ldconfig 之外,安装库还有什么特别要做的吗?

感谢您的任何帮助。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

邮友 2025-01-09 20:32:19

我自己解决了。
使用 -vvv 选项运行配置非常有帮助,可以获得非常详细的输出。

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

当我尝试重新编译程序时,出现了一个链接器错误,这确实有帮助:

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 之前添加链接器标志解决了问题:

conf.env.append_value('LINKFLAGS', '-ldl')

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')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文