diff mbox series

[U-Boot] Add -pthread to HOSTLOADLIBES_mkimage

Message ID BEFD3339-5C21-407C-85BA-86BA2BB505A4@icognize.de
State Deferred
Delegated to: Tom Rini
Headers show
Series [U-Boot] Add -pthread to HOSTLOADLIBES_mkimage | expand

Commit Message

Benedikt-Alexander Mokroß Dec. 3, 2019, 9:06 a.m. UTC
On some unix distributions, pthread is not automatically linked.
This results in unresolved symbols when e.g. building u-boot via OpenWRT (using LibreSSL) in dumpimage and other host tools when i.E. CONFIG_FIT_SIGNATURE is set.
Using -pthread to link pthread should be portable across all distributions and OS X.

CHANGELOG:
* Added -pthread to HOSTLOADLIBES_mkimage
---
 tools/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.20.1



Benedikt-Alexander Mokroß
Head of Research
iCOGNIZE GmbH

Tel.: +49 (0)60 74 - 310 36 31
Email: benedikt-alexander.mokross@iCOGNIZE.de

Comments

Tom Rini Dec. 6, 2019, 3:13 p.m. UTC | #1
On Tue, Dec 03, 2019 at 09:06:39AM +0000, Benedikt-Alexander Mokroß wrote:

> On some unix distributions, pthread is not automatically linked.
> This results in unresolved symbols when e.g. building u-boot via OpenWRT (using LibreSSL) in dumpimage and other host tools when i.E. CONFIG_FIT_SIGNATURE is set.
> Using -pthread to link pthread should be portable across all distributions and OS X.
> 
> CHANGELOG:
> * Added -pthread to HOSTLOADLIBES_mkimage
> ---
>  tools/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/Makefile b/tools/Makefile
> index 24581adccd..2f122bed8e 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -150,7 +150,8 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CON
>  HOSTCFLAGS_kwbimage.o += \
>  $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
>  HOSTLOADLIBES_mkimage += \
> -$(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
> +$(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") \
> +-pthread
> 
>  # OS X deprecate openssl in favour of CommonCrypto, supress deprecation
>  # warnings on those systems

My first reaction is that it's a bug within openwrt pkg-config files to
not say that -pthread is required.  Would that not be the normal case?
Thanks!
diff mbox series

Patch

diff --git a/tools/Makefile b/tools/Makefile
index 24581adccd..2f122bed8e 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -150,7 +150,8 @@  ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CON
 HOSTCFLAGS_kwbimage.o += \
 $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
 HOSTLOADLIBES_mkimage += \
-$(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
+$(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") \
+-pthread

 # OS X deprecate openssl in favour of CommonCrypto, supress deprecation
 # warnings on those systems