This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: How to give compiler arguments
- From: Josh Stone <jistone at redhat dot com>
- To: Martin Martin <martin at infinio dot com>
- Cc: systemtap at sourceware dot org
- Date: Fri, 06 Sep 2013 12:00:06 -0700
- Subject: Re: How to give compiler arguments
- Authentication-results: sourceware.org; auth=none
- References: <CAAQ0mPi-2Z_+0TN0+qJ-u0LoSqZY9Lm0Z6L4=pXqW4aGON+9pA at mail dot gmail dot com>
On 09/06/2013 11:42 AM, Martin Martin wrote:
> Hi,
>
> If I put:
>
> %{
> #include "stdint.h"
> %}
>
> at the start of my probe script, stap says:
>
>
> In file included from
> /tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.c:24:0:
> /usr/lib/gcc/x86_64-linux-gnu/4.7/include/stdint.h:3:26: error: no
> include path in which to search for stdint.h
> make[1]: *** [/tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.o]
> Error 1
>
> Is there a way to give some extra arguments to the compiler to resolve
> this? Or am I out of luck because it's a kernel module?
That's the right line of thought -- as a kernel module, stap can only
include kernel headers. We do have --runtime=dyninst which runs as a
shared object, but the usage model is a bit different there.
If "stdint.h" is really what you're after, then "linux/types.h" has a
lot of the same definitions, and is already included by default. If
that's just an example and you're really after some purely userspace
definitions, you may be out of luck. However, another option in stap
functions (not embedded-C) is to use @cast for user types, like:
@cast(my_pointer, "Elf32_Ehdr", "<elf.h>")->e_machine.