All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] selftests: netfilter: fix a build error on openSUSE
@ 2022-03-02  5:29 Geliang Tang
  2022-03-02 17:11 ` Shuah Khan
  0 siblings, 1 reply; 10+ messages in thread
From: Geliang Tang @ 2022-03-02  5:29 UTC (permalink / raw)
  To: Shuah Khan; +Cc: Geliang Tang, linux-kselftest, Kai Liu

This patch fixed the following build error on openSUSE Leap 15.3:

=======================================================================
 gcc     nf-queue.c -lmnl -o tools/testing/selftests/netfilter/nf-queue
 nf-queue.c:13:10: fatal error: libmnl/libmnl.h: No such file or directory
  #include <libmnl/libmnl.h>
           ^~~~~~~~~~~~~~~~~
 compilation terminated.
=======================================================================

It is because libmnl.h is put in the directory of
"/usr/include/libmnl/libmnl/" on openSUSE, not "/usr/include/libmnl/":

 > rpm -ql libmnl-devel
 /usr/include/libmnl
 /usr/include/libmnl/libmnl
 /usr/include/libmnl/libmnl/libmnl.h
 /usr/lib64/libmnl.so
 /usr/lib64/pkgconfig/libmnl.pc

Suggested-by: Kai Liu <kai.liu@suse.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
v2:
 - use pkg-config
---
 tools/testing/selftests/netfilter/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
index e4f845dd942b..8136c1fab7ab 100644
--- a/tools/testing/selftests/netfilter/Makefile
+++ b/tools/testing/selftests/netfilter/Makefile
@@ -8,6 +8,7 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \
 	ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
 	conntrack_vrf.sh nft_synproxy.sh
 
+CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl")
 LDLIBS = -lmnl
 TEST_GEN_FILES =  nf-queue
 
-- 
2.34.1


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

* Re: [PATCH v2] selftests: netfilter: fix a build error on openSUSE
  2022-03-02  5:29 [PATCH v2] selftests: netfilter: fix a build error on openSUSE Geliang Tang
@ 2022-03-02 17:11 ` Shuah Khan
  2022-03-02 18:00   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 10+ messages in thread
From: Shuah Khan @ 2022-03-02 17:11 UTC (permalink / raw)
  To: Geliang Tang, Shuah Khan, pablo; +Cc: linux-kselftest, Kai Liu, Shuah Khan

On 3/1/22 10:29 PM, Geliang Tang wrote:
> This patch fixed the following build error on openSUSE Leap 15.3:
> 
> =======================================================================
>   gcc     nf-queue.c -lmnl -o tools/testing/selftests/netfilter/nf-queue
>   nf-queue.c:13:10: fatal error: libmnl/libmnl.h: No such file or directory
>    #include <libmnl/libmnl.h>
>             ^~~~~~~~~~~~~~~~~
>   compilation terminated.
> =======================================================================
> 
> It is because libmnl.h is put in the directory of
> "/usr/include/libmnl/libmnl/" on openSUSE, not "/usr/include/libmnl/":
> 
>   > rpm -ql libmnl-devel
>   /usr/include/libmnl
>   /usr/include/libmnl/libmnl
>   /usr/include/libmnl/libmnl/libmnl.h
>   /usr/lib64/libmnl.so
>   /usr/lib64/pkgconfig/libmnl.pc
> 
> Suggested-by: Kai Liu <kai.liu@suse.com>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> v2:
>   - use pkg-config
> ---
>   tools/testing/selftests/netfilter/Makefile | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
> index e4f845dd942b..8136c1fab7ab 100644
> --- a/tools/testing/selftests/netfilter/Makefile
> +++ b/tools/testing/selftests/netfilter/Makefile
> @@ -8,6 +8,7 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \
>   	ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
>   	conntrack_vrf.sh nft_synproxy.sh
>   
> +CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl")
>   LDLIBS = -lmnl
>   TEST_GEN_FILES =  nf-queue
>   
> 

