bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* finding libelf
@ 2021-02-03  3:50 Randy Dunlap
  2021-02-03 10:57 ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2021-02-03  3:50 UTC (permalink / raw)
  To: bpf

Hi,

I see this sometimes when building a kernel: (on x86_64,
with today's linux-next 20210202):


CONFIG_CGROUP_BPF=y
CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
CONFIG_BPF_PRELOAD=y
CONFIG_BPF_PRELOAD_UMD=m
CONFIG_HAVE_EBPF_JIT=y


Auto-detecting system features:
...                        libelf: [ ^[[31mOFF^[[m ]
...                          zlib: [ ^[[31mOFF^[[m ]
...                           bpf: [ ^[[31mOFF^[[m ]

No libelf found
make[5]: [Makefile:287: elfdep] Error 1 (ignored)
No zlib found
make[5]: [Makefile:290: zdep] Error 1 (ignored)
BPF API too old
make[5]: [Makefile:293: bpfdep] Error 1 (ignored)


but pkg-config tells me:

$ pkg-config --modversion  libelf
0.168
$ pkg-config --libs  libelf
-lelf


Any ideas?

thanks.

-- 
~Randy


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03  3:50 finding libelf Randy Dunlap
@ 2021-02-03 10:57 ` Toke Høiland-Jørgensen
  2021-02-03 17:20   ` Randy Dunlap
  0 siblings, 1 reply; 16+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-02-03 10:57 UTC (permalink / raw)
  To: Randy Dunlap, bpf

Randy Dunlap <rdunlap@infradead.org> writes:

> Hi,
>
> I see this sometimes when building a kernel: (on x86_64,
> with today's linux-next 20210202):
>
>
> CONFIG_CGROUP_BPF=y
> CONFIG_BPF=y
> CONFIG_BPF_SYSCALL=y
> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
> CONFIG_BPF_PRELOAD=y
> CONFIG_BPF_PRELOAD_UMD=m
> CONFIG_HAVE_EBPF_JIT=y
>
>
> Auto-detecting system features:
> ...                        libelf: [ [31mOFF[m ]
> ...                          zlib: [ [31mOFF[m ]
> ...                           bpf: [ [31mOFF[m ]
>
> No libelf found
> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
> No zlib found
> make[5]: [Makefile:290: zdep] Error 1 (ignored)
> BPF API too old
> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
>
>
> but pkg-config tells me:
>
> $ pkg-config --modversion  libelf
> 0.168
> $ pkg-config --libs  libelf
> -lelf
>
>
> Any ideas?

This usually happens because there's a stale cache of the feature
detection tests lying around somewhere. Look for a 'feature' directory
in whatever subdir you got that error. Just removing the feature
directory usually fixes this; I've fixed a couple of places where this
is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
Make sure Makefile cleans up after itself, and add .gitignore")) but I
wouldn't be surprised if there are still some that are broken.

-Toke


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 10:57 ` Toke Høiland-Jørgensen
@ 2021-02-03 17:20   ` Randy Dunlap
  2021-02-03 19:39     ` Andrii Nakryiko
  0 siblings, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2021-02-03 17:20 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, bpf

On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
> Randy Dunlap <rdunlap@infradead.org> writes:
> 
>> Hi,
>>
>> I see this sometimes when building a kernel: (on x86_64,
>> with today's linux-next 20210202):
>>
>>
>> CONFIG_CGROUP_BPF=y
>> CONFIG_BPF=y
>> CONFIG_BPF_SYSCALL=y
>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
>> CONFIG_BPF_PRELOAD=y
>> CONFIG_BPF_PRELOAD_UMD=m
>> CONFIG_HAVE_EBPF_JIT=y
>>
>>
>> Auto-detecting system features:
>> ...                        libelf: [ [31mOFF[m ]
>> ...                          zlib: [ [31mOFF[m ]
>> ...                           bpf: [ [31mOFF[m ]
>>
>> No libelf found
>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
>> No zlib found
>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
>> BPF API too old
>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
>>
>>
>> but pkg-config tells me:
>>
>> $ pkg-config --modversion  libelf
>> 0.168
>> $ pkg-config --libs  libelf
>> -lelf
>>
>>
>> Any ideas?
> 
> This usually happens because there's a stale cache of the feature
> detection tests lying around somewhere. Look for a 'feature' directory
> in whatever subdir you got that error. Just removing the feature
> directory usually fixes this; I've fixed a couple of places where this
> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
> Make sure Makefile cleans up after itself, and add .gitignore")) but I
> wouldn't be surprised if there are still some that are broken.

Hi,

Thanks for replying.

I removed the feature subdir and still got this build error, so I
removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
and still got the same libelf build error.


-- 
~Randy


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 17:20   ` Randy Dunlap
@ 2021-02-03 19:39     ` Andrii Nakryiko
  2021-02-03 20:06       ` Andrii Nakryiko
  2021-02-03 20:09       ` Randy Dunlap
  0 siblings, 2 replies; 16+ messages in thread
From: Andrii Nakryiko @ 2021-02-03 19:39 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Toke Høiland-Jørgensen, bpf

On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
> > Randy Dunlap <rdunlap@infradead.org> writes:
> >
> >> Hi,
> >>
> >> I see this sometimes when building a kernel: (on x86_64,
> >> with today's linux-next 20210202):
> >>
> >>
> >> CONFIG_CGROUP_BPF=y
> >> CONFIG_BPF=y
> >> CONFIG_BPF_SYSCALL=y
> >> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
> >> CONFIG_BPF_PRELOAD=y
> >> CONFIG_BPF_PRELOAD_UMD=m
> >> CONFIG_HAVE_EBPF_JIT=y
> >>
> >>
> >> Auto-detecting system features:
> >> ...                        libelf: [ [31mOFF[m ]
> >> ...                          zlib: [ [31mOFF[m ]
> >> ...                           bpf: [ [31mOFF[m ]
> >>
> >> No libelf found
> >> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
> >> No zlib found
> >> make[5]: [Makefile:290: zdep] Error 1 (ignored)
> >> BPF API too old
> >> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
> >>
> >>
> >> but pkg-config tells me:
> >>
> >> $ pkg-config --modversion  libelf
> >> 0.168
> >> $ pkg-config --libs  libelf
> >> -lelf
> >>
> >>
> >> Any ideas?
> >
> > This usually happens because there's a stale cache of the feature
> > detection tests lying around somewhere. Look for a 'feature' directory
> > in whatever subdir you got that error. Just removing the feature
> > directory usually fixes this; I've fixed a couple of places where this
> > is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
> > Make sure Makefile cleans up after itself, and add .gitignore")) but I
> > wouldn't be surprised if there are still some that are broken.
>
> Hi,
>
> Thanks for replying.
>
> I removed the feature subdir and still got this build error, so I
> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
> and still got the same libelf build error.

I hate the complexity of feature detection framework to the point that
I'm willing to rip it out from libbpf's Makefile completely. I just
spent an hour trying to understand what's going on in a very similar
situation. Extremely frustrating.

In your case, it might be feature detection triggered from
resolve_btfids, so try removing
$(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.

It seems like we don't do proper cleanup in resolve_btfids (it should
probably call libbpf's clean as well). And it's beyond me why `make -C
tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
file as well.

>
>
> --
> ~Randy
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 19:39     ` Andrii Nakryiko
@ 2021-02-03 20:06       ` Andrii Nakryiko
  2021-02-03 20:33         ` Jiri Olsa
  2021-02-04 10:55         ` Jiri Olsa
  2021-02-03 20:09       ` Randy Dunlap
  1 sibling, 2 replies; 16+ messages in thread
From: Andrii Nakryiko @ 2021-02-03 20:06 UTC (permalink / raw)
  To: Randy Dunlap, Jiri Olsa; +Cc: Toke Høiland-Jørgensen, bpf

On Wed, Feb 3, 2021 at 11:39 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> >
> > On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
> > > Randy Dunlap <rdunlap@infradead.org> writes:
> > >
> > >> Hi,
> > >>
> > >> I see this sometimes when building a kernel: (on x86_64,
> > >> with today's linux-next 20210202):
> > >>
> > >>
> > >> CONFIG_CGROUP_BPF=y
> > >> CONFIG_BPF=y
> > >> CONFIG_BPF_SYSCALL=y
> > >> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
> > >> CONFIG_BPF_PRELOAD=y
> > >> CONFIG_BPF_PRELOAD_UMD=m
> > >> CONFIG_HAVE_EBPF_JIT=y
> > >>
> > >>
> > >> Auto-detecting system features:
> > >> ...                        libelf: [ [31mOFF[m ]
> > >> ...                          zlib: [ [31mOFF[m ]
> > >> ...                           bpf: [ [31mOFF[m ]
> > >>
> > >> No libelf found
> > >> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
> > >> No zlib found
> > >> make[5]: [Makefile:290: zdep] Error 1 (ignored)
> > >> BPF API too old
> > >> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
> > >>
> > >>
> > >> but pkg-config tells me:
> > >>
> > >> $ pkg-config --modversion  libelf
> > >> 0.168
> > >> $ pkg-config --libs  libelf
> > >> -lelf
> > >>
> > >>
> > >> Any ideas?
> > >
> > > This usually happens because there's a stale cache of the feature
> > > detection tests lying around somewhere. Look for a 'feature' directory
> > > in whatever subdir you got that error. Just removing the feature
> > > directory usually fixes this; I've fixed a couple of places where this
> > > is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
> > > Make sure Makefile cleans up after itself, and add .gitignore")) but I
> > > wouldn't be surprised if there are still some that are broken.
> >
> > Hi,
> >
> > Thanks for replying.
> >
> > I removed the feature subdir and still got this build error, so I
> > removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
> > and still got the same libelf build error.
>
> I hate the complexity of feature detection framework to the point that
> I'm willing to rip it out from libbpf's Makefile completely. I just
> spent an hour trying to understand what's going on in a very similar
> situation. Extremely frustrating.
>
> In your case, it might be feature detection triggered from
> resolve_btfids, so try removing
> $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
>
> It seems like we don't do proper cleanup in resolve_btfids (it should
> probably call libbpf's clean as well). And it's beyond me why `make -C
> tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
> file as well.

So resolve_btfids does call libbpf's clean, but Linux Kbuild never
calls resolve_btfids' clean. Jiri, do you think that could be
improved? Basically, if something goes wrong with feature detection,
no amount of `make clean` would help and users will be forced to
struggle with frustrating experience trying to understand what's going
on.

I also still think that FEATURE-DUMP should be cleaned up by feature
infra on clean and that's not happening today, but I'm unwilling to go
and untangle all that complexity right now.

>
> >
> >
> > --
> > ~Randy
> >

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 19:39     ` Andrii Nakryiko
  2021-02-03 20:06       ` Andrii Nakryiko
@ 2021-02-03 20:09       ` Randy Dunlap
  2021-02-03 20:12         ` Andrii Nakryiko
  1 sibling, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2021-02-03 20:09 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: Toke Høiland-Jørgensen, bpf

On 2/3/21 11:39 AM, Andrii Nakryiko wrote:
> On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
>>> Randy Dunlap <rdunlap@infradead.org> writes:
>>>
>>>> Hi,
>>>>
>>>> I see this sometimes when building a kernel: (on x86_64,
>>>> with today's linux-next 20210202):
>>>>
>>>>
>>>> CONFIG_CGROUP_BPF=y
>>>> CONFIG_BPF=y
>>>> CONFIG_BPF_SYSCALL=y
>>>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
>>>> CONFIG_BPF_PRELOAD=y
>>>> CONFIG_BPF_PRELOAD_UMD=m
>>>> CONFIG_HAVE_EBPF_JIT=y
>>>>
>>>>
>>>> Auto-detecting system features:
>>>> ...                        libelf: [ [31mOFF[m ]
>>>> ...                          zlib: [ [31mOFF[m ]
>>>> ...                           bpf: [ [31mOFF[m ]
>>>>
>>>> No libelf found
>>>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
>>>> No zlib found
>>>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
>>>> BPF API too old
>>>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
>>>>
>>>>
>>>> but pkg-config tells me:
>>>>
>>>> $ pkg-config --modversion  libelf
>>>> 0.168
>>>> $ pkg-config --libs  libelf
>>>> -lelf
>>>>
>>>>
>>>> Any ideas?
>>>
>>> This usually happens because there's a stale cache of the feature
>>> detection tests lying around somewhere. Look for a 'feature' directory
>>> in whatever subdir you got that error. Just removing the feature
>>> directory usually fixes this; I've fixed a couple of places where this
>>> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
>>> Make sure Makefile cleans up after itself, and add .gitignore")) but I
>>> wouldn't be surprised if there are still some that are broken.
>>
>> Hi,
>>
>> Thanks for replying.
>>
>> I removed the feature subdir and still got this build error, so I
>> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
>> and still got the same libelf build error.
> 
> I hate the complexity of feature detection framework to the point that
> I'm willing to rip it out from libbpf's Makefile completely. I just
> spent an hour trying to understand what's going on in a very similar
> situation. Extremely frustrating.
> 
> In your case, it might be feature detection triggered from
> resolve_btfids, so try removing
> $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
> 
> It seems like we don't do proper cleanup in resolve_btfids (it should
> probably call libbpf's clean as well). And it's beyond me why `make -C
> tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
> file as well.


I don't think it's related to improper cleanup or old files/dirs
laying around. I say that because I did a full build in a new output dir.
and it still failed in the same way.

-- 
~Randy


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:09       ` Randy Dunlap
@ 2021-02-03 20:12         ` Andrii Nakryiko
  2021-02-03 20:14           ` Randy Dunlap
  0 siblings, 1 reply; 16+ messages in thread
From: Andrii Nakryiko @ 2021-02-03 20:12 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Toke Høiland-Jørgensen, bpf

On Wed, Feb 3, 2021 at 12:09 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 2/3/21 11:39 AM, Andrii Nakryiko wrote:
> > On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>
> >> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
> >>> Randy Dunlap <rdunlap@infradead.org> writes:
> >>>
> >>>> Hi,
> >>>>
> >>>> I see this sometimes when building a kernel: (on x86_64,
> >>>> with today's linux-next 20210202):
> >>>>
> >>>>
> >>>> CONFIG_CGROUP_BPF=y
> >>>> CONFIG_BPF=y
> >>>> CONFIG_BPF_SYSCALL=y
> >>>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
> >>>> CONFIG_BPF_PRELOAD=y
> >>>> CONFIG_BPF_PRELOAD_UMD=m
> >>>> CONFIG_HAVE_EBPF_JIT=y
> >>>>
> >>>>
> >>>> Auto-detecting system features:
> >>>> ...                        libelf: [ [31mOFF[m ]
> >>>> ...                          zlib: [ [31mOFF[m ]
> >>>> ...                           bpf: [ [31mOFF[m ]
> >>>>
> >>>> No libelf found
> >>>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
> >>>> No zlib found
> >>>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
> >>>> BPF API too old
> >>>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
> >>>>
> >>>>
> >>>> but pkg-config tells me:
> >>>>
> >>>> $ pkg-config --modversion  libelf
> >>>> 0.168
> >>>> $ pkg-config --libs  libelf
> >>>> -lelf
> >>>>
> >>>>
> >>>> Any ideas?
> >>>
> >>> This usually happens because there's a stale cache of the feature
> >>> detection tests lying around somewhere. Look for a 'feature' directory
> >>> in whatever subdir you got that error. Just removing the feature
> >>> directory usually fixes this; I've fixed a couple of places where this
> >>> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
> >>> Make sure Makefile cleans up after itself, and add .gitignore")) but I
> >>> wouldn't be surprised if there are still some that are broken.
> >>
> >> Hi,
> >>
> >> Thanks for replying.
> >>
> >> I removed the feature subdir and still got this build error, so I
> >> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
> >> and still got the same libelf build error.
> >
> > I hate the complexity of feature detection framework to the point that
> > I'm willing to rip it out from libbpf's Makefile completely. I just
> > spent an hour trying to understand what's going on in a very similar
> > situation. Extremely frustrating.
> >
> > In your case, it might be feature detection triggered from
> > resolve_btfids, so try removing
> > $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
> >
> > It seems like we don't do proper cleanup in resolve_btfids (it should
> > probably call libbpf's clean as well). And it's beyond me why `make -C
> > tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
> > file as well.
>
>
> I don't think it's related to improper cleanup or old files/dirs
> laying around. I say that because I did a full build in a new output dir.
> and it still failed in the same way.

If you cd tools/lib/bpf and run make there, does it detect those libraries?

>
> --
> ~Randy
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:12         ` Andrii Nakryiko
@ 2021-02-03 20:14           ` Randy Dunlap
  2021-02-03 20:33             ` Andrii Nakryiko
  0 siblings, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2021-02-03 20:14 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: Toke Høiland-Jørgensen, bpf

On 2/3/21 12:12 PM, Andrii Nakryiko wrote:
> On Wed, Feb 3, 2021 at 12:09 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>> On 2/3/21 11:39 AM, Andrii Nakryiko wrote:
>>> On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>
>>>> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
>>>>> Randy Dunlap <rdunlap@infradead.org> writes:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I see this sometimes when building a kernel: (on x86_64,
>>>>>> with today's linux-next 20210202):
>>>>>>
>>>>>>
>>>>>> CONFIG_CGROUP_BPF=y
>>>>>> CONFIG_BPF=y
>>>>>> CONFIG_BPF_SYSCALL=y
>>>>>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
>>>>>> CONFIG_BPF_PRELOAD=y
>>>>>> CONFIG_BPF_PRELOAD_UMD=m
>>>>>> CONFIG_HAVE_EBPF_JIT=y
>>>>>>
>>>>>>
>>>>>> Auto-detecting system features:
>>>>>> ...                        libelf: [ [31mOFF[m ]
>>>>>> ...                          zlib: [ [31mOFF[m ]
>>>>>> ...                           bpf: [ [31mOFF[m ]
>>>>>>
>>>>>> No libelf found
>>>>>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
>>>>>> No zlib found
>>>>>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
>>>>>> BPF API too old
>>>>>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
>>>>>>
>>>>>>
>>>>>> but pkg-config tells me:
>>>>>>
>>>>>> $ pkg-config --modversion  libelf
>>>>>> 0.168
>>>>>> $ pkg-config --libs  libelf
>>>>>> -lelf
>>>>>>
>>>>>>
>>>>>> Any ideas?
>>>>>
>>>>> This usually happens because there's a stale cache of the feature
>>>>> detection tests lying around somewhere. Look for a 'feature' directory
>>>>> in whatever subdir you got that error. Just removing the feature
>>>>> directory usually fixes this; I've fixed a couple of places where this
>>>>> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
>>>>> Make sure Makefile cleans up after itself, and add .gitignore")) but I
>>>>> wouldn't be surprised if there are still some that are broken.
>>>>
>>>> Hi,
>>>>
>>>> Thanks for replying.
>>>>
>>>> I removed the feature subdir and still got this build error, so I
>>>> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
>>>> and still got the same libelf build error.
>>>
>>> I hate the complexity of feature detection framework to the point that
>>> I'm willing to rip it out from libbpf's Makefile completely. I just
>>> spent an hour trying to understand what's going on in a very similar
>>> situation. Extremely frustrating.
>>>
>>> In your case, it might be feature detection triggered from
>>> resolve_btfids, so try removing
>>> $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
>>>
>>> It seems like we don't do proper cleanup in resolve_btfids (it should
>>> probably call libbpf's clean as well). And it's beyond me why `make -C
>>> tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
>>> file as well.
>>
>>
>> I don't think it's related to improper cleanup or old files/dirs
>> laying around. I say that because I did a full build in a new output dir.
>> and it still failed in the same way.
> 
> If you cd tools/lib/bpf and run make there, does it detect those libraries?

Yes:

Auto-detecting system features:
...                        libelf: [ on  ]
...                          zlib: [ on  ]
...                           bpf: [ on  ]


-- 
~Randy


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:14           ` Randy Dunlap
@ 2021-02-03 20:33             ` Andrii Nakryiko
  2021-02-03 20:36               ` Randy Dunlap
  0 siblings, 1 reply; 16+ messages in thread
From: Andrii Nakryiko @ 2021-02-03 20:33 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Toke Høiland-Jørgensen, bpf

On Wed, Feb 3, 2021 at 12:15 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 2/3/21 12:12 PM, Andrii Nakryiko wrote:
> > On Wed, Feb 3, 2021 at 12:09 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>
> >> On 2/3/21 11:39 AM, Andrii Nakryiko wrote:
> >>> On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>>>
> >>>> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
> >>>>> Randy Dunlap <rdunlap@infradead.org> writes:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I see this sometimes when building a kernel: (on x86_64,
> >>>>>> with today's linux-next 20210202):
> >>>>>>
> >>>>>>
> >>>>>> CONFIG_CGROUP_BPF=y
> >>>>>> CONFIG_BPF=y
> >>>>>> CONFIG_BPF_SYSCALL=y
> >>>>>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
> >>>>>> CONFIG_BPF_PRELOAD=y
> >>>>>> CONFIG_BPF_PRELOAD_UMD=m
> >>>>>> CONFIG_HAVE_EBPF_JIT=y
> >>>>>>
> >>>>>>
> >>>>>> Auto-detecting system features:
> >>>>>> ...                        libelf: [ [31mOFF[m ]
> >>>>>> ...                          zlib: [ [31mOFF[m ]
> >>>>>> ...                           bpf: [ [31mOFF[m ]
> >>>>>>
> >>>>>> No libelf found
> >>>>>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
> >>>>>> No zlib found
> >>>>>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
> >>>>>> BPF API too old
> >>>>>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
> >>>>>>
> >>>>>>
> >>>>>> but pkg-config tells me:
> >>>>>>
> >>>>>> $ pkg-config --modversion  libelf
> >>>>>> 0.168
> >>>>>> $ pkg-config --libs  libelf
> >>>>>> -lelf
> >>>>>>
> >>>>>>
> >>>>>> Any ideas?
> >>>>>
> >>>>> This usually happens because there's a stale cache of the feature
> >>>>> detection tests lying around somewhere. Look for a 'feature' directory
> >>>>> in whatever subdir you got that error. Just removing the feature
> >>>>> directory usually fixes this; I've fixed a couple of places where this
> >>>>> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
> >>>>> Make sure Makefile cleans up after itself, and add .gitignore")) but I
> >>>>> wouldn't be surprised if there are still some that are broken.
> >>>>
> >>>> Hi,
> >>>>
> >>>> Thanks for replying.
> >>>>
> >>>> I removed the feature subdir and still got this build error, so I
> >>>> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
> >>>> and still got the same libelf build error.
> >>>
> >>> I hate the complexity of feature detection framework to the point that
> >>> I'm willing to rip it out from libbpf's Makefile completely. I just
> >>> spent an hour trying to understand what's going on in a very similar
> >>> situation. Extremely frustrating.
> >>>
> >>> In your case, it might be feature detection triggered from
> >>> resolve_btfids, so try removing
> >>> $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
> >>>
> >>> It seems like we don't do proper cleanup in resolve_btfids (it should
> >>> probably call libbpf's clean as well). And it's beyond me why `make -C
> >>> tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
> >>> file as well.
> >>
> >>
> >> I don't think it's related to improper cleanup or old files/dirs
> >> laying around. I say that because I did a full build in a new output dir.
> >> and it still failed in the same way.
> >
> > If you cd tools/lib/bpf and run make there, does it detect those libraries?
>
> Yes:
>
> Auto-detecting system features:
> ...                        libelf: [ on  ]
> ...                          zlib: [ on  ]
> ...                           bpf: [ on  ]
>
>

Sounds exactly like my case. I removed
$(O)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf} and it
started working.

> --
> ~Randy
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:06       ` Andrii Nakryiko
@ 2021-02-03 20:33         ` Jiri Olsa
  2021-02-04 10:55         ` Jiri Olsa
  1 sibling, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2021-02-03 20:33 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Randy Dunlap, Jiri Olsa, Toke Høiland-Jørgensen, bpf

On Wed, Feb 03, 2021 at 12:06:10PM -0800, Andrii Nakryiko wrote:
> On Wed, Feb 3, 2021 at 11:39 AM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
> >
> > On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > >
> > > On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
> > > > Randy Dunlap <rdunlap@infradead.org> writes:
> > > >
> > > >> Hi,
> > > >>
> > > >> I see this sometimes when building a kernel: (on x86_64,
> > > >> with today's linux-next 20210202):
> > > >>
> > > >>
> > > >> CONFIG_CGROUP_BPF=y
> > > >> CONFIG_BPF=y
> > > >> CONFIG_BPF_SYSCALL=y
> > > >> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
> > > >> CONFIG_BPF_PRELOAD=y
> > > >> CONFIG_BPF_PRELOAD_UMD=m
> > > >> CONFIG_HAVE_EBPF_JIT=y
> > > >>
> > > >>
> > > >> Auto-detecting system features:
> > > >> ...                        libelf: [ [31mOFF[m ]
> > > >> ...                          zlib: [ [31mOFF[m ]
> > > >> ...                           bpf: [ [31mOFF[m ]
> > > >>
> > > >> No libelf found
> > > >> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
> > > >> No zlib found
> > > >> make[5]: [Makefile:290: zdep] Error 1 (ignored)
> > > >> BPF API too old
> > > >> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
> > > >>
> > > >>
> > > >> but pkg-config tells me:
> > > >>
> > > >> $ pkg-config --modversion  libelf
> > > >> 0.168
> > > >> $ pkg-config --libs  libelf
> > > >> -lelf
> > > >>
> > > >>
> > > >> Any ideas?
> > > >
> > > > This usually happens because there's a stale cache of the feature
> > > > detection tests lying around somewhere. Look for a 'feature' directory
> > > > in whatever subdir you got that error. Just removing the feature
> > > > directory usually fixes this; I've fixed a couple of places where this
> > > > is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
> > > > Make sure Makefile cleans up after itself, and add .gitignore")) but I
> > > > wouldn't be surprised if there are still some that are broken.
> > >
> > > Hi,
> > >
> > > Thanks for replying.
> > >
> > > I removed the feature subdir and still got this build error, so I
> > > removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
> > > and still got the same libelf build error.
> >
> > I hate the complexity of feature detection framework to the point that
> > I'm willing to rip it out from libbpf's Makefile completely. I just
> > spent an hour trying to understand what's going on in a very similar
> > situation. Extremely frustrating.
> >
> > In your case, it might be feature detection triggered from
> > resolve_btfids, so try removing
> > $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
> >
> > It seems like we don't do proper cleanup in resolve_btfids (it should
> > probably call libbpf's clean as well). And it's beyond me why `make -C
> > tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
> > file as well.
> 
> So resolve_btfids does call libbpf's clean, but Linux Kbuild never
> calls resolve_btfids' clean. Jiri, do you think that could be
> improved? Basically, if something goes wrong with feature detection,
> no amount of `make clean` would help and users will be forced to
> struggle with frustrating experience trying to understand what's going
> on.

ok, that one is missing.. will add

> 
> I also still think that FEATURE-DUMP should be cleaned up by feature
> infra on clean and that's not happening today, but I'm unwilling to go
> and untangle all that complexity right now.

I haven't seen this error for some time so I thought we got rid of it,
I'll try to reproduce and fix

jirka


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:33             ` Andrii Nakryiko
@ 2021-02-03 20:36               ` Randy Dunlap
  2021-02-03 20:41                 ` Randy Dunlap
  2021-02-03 20:41                 ` Andrii Nakryiko
  0 siblings, 2 replies; 16+ messages in thread
From: Randy Dunlap @ 2021-02-03 20:36 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: Toke Høiland-Jørgensen, bpf

On 2/3/21 12:33 PM, Andrii Nakryiko wrote:
> On Wed, Feb 3, 2021 at 12:15 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>> On 2/3/21 12:12 PM, Andrii Nakryiko wrote:
>>> On Wed, Feb 3, 2021 at 12:09 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>
>>>> On 2/3/21 11:39 AM, Andrii Nakryiko wrote:
>>>>> On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>>>
>>>>>> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
>>>>>>> Randy Dunlap <rdunlap@infradead.org> writes:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I see this sometimes when building a kernel: (on x86_64,
>>>>>>>> with today's linux-next 20210202):
>>>>>>>>
>>>>>>>>
>>>>>>>> CONFIG_CGROUP_BPF=y
>>>>>>>> CONFIG_BPF=y
>>>>>>>> CONFIG_BPF_SYSCALL=y
>>>>>>>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
>>>>>>>> CONFIG_BPF_PRELOAD=y
>>>>>>>> CONFIG_BPF_PRELOAD_UMD=m
>>>>>>>> CONFIG_HAVE_EBPF_JIT=y
>>>>>>>>
>>>>>>>>
>>>>>>>> Auto-detecting system features:
>>>>>>>> ...                        libelf: [ [31mOFF[m ]
>>>>>>>> ...                          zlib: [ [31mOFF[m ]
>>>>>>>> ...                           bpf: [ [31mOFF[m ]
>>>>>>>>
>>>>>>>> No libelf found
>>>>>>>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
>>>>>>>> No zlib found
>>>>>>>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
>>>>>>>> BPF API too old
>>>>>>>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
>>>>>>>>
>>>>>>>>
>>>>>>>> but pkg-config tells me:
>>>>>>>>
>>>>>>>> $ pkg-config --modversion  libelf
>>>>>>>> 0.168
>>>>>>>> $ pkg-config --libs  libelf
>>>>>>>> -lelf
>>>>>>>>
>>>>>>>>
>>>>>>>> Any ideas?
>>>>>>>
>>>>>>> This usually happens because there's a stale cache of the feature
>>>>>>> detection tests lying around somewhere. Look for a 'feature' directory
>>>>>>> in whatever subdir you got that error. Just removing the feature
>>>>>>> directory usually fixes this; I've fixed a couple of places where this
>>>>>>> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
>>>>>>> Make sure Makefile cleans up after itself, and add .gitignore")) but I
>>>>>>> wouldn't be surprised if there are still some that are broken.
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Thanks for replying.
>>>>>>
>>>>>> I removed the feature subdir and still got this build error, so I
>>>>>> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
>>>>>> and still got the same libelf build error.
>>>>>
>>>>> I hate the complexity of feature detection framework to the point that
>>>>> I'm willing to rip it out from libbpf's Makefile completely. I just
>>>>> spent an hour trying to understand what's going on in a very similar
>>>>> situation. Extremely frustrating.
>>>>>
>>>>> In your case, it might be feature detection triggered from
>>>>> resolve_btfids, so try removing
>>>>> $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
>>>>>
>>>>> It seems like we don't do proper cleanup in resolve_btfids (it should
>>>>> probably call libbpf's clean as well). And it's beyond me why `make -C
>>>>> tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
>>>>> file as well.
>>>>
>>>>
>>>> I don't think it's related to improper cleanup or old files/dirs
>>>> laying around. I say that because I did a full build in a new output dir.
>>>> and it still failed in the same way.
>>>
>>> If you cd tools/lib/bpf and run make there, does it detect those libraries?
>>
>> Yes:
>>
>> Auto-detecting system features:
>> ...                        libelf: [ on  ]
>> ...                          zlib: [ on  ]
>> ...                           bpf: [ on  ]
>>
>>
> 
> Sounds exactly like my case. I removed
> $(O)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf} and it
> started working.

I already tried that with no success.

I suppose that it could be related to how I do builds:

make ARCH=x86_64 O=subdir -j4 all

so subdir is a relative path, not an absolute path.

-- 
~Randy


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:36               ` Randy Dunlap
@ 2021-02-03 20:41                 ` Randy Dunlap
  2021-02-03 20:41                 ` Andrii Nakryiko
  1 sibling, 0 replies; 16+ messages in thread
From: Randy Dunlap @ 2021-02-03 20:41 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: Toke Høiland-Jørgensen, bpf

On 2/3/21 12:36 PM, Randy Dunlap wrote:
> On 2/3/21 12:33 PM, Andrii Nakryiko wrote:
>> On Wed, Feb 3, 2021 at 12:15 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>
>>> On 2/3/21 12:12 PM, Andrii Nakryiko wrote:
>>>> On Wed, Feb 3, 2021 at 12:09 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>>
>>>>> On 2/3/21 11:39 AM, Andrii Nakryiko wrote:
>>>>>> On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>>>>
>>>>>>> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
>>>>>>>> Randy Dunlap <rdunlap@infradead.org> writes:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I see this sometimes when building a kernel: (on x86_64,
>>>>>>>>> with today's linux-next 20210202):
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> CONFIG_CGROUP_BPF=y
>>>>>>>>> CONFIG_BPF=y
>>>>>>>>> CONFIG_BPF_SYSCALL=y
>>>>>>>>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
>>>>>>>>> CONFIG_BPF_PRELOAD=y
>>>>>>>>> CONFIG_BPF_PRELOAD_UMD=m
>>>>>>>>> CONFIG_HAVE_EBPF_JIT=y
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Auto-detecting system features:
>>>>>>>>> ...                        libelf: [ [31mOFF[m ]
>>>>>>>>> ...                          zlib: [ [31mOFF[m ]
>>>>>>>>> ...                           bpf: [ [31mOFF[m ]
>>>>>>>>>
>>>>>>>>> No libelf found
>>>>>>>>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
>>>>>>>>> No zlib found
>>>>>>>>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
>>>>>>>>> BPF API too old
>>>>>>>>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> but pkg-config tells me:
>>>>>>>>>
>>>>>>>>> $ pkg-config --modversion  libelf
>>>>>>>>> 0.168
>>>>>>>>> $ pkg-config --libs  libelf
>>>>>>>>> -lelf
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Any ideas?
>>>>>>>>
>>>>>>>> This usually happens because there's a stale cache of the feature
>>>>>>>> detection tests lying around somewhere. Look for a 'feature' directory
>>>>>>>> in whatever subdir you got that error. Just removing the feature
>>>>>>>> directory usually fixes this; I've fixed a couple of places where this
>>>>>>>> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
>>>>>>>> Make sure Makefile cleans up after itself, and add .gitignore")) but I
>>>>>>>> wouldn't be surprised if there are still some that are broken.
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Thanks for replying.
>>>>>>>
>>>>>>> I removed the feature subdir and still got this build error, so I
>>>>>>> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
>>>>>>> and still got the same libelf build error.
>>>>>>
>>>>>> I hate the complexity of feature detection framework to the point that
>>>>>> I'm willing to rip it out from libbpf's Makefile completely. I just
>>>>>> spent an hour trying to understand what's going on in a very similar
>>>>>> situation. Extremely frustrating.
>>>>>>
>>>>>> In your case, it might be feature detection triggered from
>>>>>> resolve_btfids, so try removing
>>>>>> $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
>>>>>>
>>>>>> It seems like we don't do proper cleanup in resolve_btfids (it should
>>>>>> probably call libbpf's clean as well). And it's beyond me why `make -C
>>>>>> tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
>>>>>> file as well.
>>>>>
>>>>>
>>>>> I don't think it's related to improper cleanup or old files/dirs
>>>>> laying around. I say that because I did a full build in a new output dir.
>>>>> and it still failed in the same way.
>>>>
>>>> If you cd tools/lib/bpf and run make there, does it detect those libraries?
>>>
>>> Yes:
>>>
>>> Auto-detecting system features:
>>> ...                        libelf: [ on  ]
>>> ...                          zlib: [ on  ]
>>> ...                           bpf: [ on  ]
>>>
>>>
>>
>> Sounds exactly like my case. I removed
>> $(O)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf} and it
>> started working.

In fact, with my build description [below], there is no
$(O)/tools/bpf/* created at all, so there is nothing
to remove.


> I already tried that with no success.
> 
> I suppose that it could be related to how I do builds:
> 
> make ARCH=x86_64 O=subdir -j4 all
> 
> so subdir is a relative path, not an absolute path.
> 


-- 
~Randy


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:36               ` Randy Dunlap
  2021-02-03 20:41                 ` Randy Dunlap
@ 2021-02-03 20:41                 ` Andrii Nakryiko
  2021-02-03 20:57                   ` Randy Dunlap
  1 sibling, 1 reply; 16+ messages in thread
From: Andrii Nakryiko @ 2021-02-03 20:41 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Toke Høiland-Jørgensen, bpf

On Wed, Feb 3, 2021 at 12:36 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 2/3/21 12:33 PM, Andrii Nakryiko wrote:
> > On Wed, Feb 3, 2021 at 12:15 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>
> >> On 2/3/21 12:12 PM, Andrii Nakryiko wrote:
> >>> On Wed, Feb 3, 2021 at 12:09 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>>>
> >>>> On 2/3/21 11:39 AM, Andrii Nakryiko wrote:
> >>>>> On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>>>>>
> >>>>>> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
> >>>>>>> Randy Dunlap <rdunlap@infradead.org> writes:
> >>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> I see this sometimes when building a kernel: (on x86_64,
> >>>>>>>> with today's linux-next 20210202):
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> CONFIG_CGROUP_BPF=y
> >>>>>>>> CONFIG_BPF=y
> >>>>>>>> CONFIG_BPF_SYSCALL=y
> >>>>>>>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
> >>>>>>>> CONFIG_BPF_PRELOAD=y
> >>>>>>>> CONFIG_BPF_PRELOAD_UMD=m
> >>>>>>>> CONFIG_HAVE_EBPF_JIT=y
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Auto-detecting system features:
> >>>>>>>> ...                        libelf: [ [31mOFF[m ]
> >>>>>>>> ...                          zlib: [ [31mOFF[m ]
> >>>>>>>> ...                           bpf: [ [31mOFF[m ]
> >>>>>>>>
> >>>>>>>> No libelf found
> >>>>>>>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
> >>>>>>>> No zlib found
> >>>>>>>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
> >>>>>>>> BPF API too old
> >>>>>>>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> but pkg-config tells me:
> >>>>>>>>
> >>>>>>>> $ pkg-config --modversion  libelf
> >>>>>>>> 0.168
> >>>>>>>> $ pkg-config --libs  libelf
> >>>>>>>> -lelf
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Any ideas?
> >>>>>>>
> >>>>>>> This usually happens because there's a stale cache of the feature
> >>>>>>> detection tests lying around somewhere. Look for a 'feature' directory
> >>>>>>> in whatever subdir you got that error. Just removing the feature
> >>>>>>> directory usually fixes this; I've fixed a couple of places where this
> >>>>>>> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
> >>>>>>> Make sure Makefile cleans up after itself, and add .gitignore")) but I
> >>>>>>> wouldn't be surprised if there are still some that are broken.
> >>>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> Thanks for replying.
> >>>>>>
> >>>>>> I removed the feature subdir and still got this build error, so I
> >>>>>> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
> >>>>>> and still got the same libelf build error.
> >>>>>
> >>>>> I hate the complexity of feature detection framework to the point that
> >>>>> I'm willing to rip it out from libbpf's Makefile completely. I just
> >>>>> spent an hour trying to understand what's going on in a very similar
> >>>>> situation. Extremely frustrating.
> >>>>>
> >>>>> In your case, it might be feature detection triggered from
> >>>>> resolve_btfids, so try removing
> >>>>> $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
> >>>>>
> >>>>> It seems like we don't do proper cleanup in resolve_btfids (it should
> >>>>> probably call libbpf's clean as well). And it's beyond me why `make -C
> >>>>> tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
> >>>>> file as well.
> >>>>
> >>>>
> >>>> I don't think it's related to improper cleanup or old files/dirs
> >>>> laying around. I say that because I did a full build in a new output dir.
> >>>> and it still failed in the same way.
> >>>
> >>> If you cd tools/lib/bpf and run make there, does it detect those libraries?
> >>
> >> Yes:
> >>
> >> Auto-detecting system features:
> >> ...                        libelf: [ on  ]
> >> ...                          zlib: [ on  ]
> >> ...                           bpf: [ on  ]
> >>
> >>
> >
> > Sounds exactly like my case. I removed
> > $(O)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf} and it
> > started working.
>
> I already tried that with no success.
>
> I suppose that it could be related to how I do builds:
>
> make ARCH=x86_64 O=subdir -j4 all
>
> so subdir is a relative path, not an absolute path.

so can you confirm this by specifying the absolute path to subdir?

>
> --
> ~Randy
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:41                 ` Andrii Nakryiko
@ 2021-02-03 20:57                   ` Randy Dunlap
  2021-02-03 21:31                     ` Andrii Nakryiko
  0 siblings, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2021-02-03 20:57 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: Toke Høiland-Jørgensen, bpf

On 2/3/21 12:41 PM, Andrii Nakryiko wrote:
> On Wed, Feb 3, 2021 at 12:36 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>> On 2/3/21 12:33 PM, Andrii Nakryiko wrote:
>>> On Wed, Feb 3, 2021 at 12:15 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>
>>>> On 2/3/21 12:12 PM, Andrii Nakryiko wrote:
>>>>> On Wed, Feb 3, 2021 at 12:09 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>>>
>>>>>> On 2/3/21 11:39 AM, Andrii Nakryiko wrote:
>>>>>>> On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>>>>>
>>>>>>>> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
>>>>>>>>> Randy Dunlap <rdunlap@infradead.org> writes:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I see this sometimes when building a kernel: (on x86_64,
>>>>>>>>>> with today's linux-next 20210202):
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> CONFIG_CGROUP_BPF=y
>>>>>>>>>> CONFIG_BPF=y
>>>>>>>>>> CONFIG_BPF_SYSCALL=y
>>>>>>>>>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
>>>>>>>>>> CONFIG_BPF_PRELOAD=y
>>>>>>>>>> CONFIG_BPF_PRELOAD_UMD=m
>>>>>>>>>> CONFIG_HAVE_EBPF_JIT=y
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Auto-detecting system features:
>>>>>>>>>> ...                        libelf: [ [31mOFF[m ]
>>>>>>>>>> ...                          zlib: [ [31mOFF[m ]
>>>>>>>>>> ...                           bpf: [ [31mOFF[m ]
>>>>>>>>>>
>>>>>>>>>> No libelf found
>>>>>>>>>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
>>>>>>>>>> No zlib found
>>>>>>>>>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
>>>>>>>>>> BPF API too old
>>>>>>>>>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> but pkg-config tells me:
>>>>>>>>>>
>>>>>>>>>> $ pkg-config --modversion  libelf
>>>>>>>>>> 0.168
>>>>>>>>>> $ pkg-config --libs  libelf
>>>>>>>>>> -lelf
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Any ideas?
>>>>>>>>>
>>>>>>>>> This usually happens because there's a stale cache of the feature
>>>>>>>>> detection tests lying around somewhere. Look for a 'feature' directory
>>>>>>>>> in whatever subdir you got that error. Just removing the feature
>>>>>>>>> directory usually fixes this; I've fixed a couple of places where this
>>>>>>>>> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
>>>>>>>>> Make sure Makefile cleans up after itself, and add .gitignore")) but I
>>>>>>>>> wouldn't be surprised if there are still some that are broken.
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Thanks for replying.
>>>>>>>>
>>>>>>>> I removed the feature subdir and still got this build error, so I
>>>>>>>> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
>>>>>>>> and still got the same libelf build error.
>>>>>>>
>>>>>>> I hate the complexity of feature detection framework to the point that
>>>>>>> I'm willing to rip it out from libbpf's Makefile completely. I just
>>>>>>> spent an hour trying to understand what's going on in a very similar
>>>>>>> situation. Extremely frustrating.
>>>>>>>
>>>>>>> In your case, it might be feature detection triggered from
>>>>>>> resolve_btfids, so try removing
>>>>>>> $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
>>>>>>>
>>>>>>> It seems like we don't do proper cleanup in resolve_btfids (it should
>>>>>>> probably call libbpf's clean as well). And it's beyond me why `make -C
>>>>>>> tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
>>>>>>> file as well.
>>>>>>
>>>>>>
>>>>>> I don't think it's related to improper cleanup or old files/dirs
>>>>>> laying around. I say that because I did a full build in a new output dir.
>>>>>> and it still failed in the same way.
>>>>>
>>>>> If you cd tools/lib/bpf and run make there, does it detect those libraries?
>>>>
>>>> Yes:
>>>>
>>>> Auto-detecting system features:
>>>> ...                        libelf: [ on  ]
>>>> ...                          zlib: [ on  ]
>>>> ...                           bpf: [ on  ]
>>>>
>>>>
>>>
>>> Sounds exactly like my case. I removed
>>> $(O)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf} and it
>>> started working.
>>
>> I already tried that with no success.
>>
>> I suppose that it could be related to how I do builds:
>>
>> make ARCH=x86_64 O=subdir -j4 all
>>
>> so subdir is a relative path, not an absolute path.
> 
> so can you confirm this by specifying the absolute path to subdir?

Yes, absolute output path works for libelf, zlib, and bpf:

Auto-detecting system features:
...                        libelf: [ ^[[32mon^[[m  ]
...                          zlib: [ ^[[32mon^[[m  ]
...                           bpf: [ ^[[32mon^[[m  ]


Are {feature,FEATURE-DUMP} created in multiple places?
I don't see them in $(OUTDIR)/tools -- there is no /bpf/ subdir there
at all.
I do see them in $(OUTDIR)/kernel/bpf/preload/ -- are those different
feature files?


thanks.
-- 
~Randy


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:57                   ` Randy Dunlap
@ 2021-02-03 21:31                     ` Andrii Nakryiko
  0 siblings, 0 replies; 16+ messages in thread
From: Andrii Nakryiko @ 2021-02-03 21:31 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Toke Høiland-Jørgensen, bpf

On Wed, Feb 3, 2021 at 12:57 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 2/3/21 12:41 PM, Andrii Nakryiko wrote:
> > On Wed, Feb 3, 2021 at 12:36 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>
> >> On 2/3/21 12:33 PM, Andrii Nakryiko wrote:
> >>> On Wed, Feb 3, 2021 at 12:15 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>>>
> >>>> On 2/3/21 12:12 PM, Andrii Nakryiko wrote:
> >>>>> On Wed, Feb 3, 2021 at 12:09 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>>>>>
> >>>>>> On 2/3/21 11:39 AM, Andrii Nakryiko wrote:
> >>>>>>> On Wed, Feb 3, 2021 at 9:22 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>>>>>>>
> >>>>>>>> On 2/3/21 2:57 AM, Toke Høiland-Jørgensen wrote:
> >>>>>>>>> Randy Dunlap <rdunlap@infradead.org> writes:
> >>>>>>>>>
> >>>>>>>>>> Hi,
> >>>>>>>>>>
> >>>>>>>>>> I see this sometimes when building a kernel: (on x86_64,
> >>>>>>>>>> with today's linux-next 20210202):
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> CONFIG_CGROUP_BPF=y
> >>>>>>>>>> CONFIG_BPF=y
> >>>>>>>>>> CONFIG_BPF_SYSCALL=y
> >>>>>>>>>> CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
> >>>>>>>>>> CONFIG_BPF_PRELOAD=y
> >>>>>>>>>> CONFIG_BPF_PRELOAD_UMD=m
> >>>>>>>>>> CONFIG_HAVE_EBPF_JIT=y
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> Auto-detecting system features:
> >>>>>>>>>> ...                        libelf: [ [31mOFF[m ]
> >>>>>>>>>> ...                          zlib: [ [31mOFF[m ]
> >>>>>>>>>> ...                           bpf: [ [31mOFF[m ]
> >>>>>>>>>>
> >>>>>>>>>> No libelf found
> >>>>>>>>>> make[5]: [Makefile:287: elfdep] Error 1 (ignored)
> >>>>>>>>>> No zlib found
> >>>>>>>>>> make[5]: [Makefile:290: zdep] Error 1 (ignored)
> >>>>>>>>>> BPF API too old
> >>>>>>>>>> make[5]: [Makefile:293: bpfdep] Error 1 (ignored)
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> but pkg-config tells me:
> >>>>>>>>>>
> >>>>>>>>>> $ pkg-config --modversion  libelf
> >>>>>>>>>> 0.168
> >>>>>>>>>> $ pkg-config --libs  libelf
> >>>>>>>>>> -lelf
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> Any ideas?
> >>>>>>>>>
> >>>>>>>>> This usually happens because there's a stale cache of the feature
> >>>>>>>>> detection tests lying around somewhere. Look for a 'feature' directory
> >>>>>>>>> in whatever subdir you got that error. Just removing the feature
> >>>>>>>>> directory usually fixes this; I've fixed a couple of places where this
> >>>>>>>>> is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
> >>>>>>>>> Make sure Makefile cleans up after itself, and add .gitignore")) but I
> >>>>>>>>> wouldn't be surprised if there are still some that are broken.
> >>>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> Thanks for replying.
> >>>>>>>>
> >>>>>>>> I removed the feature subdir and still got this build error, so I
> >>>>>>>> removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
> >>>>>>>> and still got the same libelf build error.
> >>>>>>>
> >>>>>>> I hate the complexity of feature detection framework to the point that
> >>>>>>> I'm willing to rip it out from libbpf's Makefile completely. I just
> >>>>>>> spent an hour trying to understand what's going on in a very similar
> >>>>>>> situation. Extremely frustrating.
> >>>>>>>
> >>>>>>> In your case, it might be feature detection triggered from
> >>>>>>> resolve_btfids, so try removing
> >>>>>>> $(OUTPUT)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf}.
> >>>>>>>
> >>>>>>> It seems like we don't do proper cleanup in resolve_btfids (it should
> >>>>>>> probably call libbpf's clean as well). And it's beyond me why `make -C
> >>>>>>> tools/build/feature clean` doesn't clean up FEATURE-DUMP.<use-case>
> >>>>>>> file as well.
> >>>>>>
> >>>>>>
> >>>>>> I don't think it's related to improper cleanup or old files/dirs
> >>>>>> laying around. I say that because I did a full build in a new output dir.
> >>>>>> and it still failed in the same way.
> >>>>>
> >>>>> If you cd tools/lib/bpf and run make there, does it detect those libraries?
> >>>>
> >>>> Yes:
> >>>>
> >>>> Auto-detecting system features:
> >>>> ...                        libelf: [ on  ]
> >>>> ...                          zlib: [ on  ]
> >>>> ...                           bpf: [ on  ]
> >>>>
> >>>>
> >>>
> >>> Sounds exactly like my case. I removed
> >>> $(O)/tools/bpf/resolve_btfids/{feature/,FEATURE-DUMP.libbpf} and it
> >>> started working.
> >>
> >> I already tried that with no success.
> >>
> >> I suppose that it could be related to how I do builds:
> >>
> >> make ARCH=x86_64 O=subdir -j4 all
> >>
> >> so subdir is a relative path, not an absolute path.
> >
> > so can you confirm this by specifying the absolute path to subdir?
>
> Yes, absolute output path works for libelf, zlib, and bpf:
>
> Auto-detecting system features:
> ...                        libelf: [  [32mon [m  ]
> ...                          zlib: [  [32mon [m  ]
> ...                           bpf: [  [32mon [m  ]
>
>
> Are {feature,FEATURE-DUMP} created in multiple places?
> I don't see them in $(OUTDIR)/tools -- there is no /bpf/ subdir there
> at all.
> I do see them in $(OUTDIR)/kernel/bpf/preload/ -- are those different
> feature files?
>

Yes, they are different. Preload builds its own copy of libbpf, while
resolve_btfids builds its own.

So it seems like [0] should fix your issue by not using feature
detection at all.

  [0] https://patchwork.kernel.org/project/netdevbpf/patch/20210203203445.3356114-1-andrii@kernel.org/

>
> thanks.
> --
> ~Randy
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: finding libelf
  2021-02-03 20:06       ` Andrii Nakryiko
  2021-02-03 20:33         ` Jiri Olsa
@ 2021-02-04 10:55         ` Jiri Olsa
  1 sibling, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2021-02-04 10:55 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Randy Dunlap, Jiri Olsa, Toke Høiland-Jørgensen, bpf

On Wed, Feb 03, 2021 at 12:06:10PM -0800, Andrii Nakryiko wrote:

SNIP

> > > >>
> > > >> but pkg-config tells me:
> > > >>
> > > >> $ pkg-config --modversion  libelf
> > > >> 0.168
> > > >> $ pkg-config --libs  libelf
> > > >> -lelf
> > > >>
> > > >>
> > > >> Any ideas?
> > > >
> > > > This usually happens because there's a stale cache of the feature
> > > > detection tests lying around somewhere. Look for a 'feature' directory
> > > > in whatever subdir you got that error. Just removing the feature
> > > > directory usually fixes this; I've fixed a couple of places where this
> > > > is not picked up by 'make clean' (see, e.g., 9d9aae53b96d ("bpf/preload:
> > > > Make sure Makefile cleans up after itself, and add .gitignore")) but I
> > > > wouldn't be surprised if there are still some that are broken.
> > >
> > > Hi,
> > >
> > > Thanks for replying.
> > >
> > > I removed the feature subdir and still got this build error, so I
> > > removed everything in BUILDDIR/kernel/bpf/preload and rebuilt --
> > > and still got the same libelf build error.
> >
> > I hate the complexity of feature detection framework to the point that
> > I'm willing to rip it out from libbpf's Makefile completely. I just
> > spent an hour trying to understand what's going on in a very similar
> > situation. Extremely frustrating.

I have plans to rework this and get rid of the make code
which is the worst part of that for me.. I'll speed it up ;-)

jirka


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-02-04 10:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03  3:50 finding libelf Randy Dunlap
2021-02-03 10:57 ` Toke Høiland-Jørgensen
2021-02-03 17:20   ` Randy Dunlap
2021-02-03 19:39     ` Andrii Nakryiko
2021-02-03 20:06       ` Andrii Nakryiko
2021-02-03 20:33         ` Jiri Olsa
2021-02-04 10:55         ` Jiri Olsa
2021-02-03 20:09       ` Randy Dunlap
2021-02-03 20:12         ` Andrii Nakryiko
2021-02-03 20:14           ` Randy Dunlap
2021-02-03 20:33             ` Andrii Nakryiko
2021-02-03 20:36               ` Randy Dunlap
2021-02-03 20:41                 ` Randy Dunlap
2021-02-03 20:41                 ` Andrii Nakryiko
2021-02-03 20:57                   ` Randy Dunlap
2021-02-03 21:31                     ` Andrii Nakryiko

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).