All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuyi Cheng <chengshuyi@linux.alibaba.com>
To: bpf@vger.kernel.org
Cc: kafai@fb.com, andrii@kernel.org, songliubraving@fb.com, yhs@fb.com
Subject: How to avoid compilation errors like "error: no member named xxx in strut xxx"?
Date: Wed, 16 Jun 2021 12:06:18 +0800	[thread overview]
Message-ID: <756efe9a-a237-e5d1-17fc-47936e76dacc@linux.alibaba.com> (raw)

I am trying to write a bpf program that supports multiple linux kernel 
versions. However, there are some differences in the definition of 
struct net in these multiple kernel versions.

Therefore, when we include a certain kernel version of vmlinux.h, the 
compilation error "error: no member named'proc_inum' in strut net" will 
appear.

However, when we include another kernel version of vmlinux.h, the 
compilation will appear "error: no member named'ns.inum' in strut net".

Anakryiko mentioned in the issue of libbpf/libbpf-bootstrap: vmlinux.h 
is just a convenient way to have most of kernel types defined for you, 
so that you don't have to re-define them manually. Link here: https: 
//github.com/libbpf/libbpf-bootstrap/issues/31#issuecomment-861035643

But struct net is a very huge structure, and it may be very difficult to 
add it manually. So, how can we avoid compilation errors like "error: no 
member named'xxx' in xxx"

             reply	other threads:[~2021-06-16  4:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16  4:06 Shuyi Cheng [this message]
2021-06-16  6:02 ` How to avoid compilation errors like "error: no member named xxx in strut xxx"? Andrii Nakryiko
2021-06-16  6:57   ` Shuyi Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=756efe9a-a237-e5d1-17fc-47936e76dacc@linux.alibaba.com \
    --to=chengshuyi@linux.alibaba.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kafai@fb.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.