Skip to contentSkip to conversation

autoconf: Use pkg-config for keyutils detection

PATCH New Petr Vorel 3 participants 11 messages Jan 11, 2021 – Jan 14, 2021

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Using pkg-config is less error prone during cross compilation.

---
Hi,

if you agree with this, I'll replace (probably after release) ACL_LIBS, CAP_LIBS, CRYPTO_LIBS, SELINUX_LIBS (to follow libmnl and libtirpc).

libaio and libnuma does not support pkg-config.

Tested: https://travis-ci.org/github/pevik/ltp/builds/753925166

Kind regards,
Petr

 configure.ac                                   |  2 +-
 include/mk/config.mk.in                        |  6 +++---
 m4/ltp-keyutils.m4                             | 10 ----------
 m4/ltp-libkeyutils.m4                          |  8 ++++++++
 testcases/cve/Makefile                         |  2 +-
 testcases/kernel/syscalls/add_key/Makefile     |  2 +-
 testcases/kernel/syscalls/keyctl/Makefile      |  2 +-
 testcases/kernel/syscalls/request_key/Makefile |  2 +-
 8 files changed, 16 insertions(+), 18 deletions(-)
 delete mode 100644 m4/ltp-keyutils.m4
 create mode 100644 m4/ltp-libkeyutils.m4
configure.ac +1 -1
index 06be1c094..8d667eb1e 100644
@@ -328,7 +328,7 @@ LTP_CHECK_CLONE_SUPPORTS_7_ARGS
 LTP_CHECK_CRYPTO
 LTP_CHECK_FORTIFY_SOURCE
 LTP_CHECK_KERNEL_DEVEL
-LTP_CHECK_KEYUTILS_SUPPORT
+LTP_CHECK_LIBKEYUTILS
 LTP_CHECK_LIBMNL
 LTP_CHECK_LINUX_PTRACE
 LTP_CHECK_LINUXRANDOM
include/mk/config.mk.in +3 -3
index 218447ef3..382b7fda2 100644
@@ -52,12 +52,12 @@ LEXLIB			:= @LEXLIB@
 NUMA_LIBS		:= @NUMA_LIBS@
 SELINUX_LIBS		:= @SELINUX_LIBS@
 HAVE_RPC		:= @HAVE_RPC@
-LIBTIRPC_CFLAGS		:= @LIBTIRPC_CFLAGS@
-LIBTIRPC_LIBS		:= @LIBTIRPC_LIBS@
-KEYUTILS_LIBS		:= @KEYUTILS_LIBS@
 HAVE_FTS_H		:= @HAVE_FTS_H@
+LIBKEYUTILS_LIBS	:= @LIBKEYUTILS_LIBS@
 LIBMNL_LIBS		:= @LIBMNL_LIBS@
 LIBMNL_CFLAGS		:= @LIBMNL_CFLAGS@
+LIBTIRPC_CFLAGS		:= @LIBTIRPC_CFLAGS@
+LIBTIRPC_LIBS		:= @LIBTIRPC_LIBS@
 
 prefix			:= @prefix@
 
m4/ltp-keyutils.m4 deleted +0 -10
deleted file mode 100644
index 451c549f3..000000000
@@ -1,10 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2016 Fujitsu Ltd.
-dnl Copyright (c) 2017 Petr Vorel <[email protected]>
-dnl Author: Xiao Yang <[email protected]>
-
-AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT], [
-	AC_CHECK_LIB([keyutils], [add_key],
-	[AC_DEFINE(HAVE_LIBKEYUTILS, 1, [Define to 1 if you have libkeyutils installed.])
-	      AC_SUBST(KEYUTILS_LIBS, "-lkeyutils")])
-])
m4/ltp-libkeyutils.m4 new file +8 -0
new file mode 100644
index 000000000..f5d128969
@@ -0,0 +1,8 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2020 Petr Vorel <[email protected]>
+
+AC_DEFUN([LTP_CHECK_LIBKEYUTILS], [
+    PKG_CHECK_MODULES([LIBKEYUTILS], [libkeyutils], [
+        AC_DEFINE([HAVE_LIBKEYUTILS], [1], [Define to 1 if you have libkeyutils library and headers])
+	], [have_libkeyutils=no])
+])
testcases/cve/Makefile +1 -1
index da44fff60..90921dd85 100644
@@ -21,7 +21,7 @@ CFLAGS			+= -D_GNU_SOURCE
 
 stack_clash:	CFLAGS += -fno-optimize-sibling-calls
 
