diff mbox series

[1/3] package/socat: fix printf feature detection

Message ID 996e9db6fa29e5b1c59d7ecf3e84da781bace4ee.1667288516.git.baruch@tkos.co.il
State Accepted
Headers show
Series [1/3] package/socat: fix printf feature detection | expand

Commit Message

Baruch Siach Nov. 1, 2022, 7:41 a.m. UTC
socal configure uses AC_TRY_RUN to detect printf features. This does not
work for cross compilation.

All C libraries we use support C99 snprintf. Only glibc and uClibc
support the deprecated Z modifier.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 package/socat/socat.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Thomas Petazzoni Nov. 1, 2022, 8:29 p.m. UTC | #1
On Tue,  1 Nov 2022 09:41:54 +0200
Baruch Siach via buildroot <buildroot@buildroot.org> wrote:

> socal configure uses AC_TRY_RUN to detect printf features. This does not
> work for cross compilation.
> 
> All C libraries we use support C99 snprintf. Only glibc and uClibc
> support the deprecated Z modifier.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  package/socat/socat.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)

How did you notice this issue? I see no autobuilder failure. If it
wasn't working for cross-compilation, we should have build failures, no?

Or are bad results of these ./configure tests only causing runtime
issues? Could you elaborate a bit?

Thanks!

Thomas
Baruch Siach Nov. 1, 2022, 8:43 p.m. UTC | #2
Hi Thomas,

On Tue, Nov 01 2022, Thomas Petazzoni wrote:
> On Tue,  1 Nov 2022 09:41:54 +0200
> Baruch Siach via buildroot <buildroot@buildroot.org> wrote:
>
>> socal configure uses AC_TRY_RUN to detect printf features. This does not
>> work for cross compilation.
>> 
>> All C libraries we use support C99 snprintf. Only glibc and uClibc
>> support the deprecated Z modifier.
>> 
>> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
>> ---
>>  package/socat/socat.mk | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>
> How did you notice this issue? I see no autobuilder failure. If it
> wasn't working for cross-compilation, we should have build failures, no?
>
> Or are bad results of these ./configure tests only causing runtime
> issues? Could you elaborate a bit?

We are just getting wrong result that leads to sub-optimal code. The
build does not break though. I noticed the issue by looking for
AC_TRY_RUN in configure.ac.

baruch
Thomas Petazzoni Nov. 5, 2022, 10:49 p.m. UTC | #3
On Tue,  1 Nov 2022 09:41:54 +0200
Baruch Siach via buildroot <buildroot@buildroot.org> wrote:

> socal configure uses AC_TRY_RUN to detect printf features. This does not
> work for cross compilation.
> 
> All C libraries we use support C99 snprintf. Only glibc and uClibc
> support the deprecated Z modifier.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  package/socat/socat.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)

Applied to master, thanks.

Thomas
Peter Korsgaard Nov. 14, 2022, 7:37 p.m. UTC | #4
>>>>> "Baruch" == Baruch Siach via buildroot <buildroot@buildroot.org> writes:

 > socal configure uses AC_TRY_RUN to detect printf features. This does not
 > work for cross compilation.

 > All C libraries we use support C99 snprintf. Only glibc and uClibc
 > support the deprecated Z modifier.

 > Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Committed to 2022.08.x and 2022.02.x, thanks.
diff mbox series

Patch

diff --git a/package/socat/socat.mk b/package/socat/socat.mk
index e20577492d86..c1bf4d260f61 100644
--- a/package/socat/socat.mk
+++ b/package/socat/socat.mk
@@ -11,6 +11,14 @@  SOCAT_LICENSE = GPL-2.0 with OpenSSL exception
 SOCAT_LICENSE_FILES = README COPYING COPYING.OpenSSL
 SOCAT_CPE_ID_VENDOR = dest-unreach
 
+SOCAT_CONF_ENV = ac_cv_have_c99_snprintf=yes
+
+ifeq ($(BR2_TOOLCHAIN_USES_GLIBC)$(BR2_TOOLCHAIN_USES_UCLIBC),y)
+SOCAT_CONF_ENV += ac_cv_have_z_modifier=yes
+else
+SOCAT_CONF_ENV += ac_cv_have_z_modifier=no
+endif
+
 ifeq ($(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),y)
 SOCAT_CONF_ENV += \
 	sc_cv_sys_crdly_shift=12 \