Message ID | 5ee95e93a11a239df8e09d059da25a4eaa5725ba.1646198836.git.geliang.tang@suse.com (mailing list archive) |
---|---|
State | Accepted |
Commit | a50a88f026fb28ece512c50e8ef7cd4ef6d0a291 |
Headers | show |
Series | [v2] selftests: netfilter: fix a build error on openSUSE | expand |
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
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.
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
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
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`.
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?
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.
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