-cve-2016-7042:	LDLIBS += $(KEYUTILS_LIBS)
+cve-2016-7042:	LDLIBS += $(LIBKEYUTILS_LIBS)
 
 cve-2016-7117:	CFLAGS += -pthread
 cve-2016-7117:	LDLIBS += -lrt
testcases/kernel/syscalls/add_key/Makefile +1 -1
index 0f51e0bc2..6c2102247 100644
@@ -5,6 +5,6 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += $(KEYUTILS_LIBS)
+LDLIBS  += $(LIBKEYUTILS_LIBS)
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/keyctl/Makefile +1 -1
index 180ece25a..343c5e359 100644
@@ -5,7 +5,7 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS	+= $(KEYUTILS_LIBS)
+LDLIBS	+= $(LIBKEYUTILS_LIBS)
 keyctl02: LDLIBS	+= -lpthread
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/request_key/Makefile +1 -1
index 58a99875e..e69774b96 100644
@@ -6,6 +6,6 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS		+= $(KEYUTILS_LIBS)
+LDLIBS		+= $(LIBKEYUTILS_LIBS)
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Quoted 9 lines · Petr Vorel

Using pkg-config is less error prone during cross compilation.

---
Hi,

if you agree with this, I'll replace (probably after release) ACL_LIBS, CAP_LIBS, CRYPTO_LIBS, SELINUX_LIBS (to follow libmnl and libtirpc).

+1

Quoted 32 lines

libaio and libnuma does not support pkg-config.

Tested: https://travis-ci.org/github/pevik/ltp/builds/753925166

[...]

m4/ltp-keyutils.m4 deleted +0 -8
deleted file mode 100644
index 451c549f3..000000000
@@ -1,10 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2016 Fujitsu Ltd.
-dnl Copyright (c) 2017 Petr Vorel <[email protected]>
-dnl Author: Xiao Yang <[email protected]>
-
-AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT], [
-       AC_CHECK_LIB([keyutils], [add_key],
-       [AC_DEFINE(HAVE_LIBKEYUTILS, 1, [Define to 1 if you have

libkeyutils installed.])

m4/ltp-keyutils.m4 deleted +0 -2
-             AC_SUBST(KEYUTILS_LIBS, "-lkeyutils")])
-])
m4/ltp-libkeyutils.m4 new file +0 -0
new file mode 100644
index 000000000..f5d128969

m4/ltp-libkeyutils.m4 line 5

