diff mbox series

[v2,1/1] package/htpdate: fix static openssl build

Message ID 20220129104425.3724653-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series [v2,1/1] package/htpdate: fix static openssl build | expand

Commit Message

Fabrice Fontaine Jan. 29, 2022, 10:44 a.m. UTC
Fix the following static build failure with openssl raised since bump to
version 1.3.3 in commit 163509a8e0d558e6339c5489f072dfe805e0cc34:

/home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sh4-buildroot-linux-uclibc/10.3.0/../../../../sh4-buildroot-linux-uclibc/bin/ld: /home/buildroot/autobuild/instance-3/output-1/host/sh4-buildroot-linux-uclibc/sysroot/usr/lib/libssl.a(rec_layer_d1.o): in function `DTLS_RECORD_LAYER_new':
rec_layer_d1.c:(.text+0x124): undefined reference to `CRYPTO_malloc'

Fixes:
 - http://autobuild.buildroot.org/results/75ad8515916dfa056b17c97fdd95c7eb4d83a304

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2:
 - Move pkg-config call in htpdate.mk following upstream feedback:
   https://github.com/twekkel/htpdate/pull/17

 ...BS-to-be-configured-from-environment.patch | 37 +++++++++++++++++++
 package/htpdate/htpdate.mk                    |  4 +-
 2 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 package/htpdate/0001-Allow-SSL_LIBS-to-be-configured-from-environment.patch

Comments

Thomas Petazzoni Jan. 30, 2022, 3:02 p.m. UTC | #1
On Sat, 29 Jan 2022 11:44:25 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Fix the following static build failure with openssl raised since bump to
> version 1.3.3 in commit 163509a8e0d558e6339c5489f072dfe805e0cc34:
> 
> /home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sh4-buildroot-linux-uclibc/10.3.0/../../../../sh4-buildroot-linux-uclibc/bin/ld: /home/buildroot/autobuild/instance-3/output-1/host/sh4-buildroot-linux-uclibc/sysroot/usr/lib/libssl.a(rec_layer_d1.o): in function `DTLS_RECORD_LAYER_new':
> rec_layer_d1.c:(.text+0x124): undefined reference to `CRYPTO_malloc'
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/75ad8515916dfa056b17c97fdd95c7eb4d83a304
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> Changes v1 -> v2:
>  - Move pkg-config call in htpdate.mk following upstream feedback:
>    https://github.com/twekkel/htpdate/pull/17

I'm a bit surprised by your feedback to upstream's reaction. Indeed, it
would have been possible in the Makefile to make use of pkg-config if
it's available, and if not fallback to just using -lssl. Preserve the
existing behavior, doesn't make pkg-config mandatory, but allows people
like use to make use of pkg-config.

Anyway, I've applied your patch as-is. And it made me wonder why
host-pkgconf was already part of the package dependencies?

Thomas
diff mbox series

Patch

diff --git a/package/htpdate/0001-Allow-SSL_LIBS-to-be-configured-from-environment.patch b/package/htpdate/0001-Allow-SSL_LIBS-to-be-configured-from-environment.patch
new file mode 100644
index 0000000000..6dca2babab
--- /dev/null
+++ b/package/htpdate/0001-Allow-SSL_LIBS-to-be-configured-from-environment.patch
@@ -0,0 +1,37 @@ 
+From 4ba90fedd553c3b06c925fb6ff5245a5dcabace9 Mon Sep 17 00:00:00 2001
+From: Eddy Vervest <eddy@vervest.org>
+Date: Sat, 29 Jan 2022 10:58:13 +0100
+Subject: [PATCH] Allow SSL_LIBS to be configured from environment
+
+[Retrieved from:
+https://github.com/twekkel/htpdate/commit/4ba90fedd553c3b06c925fb6ff5245a5dcabace9]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ Makefile | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 4796efa..cf077e6 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,8 +2,9 @@ prefix = $(DESTDIR)/usr
+ bindir = ${prefix}/sbin
+ mandir = ${prefix}/share/man
+ 
+-CC     ?= gcc
+-CFLAGS += -Wall -std=c11 -pedantic -O2
++CC       ?= gcc
++CFLAGS   += -Wall -std=c11 -pedantic -O2
++SSL_LIBS ?= -lssl
+ 
+ INSTALL ?= install -c
+ STRIP   ?= strip -s
+@@ -14,7 +15,7 @@ htpdate: htpdate.c
+ 	$(CC) $(CFLAGS) -o htpdate htpdate.c
+ 
+ https: htpdate.c
+-	$(CC) $(CFLAGS) -DENABLE_HTTPS -o htpdate htpdate.c -lssl
++	$(CC) $(CFLAGS) -DENABLE_HTTPS -o htpdate htpdate.c $(SSL_LIBS)
+ 
+ install: all
+ 	$(STRIP) htpdate
diff --git a/package/htpdate/htpdate.mk b/package/htpdate/htpdate.mk
index 54b3ec2569..e32480fc85 100644
--- a/package/htpdate/htpdate.mk
+++ b/package/htpdate/htpdate.mk
@@ -10,7 +10,9 @@  HTPDATE_LICENSE = GPL-2.0+
 HTPDATE_LICENSE_FILES = LICENSE
 
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
-HTPDATE_BUILD_OPTS = https
+HTPDATE_BUILD_OPTS = \
+	https \
+	SSL_LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs openssl`"
 HTPDATE_DEPENDENCIES += openssl host-pkgconf
 endif