Adding Pablo to the thread.

Pablo,

This looks good to me. I can take this through linux-kselftest tree.
Let me know either way.

Or if it is going through netfilter tree:
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah





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

* Re: [PATCH v2] selftests: netfilter: fix a build error on openSUSE
  2022-03-02 17:11 ` Shuah Khan
@ 2022-03-02 18:00   ` Pablo Neira Ayuso
  2022-03-03 19:10     ` Shuah Khan
  2023-04-25  9:14     ` Jan Engelhardt
  0 siblings, 2 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2022-03-02 18:00 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Geliang Tang, Shuah Khan, linux-kselftest, Kai Liu, netfilter-devel

On Wed, Mar 02, 2022 at 10:11:11AM -0700, Shuah Khan wrote:
> On 3/1/22 10:29 PM, Geliang Tang wrote:
> > This patch fixed the following build error on openSUSE Leap 15.3:
> > 
> > =======================================================================
> >   gcc     nf-queue.c -lmnl -o tools/testing/selftests/netfilter/nf-queue
> >   nf-queue.c:13:10: fatal error: libmnl/libmnl.h: No such file or directory
> >    #include <libmnl/libmnl.h>
> >             ^~~~~~~~~~~~~~~~~
> >   compilation terminated.
> > =======================================================================
> > 
> > It is because libmnl.h is put in the directory of
> > "/usr/include/libmnl/libmnl/" on openSUSE, not "/usr/include/libmnl/":
> > 
> >   > rpm -ql libmnl-devel
> >   /usr/include/libmnl
> >   /usr/include/libmnl/libmnl
> >   /usr/include/libmnl/libmnl/libmnl.h
> >   /usr/lib64/libmnl.so
> >   /usr/lib64/pkgconfig/libmnl.pc
> > 
> > Suggested-by: Kai Liu <kai.liu@suse.com>
> > Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> > ---
> > v2:
> >   - use pkg-config
> > ---
> >   tools/testing/selftests/netfilter/Makefile | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
> > index e4f845dd942b..8136c1fab7ab 100644
> > --- a/tools/testing/selftests/netfilter/Makefile
> > +++ b/tools/testing/selftests/netfilter/Makefile
> > @@ -8,6 +8,7 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \
> >   	ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
> >   	conntrack_vrf.sh nft_synproxy.sh
> > +CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl")
> >   LDLIBS = -lmnl
> >   TEST_GEN_FILES =  nf-queue
> > 
> 
> Adding Pablo to the thread.
> 
> Pablo,
> 
> This looks good to me. I can take this through linux-kselftest tree.
> Let me know either way.
> 
> Or if it is going through netfilter tree:
> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

If this does not cause any issue when running tests in any other
distros, then it is fine with me.

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

* Re: [PATCH v2] selftests: netfilter: fix a build error on openSUSE
  2022-03-02 18:00   ` Pablo Neira Ayuso
@ 2022-03-03 19:10     ` Shuah Khan
  2022-03-03 22:20       ` Shuah Khan
  2023-04-25  9:14     ` Jan Engelhardt
  1 sibling, 1 reply; 10+ messages in thread
From: Shuah Khan @ 2022-03-03 19:10 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Geliang Tang, Shuah Khan, linux-kselftest, Kai Liu,
	netfilter-devel, Shuah Khan

