Systemtap error on ubuntu

1.8k views Asked by At

after install systemtap on ubuntu,test example hello-stap.stp。but there are some errors。

how can I fix this?

thanks

systemtap version

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()
}

this is error info。

Error 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); ^

2

There are 2 answers

1
Farhan Yusufzai On

I ran into this issue myself. In short, Ubuntu's systemtap package is currently out of date.

Explanation: Sometime ago, the kernel updated the get_user_pages() function, which meant anything using the previous function prototype now failed to compile. This also happened on VMWare's vmmon and vmnet modules. When you run stap, it generates a kernel module source file that uses get_user_pages(), compiles it and loads it into the kernel. But the C code it generates uses the old function definition and therefore fails to build.

Currently no Solution: You can either build SystemTap from source (which I failed to do, but I also did not try very hard) or tell Ubuntu to upgrade their broken systemtap package - I submitted a bug report, maybe you can confirm it.

My solution was to switch to Fedora 26 and run /usr/bin/stap-prep to install the pre-requisites. Worked without any hiccups!

2
mcfongtw On

I had the same problem, so I end up building systemtap from source. I am using v3.1 on xenial, and so far so good.

## 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 ;