dtrace:未能编译脚本预处理器未找到

时间:2012-11-16 11:48:27

标签: gcc ubuntu dtrace dwarf

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

为实现这一目标,我首先在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被命名为{ {1}}。

为了实现这一点,我创建了一个带libdw.so的符号链接。完成后,编译失败。

ln -s /usr/lib/libdw.so /usr/lib/libdwarf.so

所以,让我们撤消它。我删除了符号链接,再次编译,运行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 make install并希望一切正常。一切似乎都很好。

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

make load

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

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

2 个答案:

答案 0 :(得分:1)

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

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

截至2013年5月,我正在研究如何更新到libdw.a,因为这似乎是libdwarf的现代替代品。

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

答案 1 :(得分:0)

您是否尝试将--enable-dtrace = false添加到/.configure? 或者也许--with-dtrace = false?

这应该是我认为的伎俩...