On 3/2/22 11:00 AM, Pablo Neira Ayuso wrote:
> On Wed, Mar 02, 2022 at 10:11:11AM -0700, Shuah Khan wrote:
>> On 3/1/22 10:29 PM, Geliang Tang wrote:
>>> This patch fixed the following build error on openSUSE Leap 15.3:
>>>
>>> =======================================================================
>>>    gcc     nf-queue.c -lmnl -o tools/testing/selftests/netfilter/nf-queue
>>>    nf-queue.c:13:10: fatal error: libmnl/libmnl.h: No such file or directory
>>>     #include <libmnl/libmnl.h>
>>>              ^~~~~~~~~~~~~~~~~
>>>    compilation terminated.
>>> =======================================================================
>>>
>>> It is because libmnl.h is put in the directory of
>>> "/usr/include/libmnl/libmnl/" on openSUSE, not "/usr/include/libmnl/":
>>>
>>>    > rpm -ql libmnl-devel
>>>    /usr/include/libmnl
>>>    /usr/include/libmnl/libmnl
>>>    /usr/include/libmnl/libmnl/libmnl.h
>>>    /usr/lib64/libmnl.so
>>>    /usr/lib64/pkgconfig/libmnl.pc
>>>
>>> Suggested-by: Kai Liu <kai.liu@suse.com>
>>> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
>>> ---
>>> v2:
>>>    - use pkg-config
>>> ---
>>>    tools/testing/selftests/netfilter/Makefile | 1 +
>>>    1 file changed, 1 insertion(+)
>>>
>>> diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
>>> index e4f845dd942b..8136c1fab7ab 100644
>>> --- a/tools/testing/selftests/netfilter/Makefile
>>> +++ b/tools/testing/selftests/netfilter/Makefile
>>> @@ -8,6 +8,7 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \
>>>    	ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
>>>    	conntrack_vrf.sh nft_synproxy.sh
>>> +CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl")
>>>    LDLIBS = -lmnl
>>>    TEST_GEN_FILES =  nf-queue
>>>
>>
>> Adding Pablo to the thread.
>>
>> Pablo,
>>
>> This looks good to me. I can take this through linux-kselftest tree.
>> Let me know either way.
>>
>> Or if it is going through netfilter tree:
>> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> If this does not cause any issue when running tests in any other
> distros, then it is fine with me.
> 

I tested this on Ubuntu 21.10 and worked for me. I will apply this for
Linux 5.18-rc1 then.

thanks,
-- Shuah

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

* Re: [PATCH v2] selftests: netfilter: fix a build error on openSUSE
  2022-03-03 19:10     ` Shuah Khan
@ 2022-03-03 22:20       ` Shuah Khan
  0 siblings, 0 replies; 10+ messages in thread
From: Shuah Khan @ 2022-03-03 22:20 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Geliang Tang, Shuah Khan, linux-kselftest, Kai Liu,
	netfilter-devel, Shuah Khan

On 3/3/22 12:10 PM, Shuah Khan wrote:
> On 3/2/22 11:00 AM, Pablo Neira Ayuso wrote:
>> On Wed, Mar 02, 2022 at 10:11:11AM -0700, Shuah Khan wrote:
>>> On 3/1/22 10:29 PM, Geliang Tang wrote:
>>>> This patch fixed the following build error on openSUSE Leap 15.3:
>>>>
>>>> =======================================================================
>>>>    gcc     nf-queue.c -lmnl -o tools/testing/selftests/netfilter/nf-queue
>>>>    nf-queue.c:13:10: fatal error: libmnl/libmnl.h: No such file or directory
>>>>     #include <libmnl/libmnl.h>
>>>>              ^~~~~~~~~~~~~~~~~
>>>>    compilation terminated.
>>>> =======================================================================
>>>>
>>>> It is because libmnl.h is put in the directory of
>>>> "/usr/include/libmnl/libmnl/" on openSUSE, not "/usr/include/libmnl/":
>>>>
>>>>    > rpm -ql libmnl-devel
>>>>    /usr/include/libmnl
>>>>    /usr/include/libmnl/libmnl
>>>>    /usr/include/libmnl/libmnl/libmnl.h
>>>>    /usr/lib64/libmnl.so
>>>>    /usr/lib64/pkgconfig/libmnl.pc
>>>>
>>>> Suggested-by: Kai Liu <kai.liu@suse.com>
>>>> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
>>>> ---
>>>> v2:
>>>>    - use pkg-config
>>>> ---
>>>>    tools/testing/selftests/netfilter/Makefile | 1 +
>>>>    1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
>>>> index e4f845dd942b..8136c1fab7ab 100644
>>>> --- a/tools/testing/selftests/netfilter/Makefile
>>>> +++ b/tools/testing/selftests/netfilter/Makefile
>>>> @@ -8,6 +8,7 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \
>>>>        ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
>>>>        conntrack_vrf.sh nft_synproxy.sh
>>>> +CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl")
>>>>    LDLIBS = -lmnl
>>>>    TEST_GEN_FILES =  nf-queue
>>>>
>>>
>>> Adding Pablo to the thread.
>>>
>>> Pablo,
>>>
>>> This looks good to me. I can take this through linux-kselftest tree.
>>> Let me know either way.
>>>
>>> Or if it is going through netfilter tree:
>>> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
>>
>> If this does not cause any issue when running tests in any other
>> distros, then it is fine with me.
>>
> 
> I tested this on Ubuntu 21.10 and worked for me. I will apply this for
> Linux 5.18-rc1 then.
> 

