gpt4 book ai didi

gcc - dtrace: 编译脚本失败 未找到预处理器

转载 作者:太空宇宙 更新时间:2023-11-03 17:00:58 28 4
gpt4 key购买 nike

我正在尝试测试 this script from oracle to get active NFS clients在 Ubuntu 10.04 上,但我无法让它运行。

为了实现这一点,我首先在 these instructions 之后安装了 dtrace .这正是我所做的:

apt-get install bison flex zlib1g-dev libelf-dev binutils-dev libdw-dev libc6-dev-i386
wget ftp://crisp.dyndns-server.com/pub/release/website/dtrace/dtrace-20121009.tar.bz2
tar xfj dtrace-20121009.tar.bz2
cd dtrace-20121009
make all
make install
make load

但是,我在编译时收到此警告:

=================================================================
=== You need /usr/lib/libdwarf.a and /usr/lib/libbfd.a installed to build.
===
=== apt-get install binutils-dev
=== apt-get install libdw-dev
===
=== Without these, we will not build ctfconvert (needed for
=== SDT structure definitions).
=================================================================
cd cmd/instr ; make --no-print-directory
cd usdt/c ; make --no-print-directory
tools/mkdriver.pl all
Executing: /usr/src/dtrace/dtrace-20121009/tools/make-me
make -C /lib/modules/2.6.38-16-server/build M=/usr/src/dtrace/dtrace-20121009/build-2.6.38-16-server/driver
CC [M] /usr/src/dtrace/dtrace-20121009/build-2.6.38-16-server/driver/systrace.o
LD [M] /usr/src/dtrace/dtrace-20121009/build-2.6.38-16-server/driver/dtracedrv.o
Building modules, stage 2.
MODPOST 1 modules
LD [M] /usr/src/dtrace/dtrace-20121009/build-2.6.38-16-server/driver/dtracedrv.ko
tools/mkctf.sh
build/ctfconvert not available - so not building the linux.ctf file
NOTE: The build is complete, but build/ctfconvert is not available.
This means you will get run time errors from the io.d and sched.d files
due to undefined kernel structure definitions. Simply delete or rename
these files until a fix can be put in place to handle older
distros which do not have the required libdwarf dependencies.

(Typical error is references to undefined struct definitions such
as dtrace_cpu_t).

sync

我已经安装了 libdw-devbinutils-dev,但是看一下 makefile,它似乎在寻找 libdwarf.so,而我系统上的 libdw 名为 libdw.so

为了避免这种情况,我使用 ln -s/usr/lib/libdw.so/usr/lib/libdwarf.so 创建了一个符号链接(symbolic link)。这样做之后,编译失败。

cd cmd/ctfconvert ; make --no-print-directory
gcc -g -I. -I../../ -I../../libctf -I../../common -I../../uts/common -I../../linux -I/usr/include/libdwarf -c dwarf.c
In file included from dwarf.c:94:
/usr/include/dwarf.h:56: error: expected identifier before numeric constant
/usr/include/dwarf.h:136: error: expected identifier before numeric constant
/usr/include/dwarf.h:321: error: expected identifier before numeric constant
/usr/include/dwarf.h:461: error: expected identifier before numeric constant
/usr/include/dwarf.h:517: error: expected identifier before numeric constant
make[3]: *** [../../build/ctfconvert.obj/dwarf.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [do_cmds] Error 2
tools/bug.sh
make: *** [all] Error 1

那么,让我们撤消它。我删除了符号链接(symbolic link),再次编译,运行 make installmake load 并希望一切都很好。一切似乎都很好。

但是,然后我尝试运行上面提到的脚本,但它失败了:

# ./get_ngs_clients.d 
dtrace: failed to compile script ./get_ngs_clients.d: Preprocessor not found

我不知道发生了什么。我安装了 gcc,以防万一。

# dpkg -l | grep gcc
ii gcc 4:4.4.3-1ubuntu1 The GNU C compiler
ii gcc-4.4 4.4.3-4ubuntu5.1 The GNU C compiler
ii gcc-4.4-base 4.4.3-4ubuntu5.1 The GNU Compiler Collection (base package)
ii gcc-4.4-multilib 4.4.3-4ubuntu5.1 The GNU C compiler (multilib files)
ii gcc-multilib 4:4.4.3-1ubuntu1 The GNU C compiler (multilib files)
ii lib32gcc1 1:4.4.3-4ubuntu5.1 GCC support library (32 bit Version)
ii libgcc1 1:4.4.3-4ubuntu5.1 GCC support library

最佳答案

如果您的系统上没有 libdwarf.a,则不会构建 ctfconvert 工具。 (libdwarf.a 和 libdw.a 不一样)。

如果 ctfconvert 没有构建,那么您自己的任何脚本或 dtrace etc/*.d 脚本都可能无法加载。 (Dtrace 强制自动为您加载这些脚本,这很烦人)。任何依赖结构定义的脚本都会失败。

截至 2013 年 5 月,我正在查看更新到 libdw.a 需要做些什么,因为这似乎是 libdwarf 的现代替代品。

(由 DTrace/Linux 的“作者”发布)。

关于gcc - dtrace: 编译脚本失败 未找到预处理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13416007/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com