2017-09-05 48 views
2

SystemTap的错误后,安装在Ubuntu的SystemTap,测试示例Hello-stap.stp.but存在一些误区。在Ubuntu

怎样才能解决这个问题?

感谢

的SystemTap版本

Systemtap translator/driver (version 2.9/0.165, Debian version 2.9-2ubuntu2 (xenial))

Copyright (C) 2005-2015 Red Hat, Inc. and others

This is free software; see the source for copying conditions.

enabled features: AVAHI LIBSQLITE3 NLS NSS TR1_UNORDERED_MAP

HELLO-stap.stp

probe begin 
{ 
    print("hello world\n") 
    exit() 
} 

这是错误信息

错误1:

In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0, from /usr/share/systemtap/runtime/runtime.h:24, from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: /usr/share/systemtap/runtime/linux/access_process_vm.h: In function ‘__access_process_vm_’: /usr/share/systemtap/runtime/linux/access_process_vm.h:35:29: error: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Werror=int-conversion] ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma); ^

+0

其他错误信息 – user8561368

+0

你应该问https://askubuntu.com/ –

+0

@MemduhÇağrı德米尔THX这个问题,我想补充一个问题https://askubuntu.com/questions/952874/systemtap-ubuntu-错误/ 952875#952875。 – user8561368

回答

-1

错误2:

In file included from ./include/linux/pid_namespace.h:6:0, 
        from ./include/linux/ptrace.h:8, 
        from ./include/linux/ftrace.h:13, 
        from ./include/linux/kprobes.h:42, 
        from /usr/share/systemtap/runtime/linux/runtime.h:21, 
        from /usr/share/systemtap/runtime/runtime.h:24, 
        from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
    ./include/linux/mm.h:1293:6: note: expected ‘long unsigned int’ but argument is of type ‘struct task_struct *’ 
    long get_user_pages(unsigned long start, unsigned long nr_pages, 
     ^

错误3:

In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0, 
       from /usr/share/systemtap/runtime/runtime.h:24, 
       from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
/usr/share/systemtap/runtime/linux/access_process_vm.h:35:34: error: passing argument 2 of ‘get_user_pages’ makes integer from pointer without a cast [-Werror=int-conversion] 
    ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma); 
           ^

错误4:

In file included from ./include/linux/pid_namespace.h:6:0, 
        from ./include/linux/ptrace.h:8, 
        from ./include/linux/ftrace.h:13, 
        from ./include/linux/kprobes.h:42, 
        from /usr/share/systemtap/runtime/linux/runtime.h:21, 
        from /usr/share/systemtap/runtime/runtime.h:24, 
        from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
    ./include/linux/mm.h:1293:6: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’ 
    long get_user_pages(unsigned long start, unsigned long nr_pages, 
     ^

错误5:

In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0, 
        from /usr/share/systemtap/runtime/runtime.h:24, 
        from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
    /usr/share/systemtap/runtime/linux/access_process_vm.h:35:44: error: passing argument 4 of ‘get_user_pages’ makes pointer from integer without a cast [-Werror=int-conversion] 
     ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma); 
               ^

错误6:

In file included from ./include/linux/pid_namespace.h:6:0, 
       from ./include/linux/ptrace.h:8, 
       from ./include/linux/ftrace.h:13, 
       from ./include/linux/kprobes.h:42, 
       from /usr/share/systemtap/runtime/linux/runtime.h:21, 
       from /usr/share/systemtap/runtime/runtime.h:24, 
       from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
./include/linux/mm.h:1293:6: note: expected ‘struct page **’ but argument is of type ‘int’ 
long get_user_pages(unsigned long start, unsigned long nr_pages, 
    ^

错误7:

In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0, 
        from /usr/share/systemtap/runtime/runtime.h:24, 
        from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
    /usr/share/systemtap/runtime/linux/access_process_vm.h:35:47: error: passing argument 5 of ‘get_user_pages’ makes pointer from integer without a cast [-Werror=int-conversion] 
     ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma); 
               ^

错误8:

