Skip to contentSkip to conversation

package/lmbench: fix build by adjusting LDLIBS logic

PATCH In review Thomas Petazzoni 2 participants 3 messages Dec 4, 2024 – Dec 7, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/lmbench: fix build by adjusting LDLIBS logic

The lmbench package (largely unmaintained upstream, last release in 2006) uses a home-grown build system. The scripts/build script sets LDLIBS to -lm and Buildroot's makefile changes that to:

LDLIBS+=-lm

Except that when Buildroot passes LDLIBS="$(PKG_CONFIG_HOST_BINARY) --libs libtirpc", the LDLIBS variable ends up being equal to:

-ltirpc-lm

Yes, without any space between -ltirpc and -lm.

Due to this, the checks in scripts/build that use ${LDLIBS} all fail, and in particular the test that checks when socklen_t is a known type fails, causing lmbench to provide its own definition, which clashes with the C library headers definition, and therefore causing build failures such as:

bench.h:81:13: error: conflicting types for 'socklen_t'; have 'int'

This commit fixes that by adjusting scripts/build using a patch to properly allow passing additional ${LDLIBS} value, with the needed space to separate the value from -lm.

Fixes:

http://autobuild.buildroot.net/results/f1715de95b46a1d08143e529bd4574bc7dbcfb3e/

We have been unable to determine exactly when this issue was introduced. The first build failure we could find is the one referenced above, which dates back from Aug 19, 2024. Since this date, lmbench has been consistently failing on a very regular basis. However, prior to Aug 19, 2024, the previous failure was from December 2022, and was unrelated. It is unclear what changed in Aug 2024 to cause this issue to surface. The one thing that changed right before commit ce3dedc2 (first failing commit) are changes to genrandconfig, which ensures all autobuilders now generated fully random configurations instead of configurations based on a well-defined list of arch/toolchain configurations. But even with this, this lmbench issue should have appeared earlier, and we have been unable to find a scientific explanation.

---
 ...build-make-it-possible-to-set-LDLIBS.patch | 30 +++++++++++++++++++
 package/lmbench/lmbench.mk                    |  1 -
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 package/lmbench/0005-scripts-build-make-it-possible-to-set-LDLIBS.patch
package/lmbench/0005-scripts-build-make-it-possible-to-set-LDLIBS.patch new file +30 -0
new file mode 100644
index 0000000000..6d5599763e
@@ -0,0 +1,30 @@
+From 2c7ff6989bc6161d8a2cc823d3aa7c9cb1deca80 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Wed, 4 Dec 2024 22:59:31 +0100
+Subject: [PATCH] scripts/build: make it possible to set LDLIBS
+
+LDLIBS is currently unconditionnally set to '-lm', but doesn't allow
+the user to provide additional libraries to link with.
+
+Upstream: dead, last release in 2006
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ scripts/build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/build b/scripts/build
+index 60b755c..4820d80 100755
+--- a/scripts/build
++++ b/scripts/build
+@@ -18,7 +18,7 @@ done
+ 
+ trap 'rm -f ${BASE}$$.s ${BASE}$$.c ${BASE}$$.o ${BASE}$$; exit 1' 1 2 15
+ 
+-LDLIBS=-lm
++LDLIBS="${LDLIBS} -lm"
+ 
+ # check for HP-UX's ANSI compiler
+ echo "main(int ac, char *av[]) { int i; }" > ${BASE}$$.c
+-- 
+2.47.0
+
package/lmbench/lmbench.mk +0 -1
index b0f99ff106..3d942779ad 100644
@@ -26,7 +26,6 @@ LMBENCH_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
 
 define LMBENCH_CONFIGURE_CMDS
 	sed -i 's/CFLAGS=/CFLAGS+=/g' $(@D)/src/Makefile
-	sed -i 's/LDLIBS=/LDLIBS+=/g' $(@D)/scripts/build
 	sed -i '/cd .*doc/d' $(@D)/src/Makefile
 	sed -i '/include/d' $(@D)/src/Makefile
 	touch $@
Signature · 6 lines
2.47.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 45 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The lmbench package (largely unmaintained upstream, last release in 2006) uses a home-grown build system. The scripts/build script sets LDLIBS to -lm and Buildroot's makefile changes that to:

LDLIBS+=-lm

Except that when Buildroot passes LDLIBS="$(PKG_CONFIG_HOST_BINARY) --libs libtirpc", the LDLIBS variable ends up being equal to:

-ltirpc-lm

Yes, without any space between -ltirpc and -lm.

Due to this, the checks in scripts/build that use ${LDLIBS} all fail, and in particular the test that checks when socklen_t is a known type fails, causing lmbench to provide its own definition, which clashes with the C library headers definition, and therefore causing build failures such as:

bench.h:81:13: error: conflicting types for 'socklen_t'; have 'int'

This commit fixes that by adjusting scripts/build using a patch to properly allow passing additional ${LDLIBS} value, with the needed space to separate the value from -lm.

Fixes:

http://autobuild.buildroot.net/results/f1715de95b46a1d08143e529bd4574bc7dbcfb3e/

We have been unable to determine exactly when this issue was introduced. The first build failure we could find is the one referenced above, which dates back from Aug 19, 2024. Since this date, lmbench has been consistently failing on a very regular basis. However, prior to Aug 19, 2024, the previous failure was from December 2022, and was unrelated. It is unclear what changed in Aug 2024 to cause this issue to surface. The one thing that changed right before commit ce3dedc2 (first failing commit) are changes to genrandconfig, which ensures all autobuilders now generated fully random configurations instead of configurations based on a well-defined list of arch/toolchain configurations. But even with this, this lmbench issue should have appeared earlier, and we have been unable to find a scientific explanation.

Quoted 1 line

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Thomas Petazzoni
Quoted 45 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The lmbench package (largely unmaintained upstream, last release in 2006) uses a home-grown build system. The scripts/build script sets LDLIBS to -lm and Buildroot's makefile changes that to:

LDLIBS+=-lm

Except that when Buildroot passes LDLIBS="$(PKG_CONFIG_HOST_BINARY) --libs libtirpc", the LDLIBS variable ends up being equal to:

-ltirpc-lm

Yes, without any space between -ltirpc and -lm.

Due to this, the checks in scripts/build that use ${LDLIBS} all fail, and in particular the test that checks when socklen_t is a known type fails, causing lmbench to provide its own definition, which clashes with the C library headers definition, and therefore causing build failures such as:

bench.h:81:13: error: conflicting types for 'socklen_t'; have 'int'

This commit fixes that by adjusting scripts/build using a patch to properly allow passing additional ${LDLIBS} value, with the needed space to separate the value from -lm.

Fixes:

http://autobuild.buildroot.net/results/f1715de95b46a1d08143e529bd4574bc7dbcfb3e/

We have been unable to determine exactly when this issue was introduced. The first build failure we could find is the one referenced above, which dates back from Aug 19, 2024. Since this date, lmbench has been consistently failing on a very regular basis. However, prior to Aug 19, 2024, the previous failure was from December 2022, and was unrelated. It is unclear what changed in Aug 2024 to cause this issue to surface. The one thing that changed right before commit ce3dedc2 (first failing commit) are changes to genrandconfig, which ensures all autobuilders now generated fully random configurations instead of configurations based on a well-defined list of arch/toolchain configurations. But even with this, this lmbench issue should have appeared earlier, and we have been unable to find a scientific explanation.

Quoted 1 line

Committed to 2024.02.x and 2024.08.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot