netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: Networking <netdev@vger.kernel.org>,
	Shuah Khan <shuah@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Ilya Leoshkevich <iii@linux.ibm.com>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH net 1/2] selftests/bpf: Fix build error with ima_setup.sh
Date: Wed, 18 May 2022 15:36:53 -0700	[thread overview]
Message-ID: <CAEf4BzZhKpikBQFCEyRMmUHdTEt6xi+0ntfPswHA5WWK39cFjQ@mail.gmail.com> (raw)
In-Reply-To: <YoHKw/at89Wp19F/@Laptop-X1>

On Sun, May 15, 2022 at 8:53 PM Hangbin Liu <liuhangbin@gmail.com> wrote:
>
> On Fri, May 13, 2022 at 02:58:05PM -0700, Andrii Nakryiko wrote:
> > > -TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \
> > > -                      ima_setup.sh                                     \
> > > +TRUNNER_EXTRA_BUILD := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \
> > >                        $(wildcard progs/btf_dump_test_case_*.c)
> >
> >
> > note that progs/btf_dump_test_case_*.c are not built, they are just
> > copied over (C source files), so I don't think this fix is necessary.
> >
> > btw, I tried running `OUTPUT="/tmp/bpf" make test_progs` and it didn't
> > error out. But tbh, I'd recommend building everything instead of
> > building individual targets.
>
> After update the code to latest bpf-next. It works this time, the ima_setup.sh
> was copied to target folder correctly.
>
>   EXT-COPY [test_progs] urandom_read bpf_testmod.ko liburandom_read.so ima_setup.sh btf_dump_test_case_bitfields.c btf_dump_test_case_multidim.c btf_dump_test_case_namespacing.c btf_dump_test_case_ordering.c btf_dump_test_case_packing.c btf_dump_test_case_padding.c btf_dump_test_case_syntax.c
>   BINARY   test_progs
>
> Not sure why the previous kernel doesn't work. But anyway I will drop this patch.
>
> On the other hand, when I build with latest bpf-next. I got error like:
>
> """
> # OUTPUT="/tmp/bpf" make test_progs
>   BINARY   urandom_read                                                                                                                                                       gcc -g -O0 -rdynamic -Wall -Werror -DHAVE_GENHDR  -I/home/net/tools/testing/selftests/bpf -I/tmp/bpf/tools/include -I/home/net/include/generated -I/home/net/tools/lib -I/home/net/tools/include -I/home/net/tools/include/uapi -I/tmp/bpf  urandom_read.c urandom_read_aux.c  \
>           liburandom_read.so -lelf -lz -lrt -lpthread   \
>           -Wl,-rpath=. -Wl,--build-id=sha1 -o /tmp/bpf/urandom_read

we assume liburandom_read.so is going to be under selftests/bpf here,
but it's actually under $(OUTPUT)/

Can you try $(OUTPUT)/liburandom_read.so? I suspect this might break
-rpath=., though, but let's try this first?


> /usr/bin/ld: cannot find liburandom_read.so: No such file or directory                                                                                                        collect2: error: ld returned 1 exit status
> make: *** [Makefile:177: /tmp/bpf/urandom_read] Error 1
>
> # ls /tmp/bpf/liburandom_read.so
> /tmp/bpf/liburandom_read.so
> """
>
> after I copy to liburandom_read.so back to tools/testing/selftests/bpf the build
> success.
>
> """
> # cp /tmp/bpf/liburandom_read.so /home/net/tools/testing/selftests/bpf/
> # gcc -g -O0 -rdynamic -Wall -Werror -DHAVE_GENHDR -I/home/net/tools/testing/selftests/bpf -I/tmp/bpf/tools/include -I/home/net/include/generated -I/home/net/tools/lib -I/home/net/tools/include -I/home/net/tools/include/uapi -I/tmp/bpf  urandom_read.c urandom_read_aux.c liburandom_read.so -lelf -lz -lrt -lpthread -Wl,-rpath=. -Wl,--build-id=sha1 -o /tmp/bpf/urandom_read
> # echo $?
> 0
> """
>
> Do you know why this happens?
>
> Thanks
> Hangbin

  reply	other threads:[~2022-05-18 22:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12  7:18 [PATCH net 0/2] selftests/bpf: fix ima_setup.sh missing issue Hangbin Liu
2022-05-12  7:18 ` [PATCH net 1/2] selftests/bpf: Fix build error with ima_setup.sh Hangbin Liu
2022-05-13 21:58   ` Andrii Nakryiko
2022-05-16  3:53     ` Hangbin Liu
2022-05-18 22:36       ` Andrii Nakryiko [this message]
2022-05-19  2:44         ` Hangbin Liu
2022-05-20 22:58           ` Andrii Nakryiko
2022-05-12  7:18 ` [PATCH net 2/2] selftests/bpf: add missed ima_setup.sh in Makefile Hangbin Liu
2022-05-12 14:02 ` [PATCH net 0/2] selftests/bpf: fix ima_setup.sh missing issue Alexei Starovoitov

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=CAEf4BzZhKpikBQFCEyRMmUHdTEt6xi+0ntfPswHA5WWK39cFjQ@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=iii@linux.ibm.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).