In file included from ./include/linux/pid_namespace.h:6:0, 
        from ./include/linux/ptrace.h:8, 
        from ./include/linux/ftrace.h:13, 
        from ./include/linux/kprobes.h:42, 
        from /usr/share/systemtap/runtime/linux/runtime.h:21, 
        from /usr/share/systemtap/runtime/runtime.h:24, 
        from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
    ./include/linux/mm.h:1293:6: note: expected ‘struct vm_area_struct **’ but argument is of type ‘int’ 
    long get_user_pages(unsigned long start, unsigned long nr_pages, 
     ^

错误9:

In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0, 
        from /usr/share/systemtap/runtime/runtime.h:24, 
        from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
    /usr/share/systemtap/runtime/linux/access_process_vm.h:35:13: error: too many arguments to function ‘get_user_pages’ 
     ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma); 
       ^

错误10:

In file included from ./include/linux/pid_namespace.h:6:0, 
        from ./include/linux/ptrace.h:8, 
        from ./include/linux/ftrace.h:13, 
        from ./include/linux/kprobes.h:42, 
        from /usr/share/systemtap/runtime/linux/runtime.h:21, 
        from /usr/share/systemtap/runtime/runtime.h:24, 
        from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
    ./include/linux/mm.h:1293:6: note: declared here 
    long get_user_pages(unsigned long start, unsigned long nr_pages, 
     ^

错误11:

In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0, 
        from /usr/share/systemtap/runtime/runtime.h:24, 
        from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25: 
    /usr/share/systemtap/runtime/linux/access_process_vm.h:55:7: error: implicit declaration of function ‘page_cache_release’ [-Werror=implicit-function-declaration] 
     page_cache_release (page); 
     ^

错误12:

In file included from /usr/share/systemtap/runtime/linux/print.c:17:0, 
        from /usr/share/systemtap/runtime/print.c:17, 
        from /usr/share/systemtap/runtime/runtime_context.h:22, 
        from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:55: 
    /usr/share/systemtap/runtime/transport/transport.c: In function ‘_stp_lock_inode’: 
    /usr/share/systemtap/runtime/transport/transport.c:506:19: error: ‘struct inode’ has no member named ‘i_mutex’ 
    mutex_lock(&inode->i_mutex); 
        ^

错误13:

/usr/share/systemtap/runtime/transport/transport.c: In function ‘_stp_unlock_inode’: 
    /usr/share/systemtap/runtime/transport/transport.c:515:21: error: ‘struct inode’ has no member named ‘i_mutex’ 
    mutex_unlock(&inode->i_mutex); 
         ^

提示:

cc1: all warnings being treated as errors 
    scripts/Makefile.build:294: recipe for target '/tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.o' failed 
    make[1]: *** [/tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.o] Error 1 
    Makefile:1524: recipe for target '_module_/tmp/stapd8LhT7' failed 
    make: *** [_module_/tmp/stapd8LhT7] Error 2 
    WARNING: kbuild exited with status: 2 
    Pass 4: compilation failed. [man error::pass4] 
    Tip: /usr/share/doc/systemtap/README.Debian should help you get started. 
1

我碰到这个ISS我自己。简而言之,Ubuntu的systemtap软件包目前已经过期。

说明:前一段时间,内核更新了get_user_pages()函数,这意味着任何使用前面函数原型的东西现在都无法编译。这也发生在VMWare的vmmon和vmnet模块上。运行stap时,它会生成一个使用get_user_pages()的内核模块源文件,将其编译并将其加载到内核中。但它生成的C代码使用旧的函数定义,因此无法构建。

目前没有解决方法:您可以从源代码编译的SystemTap(这是我做不到的事情,但我也没有很努力),或告诉Ubuntu的升级他们打破了SystemTap包 - 我提交了bug report,也许你可以确认它。

我的解决方案是切换到Fedora 26并运行/ usr/bin/stap-prep来安装前提条件。工作没有任何打嗝!

1

我有同样的问题,所以我最终从源代码构建systemtap。我在xenial上使用v3.1,到目前为止这么好。

## Install build-required packages 
apt-get update && \ 
     apt-get install -y build-essential gettext elfutils libdw-dev python wget tar && \ 
     apt-get clean; 

## Build from source 
wget https://sourceware.org/systemtap/ftp/releases/systemtap-3.1.tar.gz 
tar xzvf systemtap-3.1.tar.gz 

## Instruction: https://sourceware.org/git/?p=systemtap.git;a=blob_plain;f=README;hb=HEAD 
cd systemtap-3.1/ && \ 
     ./configure && \ 
     make all && \ 
     make install ;