Applied to linux-kselftest next for Linux 5.18-rc1.

thanks,
-- Shuah

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

* Re: [PATCH v2] selftests: netfilter: fix a build error on openSUSE
  2022-03-02 18:00   ` Pablo Neira Ayuso
  2022-03-03 19:10     ` Shuah Khan
@ 2023-04-25  9:14     ` Jan Engelhardt
  2023-04-25 16:32       ` Pablo Neira Ayuso
  1 sibling, 1 reply; 10+ messages in thread
From: Jan Engelhardt @ 2023-04-25  9:14 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Shuah Khan, Geliang Tang, Shuah Khan, linux-kselftest, Kai Liu,
	netfilter-devel


On Wednesday ** 2022-03-02 19:00 **, Pablo Neira Ayuso wrote:


>On Wed, Mar 02, 2022 at 10:11:11AM -0700, Shuah Khan wrote:
>> On 3/1/22 10:29 PM, Geliang Tang wrote:
>> > This patch fixed the following build error on openSUSE Leap 15.3:
>> >   nf-queue.c:13:10: fatal error: libmnl/libmnl.h: No such file or directory
>> >    #include <libmnl/libmnl.h>
>> > diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
>> > index e4f845dd942b..8136c1fab7ab 100644
>> > --- a/tools/testing/selftests/netfilter/Makefile
>> > +++ b/tools/testing/selftests/netfilter/Makefile
>> > @@ -8,6 +8,7 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \
>> >   	ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
>> >   	conntrack_vrf.sh nft_synproxy.sh
>> > +CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl")
>> >   LDLIBS = -lmnl
>> >   TEST_GEN_FILES =  nf-queue
>> 
>> Adding Pablo to the thread.
>> This looks good to me. I can take this through linux-kselftest tree.
>> Or if it is going through netfilter tree:
>> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
>
>If this does not cause any issue when running tests in any other
>distros, then it is fine with me.

Since a pkgconfig file exists, it ought to be used. That also means
you need the same/similar incantation in LDLIBS, with
`pkg-config --libs libmnl`.

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

* Re: [PATCH v2] selftests: netfilter: fix a build error on openSUSE
  2023-04-25  9:14     ` Jan Engelhardt
@ 2023-04-25 16:32       ` Pablo Neira Ayuso
  2023-04-25 20:48         ` Jeremy Sowden
  2023-04-25 21:11         ` [PATCH nf] selftests: netfilter: fix libmnl pkg-config usage Jeremy Sowden
  0 siblings, 2 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2023-04-25 16:32 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Shuah Khan, Geliang Tang, Shuah Khan, linux-kselftest, Kai Liu,
	netfilter-devel

