Message ID | 3394639.6NgGvCfkNl@devpool47 (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v5] scripts: use pkg-config to locate libcrypto | expand |
On Wed, Jan 13, 2021 at 13:49:12 +0100, Rolf Eike Beer wrote: > Otherwise build fails if the headers are not in the default location. While at > it also ask pkg-config for the libs, with fallback to the existing value. > > Signed-off-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Ben Boeckel <mathstuf@gmail.com> > Cc: stable@vger.kernel.org # 5.6.x Note that keyutils is not in the kernel, so I don't know how useful this is. --Ben
On Wed, Jan 13, 2021 at 10:57:58 -0500, Ben Boeckel wrote: > > Cc: stable@vger.kernel.org # 5.6.x > > Note that keyutils is not in the kernel, so I don't know how useful this > is. Scratch that; I remember a similar patch for keyutils; this is for the kernel. --Ben
On Wed, Jan 13, 2021 at 01:49:12PM +0100, Rolf Eike Beer wrote: > Otherwise build fails if the headers are not in the default location. While at > it also ask pkg-config for the libs, with fallback to the existing value. > > Signed-off-by: Rolf Eike Beer <eb@emlix.com> > Cc: stable@vger.kernel.org # 5.6.x Acked-by: Jarkko Sakkinen <jarkko@kernel.org> /Jarkko
On Wed, Jan 13, 2021 at 01:49:12PM +0100, Rolf Eike Beer wrote: > Otherwise build fails if the headers are not in the default location. While at > it also ask pkg-config for the libs, with fallback to the existing value. > > Signed-off-by: Rolf Eike Beer <eb@emlix.com> > Cc: stable@vger.kernel.org # 5.6.x Acked-by: Jarkko Sakkinen <jarkko@kernel.org> /Jarkko
Am Mittwoch, 13. Januar 2021, 13:49:12 CET schrieb Rolf Eike Beer: > Otherwise build fails if the headers are not in the default location. While > at it also ask pkg-config for the libs, with fallback to the existing > value. Can someone please take this through the kbuild-tree? Noone seems to be interested in picking this up so far. Thanks, Eike
On Tue, Jan 26, 2021 at 2:42 PM Rolf Eike Beer <eb@emlix.com> wrote: > > Am Mittwoch, 13. Januar 2021, 13:49:12 CET schrieb Rolf Eike Beer: > > Otherwise build fails if the headers are not in the default location. While > > at it also ask pkg-config for the libs, with fallback to the existing > > value. > > Can someone please take this through the kbuild-tree? Noone seems to be > interested in picking this up so far. > > Thanks, > > Eike > -- > Rolf Eike Beer, emlix GmbH, http://www.emlix.com > Fon +49 551 30664-0, Fax +49 551 30664-11 > Gothaer Platz 3, 37083 Göttingen, Germany > Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 > Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 > > emlix - smart embedded open source Is 'PKG_CONFIG' necessary? I see many Makefiles hard-coding 'pkg-config'.
Am Dienstag, 26. Januar 2021, 07:30:03 CET schrieb Masahiro Yamada: > On Tue, Jan 26, 2021 at 2:42 PM Rolf Eike Beer <eb@emlix.com> wrote: > > Am Mittwoch, 13. Januar 2021, 13:49:12 CET schrieb Rolf Eike Beer: > > > Otherwise build fails if the headers are not in the default location. > > > While > > > at it also ask pkg-config for the libs, with fallback to the existing > > > value. > > > > Can someone please take this through the kbuild-tree? Noone seems to be > > interested in picking this up so far. > Is 'PKG_CONFIG' necessary? > > I see many Makefiles hard-coding 'pkg-config'. Well, it depends ;) When people use pkgconf then this usually installs a pkg-config alias, too, so that would be no problem. The problem comes when other places in the kernel start copying that code over, and then hardcode pkg-config for stuff that needs a prefixed pkg-config because it is about target code. Given that I would prefer it this way, but YMMV. If it is that variable that blocks integrating I'll change it. Eike
On Tue, Jan 26, 2021 at 5:01 PM Rolf Eike Beer <eb@emlix.com> wrote: > > Am Dienstag, 26. Januar 2021, 07:30:03 CET schrieb Masahiro Yamada: > > On Tue, Jan 26, 2021 at 2:42 PM Rolf Eike Beer <eb@emlix.com> wrote: > > > Am Mittwoch, 13. Januar 2021, 13:49:12 CET schrieb Rolf Eike Beer: > > > > Otherwise build fails if the headers are not in the default location. > > > > While > > > > at it also ask pkg-config for the libs, with fallback to the existing > > > > value. > > > > > > Can someone please take this through the kbuild-tree? Noone seems to be > > > interested in picking this up so far. > > > Is 'PKG_CONFIG' necessary? > > > > I see many Makefiles hard-coding 'pkg-config'. > > Well, it depends ;) > > When people use pkgconf then this usually installs a pkg-config alias, too, so > that would be no problem. The problem comes when other places in the kernel > start copying that code over, and then hardcode pkg-config for stuff that > needs a prefixed pkg-config because it is about target code. > > Given that I would prefer it this way, but YMMV. If it is that variable that > blocks integrating I'll change it. > > Eike > -- > Rolf Eike Beer, emlix GmbH, http://www.emlix.com > Fon +49 551 30664-0, Fax +49 551 30664-11 > Gothaer Platz 3, 37083 Göttingen, Germany > Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 > Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 > > emlix - smart embedded open source What I understood from commit a8a5cd8b472c is the cross-compile prefix is needed only for the target CC. $(CC) -> $(CROSS_COMPILE)pkg-config (i.e. $(PKG_CONFIG)) $(HOSTCC) -> pkg-config For cross-compiling, the prefixing makes sense because $(CC) != $(HOSTCC) In this case, scripts/extract-cert is a host tool compiled by $(HOSTCC), so I do not see a good reason to use $(PKG_CONFIG). If somebody copy-pastes the code without understanding it, that is their problem. Let's do proper engineering. :-) -- Best Regards Masahiro Yamada
diff --git a/scripts/Makefile b/scripts/Makefile index b5418ec587fb..7553692d241f 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -3,6 +3,11 @@ # scripts contains sources for various helper programs used throughout # the kernel for the build process. +PKG_CONFIG ?= pkg-config + +CRYPTO_LIBS = $(shell $(PKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto) +CRYPTO_CFLAGS = $(shell $(PKG_CONFIG) --cflags libcrypto 2> /dev/null) + hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount @@ -14,8 +19,9 @@ hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include -HOSTLDLIBS_sign-file = -lcrypto -HOSTLDLIBS_extract-cert = -lcrypto +HOSTLDLIBS_sign-file = $(CRYPTO_LIBS) +HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS) +HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS) ifdef CONFIG_UNWINDER_ORC ifeq ($(ARCH),x86_64)
Otherwise build fails if the headers are not in the default location. While at it also ask pkg-config for the libs, with fallback to the existing value. Signed-off-by: Rolf Eike Beer <eb@emlix.com> Cc: stable@vger.kernel.org # 5.6.x --- scripts/Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) This has been sent multiple times since more than 2 year, please pick it up through whatever tree. I need to patch every new stable kernel version to make them build in our chrooted environment.