Quoted 5 lines
m4/ltp-libkeyutils.m4 new file +5 -0
@@ -0,0 +1,8 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2020 Petr Vorel <[email protected]>
+
+AC_DEFUN([LTP_CHECK_LIBKEYUTILS], [
+    PKG_CHECK_MODULES([LIBKEYUTILS], [libkeyutils], [

I guess the list-of-modules should be [keyutils-libs] but not [libkeyutils]?

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210112/acb79e9a/attachment.htm>
author
#2 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Hi Li,

Quoted 23 lines
Quoted 23 lines
m4/ltp-keyutils.m4 deleted +0 -8
deleted file mode 100644
index 451c549f3..000000000
@@ -1,10 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2016 Fujitsu Ltd.
-dnl Copyright (c) 2017 Petr Vorel <[email protected]>
-dnl Author: Xiao Yang <[email protected]>
-
-AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT], [
-       AC_CHECK_LIB([keyutils], [add_key],
-       [AC_DEFINE(HAVE_LIBKEYUTILS, 1, [Define to 1 if you have

libkeyutils installed.])

m4/ltp-keyutils.m4 deleted +0 -2
-             AC_SUBST(KEYUTILS_LIBS, "-lkeyutils")])
-])
m4/ltp-libkeyutils.m4 new file +0 -0
new file mode 100644
index 000000000..f5d128969
@@ -0,0 +1,8 @@
Quoted 8 lines

m4/ltp-libkeyutils.m4 line 5

Quoted 5 lines
m4/ltp-libkeyutils.m4 new file +5 -0
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2020 Petr Vorel <[email protected]>
+
+AC_DEFUN([LTP_CHECK_LIBKEYUTILS], [
+    PKG_CHECK_MODULES([LIBKEYUTILS], [libkeyutils], [

I guess the list-of-modules should be [keyutils-libs] but not [libkeyutils]?

No problem to change that, but can you explain why?

Thanks for your review.

Kind regards,
Petr

#3 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Hi Petr,

Quoted 9 lines · Petr Vorel
Quoted 6 lines

+

m4/ltp-libkeyutils.m4 line 5

Quoted 2 lines
m4/ltp-libkeyutils.m4 new file +2 -0
+AC_DEFUN([LTP_CHECK_LIBKEYUTILS], [
+    PKG_CHECK_MODULES([LIBKEYUTILS], [libkeyutils], [

I guess the list-of-modules should be [keyutils-libs] but not

[libkeyutils]?
No problem to change that, but can you explain why?

From what I understanding, this macro runs the pkg-config tool to check for the presence of packages against keyutils-libs and sets two variables:
LIBKEYUTILS_CFLAGS, LIBKEYUTILS_LIBS accordingly.

So the list-of-modules should be the precise name(or version) of the library, am I right?
See: https://autotools.io/pkgconfig/pkg_check_modules.html

Quoted 1 line

Tested: https://travis-ci.org/github/pevik/ltp/builds/753925166

The reason for test all get passed is the "include/lapi/keyctl.h" has the second choice to include <linux/keyctl.h> I guess.

#if defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS)

# include <keyutils.h>
#else
# ifdef HAVE_LINUX_KEYCTL_H
#  include <linux/keyctl.h>
# endif /* HAVE_LINUX_KEYCTL_H */
Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210112/188d5d54/attachment.htm>
author
#4 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Hi Li,

Quoted 14 lines

Hi Petr,

Quoted 8 lines · Petr Vorel
Quoted 6 lines

+

m4/ltp-libkeyutils.m4 line 5

Quoted 2 lines
m4/ltp-libkeyutils.m4 new file +2 -0
+AC_DEFUN([LTP_CHECK_LIBKEYUTILS], [
+    PKG_CHECK_MODULES([LIBKEYUTILS], [libkeyutils], [

I guess the list-of-modules should be [keyutils-libs] but not

[libkeyutils]?
No problem to change that, but can you explain why?

Quoted 7 lines

From what I understanding, this macro runs the pkg-config tool to check for the presence of packages against keyutils-libs and sets two variables:
LIBKEYUTILS_CFLAGS, LIBKEYUTILS_LIBS accordingly.

So the list-of-modules should be the precise name(or version) of the library, am I right?
See: https://autotools.io/pkgconfig/pkg_check_modules.html

Thanks for an explanation, but I'm still missing something. In openSUSE:

$ pkg-config --libs --cflags libkeyutils
-lkeyutils
$ pkg-config --libs --cflags keyutils-libs
Package keyutils-libs was not found in the pkg-config search path.
Perhaps you should add the directory containing `keyutils-libs.pc'
to the PKG_CONFIG_PATH environment variable
Package 'keyutils-libs', required by 'virtual:world', not found

That's correct, because keyutils-devel package has file:
/usr/lib64/pkgconfig/libkeyutils.pc

The same is for Debian, which has /usr/lib/x86_64-linux-gnu/pkgconfig/libkeyutils.pc

Looking at Fedora:
keyutils-libs-devel [1] has /usr/lib64/pkgconfig/libkeyutils.pc.

Download and unpack the package and run:

$ PKG_CONFIG_LIBDIR="$PWD/usr/lib64/pkgconfig/" pkg-config --libs --cflags libkeyutils
-lkeyutils
Quoted 8 lines
Quoted 1 line

Tested: https://travis-ci.org/github/pevik/ltp/builds/753925166

The reason for test all get passed is the "include/lapi/keyctl.h" has the second choice to include <linux/keyctl.h> I guess.

#if defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS)

# include <keyutils.h>

In my case (openSUSE) I have HAVE_LIBKEYUTILS defined.

Quoted 4 lines

#else

# ifdef HAVE_LINUX_KEYCTL_H
#  include <linux/keyctl.h>
# endif /* HAVE_LINUX_KEYCTL_H */

Kind regards,
Petr

[1] https://download-ib01.fedoraproject.org/pub/fedora/linux/updates/33/Everything/x86_64/Packages/k/keyutils-libs-devel-1.6.1-1.fc33.x86_64.rpm

author
#5 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Hi Li,

...

Quoted 26 lines
Quoted 7 lines

From what I understanding, this macro runs the pkg-config tool to check for the presence of packages against keyutils-libs and sets two variables:
LIBKEYUTILS_CFLAGS, LIBKEYUTILS_LIBS accordingly.

So the list-of-modules should be the precise name(or version) of the library, am I right?
See: https://autotools.io/pkgconfig/pkg_check_modules.html

Thanks for an explanation, but I'm still missing something. In openSUSE:

$ pkg-config --libs --cflags libkeyutils
-lkeyutils
$ pkg-config --libs --cflags keyutils-libs
Package keyutils-libs was not found in the pkg-config search path.
Perhaps you should add the directory containing `keyutils-libs.pc'
to the PKG_CONFIG_PATH environment variable
Package 'keyutils-libs', required by 'virtual:world', not found

That's correct, because keyutils-devel package has file:
/usr/lib64/pkgconfig/libkeyutils.pc

The same is for Debian, which has /usr/lib/x86_64-linux-gnu/pkgconfig/libkeyutils.pc

Quoted 6 lines

Looking at Fedora:
keyutils-libs-devel [1] has /usr/lib64/pkgconfig/libkeyutils.pc.

Download and unpack the package and run:

$ PKG_CONFIG_LIBDIR="$PWD/usr/lib64/pkgconfig/" pkg-config --libs --cflags libkeyutils
-lkeyutils

And more importantly upstream has libkeyutils.pc.in [1] (not keyutils-libs.pc).

Kind regards,
Petr

[1] https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git/tree/libkeyutils.pc.in

#6 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Hi Petr,

Quoted 33 lines · Petr Vorel

Hi Li,

...

Quoted 2 lines
Quoted 2 lines

From what I understanding, this macro runs the pkg-config tool to check for the presence of packages against keyutils-libs and sets two

variables:

Quoted 26 lines
Quoted 5 lines

LIBKEYUTILS_CFLAGS, LIBKEYUTILS_LIBS accordingly.

So the list-of-modules should be the precise name(or version) of the library, am I right?
See: https://autotools.io/pkgconfig/pkg_check_modules.html

Thanks for an explanation, but I'm still missing something. In openSUSE:

$ pkg-config --libs --cflags libkeyutils
-lkeyutils
$ pkg-config --libs --cflags keyutils-libs
Package keyutils-libs was not found in the pkg-config search path.
Perhaps you should add the directory containing `keyutils-libs.pc'
to the PKG_CONFIG_PATH environment variable
Package 'keyutils-libs', required by 'virtual:world', not found

That's correct, because keyutils-devel package has file:
/usr/lib64/pkgconfig/libkeyutils.pc

The same is for Debian, which has /usr/lib/x86_64-linux-gnu/pkgconfig/libkeyutils.pc

Looking at Fedora:
keyutils-libs-devel [1] has /usr/lib64/pkgconfig/libkeyutils.pc.

Quoted 8 lines
Quoted 2 lines

Download and unpack the package and run:

$ PKG_CONFIG_LIBDIR="$PWD/usr/lib64/pkgconfig/" pkg-config --libs

--cflags libkeyutils

Quoted 1 line

-lkeyutils

And more importantly upstream has libkeyutils.pc.in [1] (not keyutils-libs.pc).

Thanks for the detailed demo, it seems things not like what I assumed, and I misunderstood on something about libkeyutils. Your patch looks correct, and no need to modify it.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210113/517aaa51/attachment-0001.htm>
#7 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

In reply to Petr Vorel
Quoted 1 line · Petr Vorel

Using pkg-config is less error prone during cross compilation.

Hi Petr,

Is there any detailed example about the above point?

Quoted 6 lines

---
Hi,

if you agree with this, I'll replace (probably after release) ACL_LIBS, CAP_LIBS, CRYPTO_LIBS, SELINUX_LIBS (to follow libmnl and libtirpc).

It is OK for me.

Best Regards,
Xiao Yang

Quoted 132 lines

libaio and libnuma does not support pkg-config.

Tested: https://travis-ci.org/github/pevik/ltp/builds/753925166

Kind regards,
Petr

 configure.ac                                   |  2 +-
 include/mk/config.mk.in                        |  6 +++---
 m4/ltp-keyutils.m4                             | 10 ----------
 m4/ltp-libkeyutils.m4                          |  8 ++++++++
 testcases/cve/Makefile                         |  2 +-
 testcases/kernel/syscalls/add_key/Makefile     |  2 +-
 testcases/kernel/syscalls/keyctl/Makefile      |  2 +-
 testcases/kernel/syscalls/request_key/Makefile |  2 +-
 8 files changed, 16 insertions(+), 18 deletions(-)
 delete mode 100644 m4/ltp-keyutils.m4
 create mode 100644 m4/ltp-libkeyutils.m4
configure.ac +1 -1
index 06be1c094..8d667eb1e 100644
@@ -328,7 +328,7 @@ LTP_CHECK_CLONE_SUPPORTS_7_ARGS
 LTP_CHECK_CRYPTO
 LTP_CHECK_FORTIFY_SOURCE
 LTP_CHECK_KERNEL_DEVEL
-LTP_CHECK_KEYUTILS_SUPPORT
+LTP_CHECK_LIBKEYUTILS
 LTP_CHECK_LIBMNL
 LTP_CHECK_LINUX_PTRACE
 LTP_CHECK_LINUXRANDOM
include/mk/config.mk.in +3 -3
index 218447ef3..382b7fda2 100644
@@ -52,12 +52,12 @@ LEXLIB			:= @LEXLIB@
 NUMA_LIBS		:= @NUMA_LIBS@
 SELINUX_LIBS		:= @SELINUX_LIBS@
 HAVE_RPC		:= @HAVE_RPC@
-LIBTIRPC_CFLAGS		:= @LIBTIRPC_CFLAGS@
-LIBTIRPC_LIBS		:= @LIBTIRPC_LIBS@
-KEYUTILS_LIBS		:= @KEYUTILS_LIBS@
 HAVE_FTS_H		:= @HAVE_FTS_H@
+LIBKEYUTILS_LIBS	:= @LIBKEYUTILS_LIBS@
 LIBMNL_LIBS		:= @LIBMNL_LIBS@
 LIBMNL_CFLAGS		:= @LIBMNL_CFLAGS@
+LIBTIRPC_CFLAGS		:= @LIBTIRPC_CFLAGS@
+LIBTIRPC_LIBS		:= @LIBTIRPC_LIBS@
 
 prefix			:= @prefix@
 
m4/ltp-keyutils.m4 deleted +0 -10
deleted file mode 100644
index 451c549f3..000000000
@@ -1,10 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2016 Fujitsu Ltd.
-dnl Copyright (c) 2017 Petr Vorel <[email protected]>
-dnl Author: Xiao Yang <[email protected]>
-
-AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT], [
-	AC_CHECK_LIB([keyutils], [add_key],
-	[AC_DEFINE(HAVE_LIBKEYUTILS, 1, [Define to 1 if you have libkeyutils installed.])
-	      AC_SUBST(KEYUTILS_LIBS, "-lkeyutils")])
-])
m4/ltp-libkeyutils.m4 new file +8 -0
new file mode 100644
index 000000000..f5d128969
@@ -0,0 +1,8 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2020 Petr Vorel <[email protected]>
+
+AC_DEFUN([LTP_CHECK_LIBKEYUTILS], [
+    PKG_CHECK_MODULES([LIBKEYUTILS], [libkeyutils], [
+        AC_DEFINE([HAVE_LIBKEYUTILS], [1], [Define to 1 if you have libkeyutils library and headers])
+	], [have_libkeyutils=no])
+])
testcases/cve/Makefile +1 -1
index da44fff60..90921dd85 100644
@@ -21,7 +21,7 @@ CFLAGS			+= -D_GNU_SOURCE
 
 stack_clash:	CFLAGS += -fno-optimize-sibling-calls
 
-cve-2016-7042:	LDLIBS += $(KEYUTILS_LIBS)
+cve-2016-7042:	LDLIBS += $(LIBKEYUTILS_LIBS)
 
 cve-2016-7117:	CFLAGS += -pthread
 cve-2016-7117:	LDLIBS += -lrt
testcases/kernel/syscalls/add_key/Makefile +1 -1
index 0f51e0bc2..6c2102247 100644
@@ -5,6 +5,6 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += $(KEYUTILS_LIBS)
+LDLIBS  += $(LIBKEYUTILS_LIBS)
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/keyctl/Makefile +1 -1
index 180ece25a..343c5e359 100644
@@ -5,7 +5,7 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS	+= $(KEYUTILS_LIBS)
+LDLIBS	+= $(LIBKEYUTILS_LIBS)
 keyctl02: LDLIBS	+= -lpthread
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/request_key/Makefile +1 -1
index 58a99875e..e69774b96 100644
@@ -6,6 +6,6 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS		+= $(KEYUTILS_LIBS)
+LDLIBS		+= $(LIBKEYUTILS_LIBS)
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
author
#8 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Hi Yang,

Quoted 5 lines · Petr Vorel
Quoted 1 line

Using pkg-config is less error prone during cross compilation.

Hi Petr,

Is there any detailed example about the above point?

Sometimes I experienced problems during cross compilation with installed library for build architecture but missing library for host architecture build failed during linking because library was expected but missing.

But I it turned out to be when using our CROSS_COMPILE implementation (without specifying --host). When configuring with just --host libraries are properly detected with AC_CHECK_LIB().

pkg-config has some pros and cons.
Pros:
* easily require specific library version
* getting CFLAGS from *.pc file
* IMHO it's a standard way nowadays

Cons:
* For cross compilation it's reuired to set correctly PKG_CONFIG_LIBDIR.

I brought pkg-config as dependency to LTP due checking libtirpc >= 0.2.4. But this version is already 7 years old so we might not need this version check now. (and one day it'd be best to fix (or rewrite from scratch) rpc/tirpc tests and move them to libtirpc upstream as Sun-RPC was removed from glibc in 2.32).

Thus we can safely reconsider if we want pkg-config or not.

Kind regards,
Petr

#9 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Quoted 6 lines · Petr Vorel

Hi Yang,

Quoted 4 lines · Petr Vorel
Quoted 1 line

Using pkg-config is less error prone during cross compilation.

Hi Petr,
Is there any detailed example about the above point?

Quoted 7 lines

Sometimes I experienced problems during cross compilation with installed library for build architecture but missing library for host architecture build failed during linking because library was expected but missing.

But I it turned out to be when using our CROSS_COMPILE implementation (without specifying --host). When configuring with just --host libraries are properly detected with AC_CHECK_LIB().

Hi Petr,

Does the issue only happened when we use ./configure without --host? In an other word, AC_CHECK_LIB() can detect proper installed libraries for build architecture by './configure --host', right?

Quoted 8 lines

pkg-config has some pros and cons.
Pros:
* easily require specific library version
* getting CFLAGS from *.pc file
* IMHO it's a standard way nowadays

Cons:
* For cross compilation it's reuired to set correctly PKG_CONFIG_LIBDIR.

Current ltp mixes pkg-config and AC_CHECK_LIB() so I want to unify them. We cannot use pkg-config for all libraries because some packages don't provide *.pc files.

Best Regards,
Xiao Yang

Quoted 13 lines

I brought pkg-config as dependency to LTP due checking libtirpc>= 0.2.4. But this version is already 7 years old so we might not need this version check now. (and one day it'd be best to fix (or rewrite from scratch) rpc/tirpc tests and move them to libtirpc upstream as Sun-RPC was removed from glibc in 2.32).

Thus we can safely reconsider if we want pkg-config or not.

Kind regards,
Petr

.

author
#10 lore raw

PATCH 1/1 autoconf: Use pkg-config for keyutils detection

Quoted 11 lines · Petr Vorel
Quoted 9 lines

Hi Yang,

Quoted 4 lines · Petr Vorel
Quoted 1 line

Using pkg-config is less error prone during cross compilation.

Hi Petr,
Is there any detailed example about the above point?

Sometimes I experienced problems during cross compilation with installed library for build architecture but missing library for host architecture build failed during linking because library was expected but missing.

Quoted 8 lines
Quoted 3 lines

But I it turned out to be when using our CROSS_COMPILE implementation (without specifying --host). When configuring with just --host libraries are properly detected with AC_CHECK_LIB().

Hi Petr,

Does the issue only happened when we use ./configure without --host? In an other word, AC_CHECK_LIB() can detect proper installed libraries for build architecture by './configure --host', right?

Yes (but it cannot detect library version).

Quoted 11 lines
Quoted 8 lines

pkg-config has some pros and cons.
Pros:
* easily require specific library version
* getting CFLAGS from *.pc file
* IMHO it's a standard way nowadays

Cons:
* For cross compilation it's reuired to set correctly PKG_CONFIG_LIBDIR.

Current ltp mixes pkg-config and AC_CHECK_LIB() so I want to unify them. We cannot use pkg-config for all libraries because some packages don't provide *.pc files.

Yes. But if you want to remove pkg-config, I'd wait for others opinions about it :).

Kind regards,
Petr

Quoted 14 lines

Best Regards,
Xiao Yang

Quoted 12 lines

I brought pkg-config as dependency to LTP due checking libtirpc>= 0.2.4. But this version is already 7 years old so we might not need this version check now. (and one day it'd be best to fix (or rewrite from scratch) rpc/tirpc tests and move them to libtirpc upstream as Sun-RPC was removed from glibc in 2.32).

Thus we can safely reconsider if we want pkg-config or not.

Kind regards,
Petr

.