On Tue, Apr 25, 2023 at 11:14:55AM +0200, Jan Engelhardt wrote:
> 
> On Wednesday ** 2022-03-02 19:00 **, Pablo Neira Ayuso wrote:
> 
> 
> >On Wed, Mar 02, 2022 at 10:11:11AM -0700, Shuah Khan wrote:
> >> On 3/1/22 10:29 PM, Geliang Tang wrote:
> >> > This patch fixed the following build error on openSUSE Leap 15.3:
> >> >   nf-queue.c:13:10: fatal error: libmnl/libmnl.h: No such file or directory
> >> >    #include <libmnl/libmnl.h>
> >> > diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
> >> > index e4f845dd942b..8136c1fab7ab 100644
> >> > --- a/tools/testing/selftests/netfilter/Makefile
> >> > +++ b/tools/testing/selftests/netfilter/Makefile
> >> > @@ -8,6 +8,7 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \
> >> >   	ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
> >> >   	conntrack_vrf.sh nft_synproxy.sh
> >> > +CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl")
> >> >   LDLIBS = -lmnl
> >> >   TEST_GEN_FILES =  nf-queue
> >> 
> >> Adding Pablo to the thread.
> >> This looks good to me. I can take this through linux-kselftest tree.
> >> Or if it is going through netfilter tree:
> >> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
> >
> >If this does not cause any issue when running tests in any other
> >distros, then it is fine with me.
> 
> Since a pkgconfig file exists, it ought to be used. That also means
> you need the same/similar incantation in LDLIBS, with
> `pkg-config --libs libmnl`.

Patch?

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

* Re: [PATCH v2] selftests: netfilter: fix a build error on openSUSE
  2023-04-25 16:32       ` Pablo Neira Ayuso
@ 2023-04-25 20:48         ` Jeremy Sowden
  2023-04-25 21:11         ` [PATCH nf] selftests: netfilter: fix libmnl pkg-config usage Jeremy Sowden
  1 sibling, 0 replies; 10+ messages in thread
From: Jeremy Sowden @ 2023-04-25 20:48 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Jan Engelhardt, Shuah Khan, Geliang Tang, Shuah Khan,
	linux-kselftest, Kai Liu, netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 1795 bytes --]

On 2023-04-25, at 18:32:45 +0200, Pablo Neira Ayuso wrote:
> On Tue, Apr 25, 2023 at 11:14:55AM +0200, Jan Engelhardt wrote:
> > On Wednesday ** 2022-03-02 19:00 **, Pablo Neira Ayuso wrote:
> > >On Wed, Mar 02, 2022 at 10:11:11AM -0700, Shuah Khan wrote:
> > >> On 3/1/22 10:29 PM, Geliang Tang wrote:
> > >> > This patch fixed the following build error on openSUSE Leap 15.3:
> > >> >   nf-queue.c:13:10: fatal error: libmnl/libmnl.h: No such file or directory
> > >> >    #include <libmnl/libmnl.h>
> > >> > diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
> > >> > index e4f845dd942b..8136c1fab7ab 100644
> > >> > --- a/tools/testing/selftests/netfilter/Makefile
> > >> > +++ b/tools/testing/selftests/netfilter/Makefile
> > >> > @@ -8,6 +8,7 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \
> > >> >   	ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
> > >> >   	conntrack_vrf.sh nft_synproxy.sh
> > >> > +CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl")
> > >> >   LDLIBS = -lmnl
> > >> >   TEST_GEN_FILES =  nf-queue
> > >>
> > >> Adding Pablo to the thread.
> > >> This looks good to me. I can take this through linux-kselftest tree.
> > >> Or if it is going through netfilter tree:
> > >> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
> > >
> > >If this does not cause any issue when running tests in any other
> > >distros, then it is fine with me.
> >
> > Since a pkgconfig file exists, it ought to be used. That also means
> > you need the same/similar incantation in LDLIBS, with `pkg-config
> > --libs libmnl`.

I would also avoid hard-coding pkg-config and remove the unnecessary
SUSE-specific default for CFLAGS.

> Patch?

Following shortly.

J.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [PATCH nf] selftests: netfilter: fix libmnl pkg-config usage
  2023-04-25 16:32       ` Pablo Neira Ayuso
  2023-04-25 20:48         ` Jeremy Sowden
@ 2023-04-25 21:11         ` Jeremy Sowden
  2023-04-25 22:21           ` Jan Engelhardt
  1 sibling, 1 reply; 10+ messages in thread
From: Jeremy Sowden @ 2023-04-25 21:11 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Jan Engelhardt, Shuah Khan, Geliang Tang, Kai Liu,
	linux-kselftest, netfilter-devel

1. Don't hard-code pkg-config
2. Remove distro-specific default for CFLAGS
3. Use pkg-config for LDLIBS

Fixes: a50a88f026fb ("selftests: netfilter: fix a build error on openSUSE")
Suggested-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 tools/testing/selftests/netfilter/Makefile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
index 4504ee07be08..3686bfa6c58d 100644
--- a/tools/testing/selftests/netfilter/Makefile
+++ b/tools/testing/selftests/netfilter/Makefile
@@ -8,8 +8,11 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \
 	ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
 	conntrack_vrf.sh nft_synproxy.sh rpath.sh
 
-CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl")
-LDLIBS = -lmnl
+HOSTPKG_CONFIG := pkg-config
+
+CFLAGS += $(shell $(HOSTPKG_CONFIG) --cflags libmnl 2>/dev/null)
+LDLIBS += $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
+
 TEST_GEN_FILES =  nf-queue connect_close
 
 include ../lib.mk
-- 
2.39.2


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

* Re: [PATCH nf] selftests: netfilter: fix libmnl pkg-config usage
  2023-04-25 21:11         ` [PATCH nf] selftests: netfilter: fix libmnl pkg-config usage Jeremy Sowden
@ 2023-04-25 22:21           ` Jan Engelhardt
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Engelhardt @ 2023-04-25 22:21 UTC (permalink / raw)
  To: Jeremy Sowden
  Cc: Pablo Neira Ayuso, Shuah Khan, Geliang Tang, Kai Liu,
	linux-kselftest, netfilter-devel


On Tuesday 2023-04-25 23:11, Jeremy Sowden wrote:

>1. Don't hard-code pkg-config
>2. Remove distro-specific default for CFLAGS
>3. Use pkg-config for LDLIBS


>+CFLAGS += $(shell $(HOSTPKG_CONFIG) --cflags libmnl 2>/dev/null)
>+LDLIBS += $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)

Ah yes, this looks better and looks modeled upon selftests/bpf/Makefile.
Speaking of which, there's a space missing over there.

tools/testing/selftests/bpf/Makefile:HOSTPKG_CONFIG := pkg-config
tools/testing/selftests/bpf/Makefile:   $(Q)$(CC) $(shell $(HOSTPKG_CONFIG)--cflags libcrypto 2> /dev/null) \
tools/testing/selftests/bpf/Makefile:             $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)

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

end of thread, other threads:[~2023-04-25 22:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02  5:29 [PATCH v2] selftests: netfilter: fix a build error on openSUSE Geliang Tang
2022-03-02 17:11 ` Shuah Khan
2022-03-02 18:00   ` Pablo Neira Ayuso
2022-03-03 19:10     ` Shuah Khan
2022-03-03 22:20       ` Shuah Khan
2023-04-25  9:14     ` Jan Engelhardt
2023-04-25 16:32       ` Pablo Neira Ayuso
2023-04-25 20:48         ` Jeremy Sowden
2023-04-25 21:11         ` [PATCH nf] selftests: netfilter: fix libmnl pkg-config usage Jeremy Sowden
2023-04-25 22:21           ` Jan Engelhardt

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.