Skip to contentSkip to conversation

package/ustr: Fix musl build by forcing glibc detection to true

PATCH New Bernd Kuhls 2 participants 3 messages May 21, 2016 – May 22, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/ustr: Fix musl build by forcing glibc detection to true

Fixes
http://autobuild.buildroot.net/results/f51/f5115516bd514afbb71a9460e82c889bcc18e7e2/

---
 package/ustr/0001-force-glibc.patch | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 package/ustr/0001-force-glibc.patch
package/ustr/0001-force-glibc.patch new file +26 -0
new file mode 100644
index 0000000..1300dfe
@@ -0,0 +1,26 @@
+Fix musl build by forcing glibc detection to true
+
+Ustr has no autoconf support, we use a Debian patchset which provides
+it. This patchset uses __GLIBC__ to check for vsnprintf support:
+
+https://sources.debian.net/src/ustr/1.0.4-5/debian/patches/fixes/autoconf.diff/#L1726
+
+This check is true for glibc and uClibc, but not for musl because it does
+not define __GLIBC__. If the test fails configure.ac stops when cross
+compiling:
+
+https://sources.debian.net/src/ustr/1.0.4-5/debian/patches/fixes/autoconf.diff/#L1773
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+
+--- ustr-1.0.4/configure.ac.orig	2016-05-21 18:08:02.000000000 +0200
++++ ustr-1.0.4/configure.ac	2016-05-21 18:18:47.170881727 +0200
+@@ -24,7 +24,7 @@
+ int version = __GLIBC__;
+ 	]])],
+ 	[AC_MSG_RESULT([yes]); GLIBC_USED=1;],
+-	[AC_MSG_RESULT([no]); GLIBC_USED=0;])
++	[AC_MSG_RESULT([no]); GLIBC_USED=1;])
+ 
+ # check if vsnprintf() is retarded
+ define([check_vsnprintf_retarded_code], [[AC_LANG_SOURCE([[
Signature · 1 line
2.8.1
#1 lore raw

PATCH 1/1 package/ustr: Fix musl build by forcing glibc detection to true

Am Sat, 21 May 2016 18:28:17 +0200 schrieb Bernd Kuhls:

Quoted 2 lines

Fixes
http://autobuild.buildroot.net/results/f51/

f5115516bd514afbb71a9460e82c889bcc18e7e2/

Hi,

please note that later on the build with this defconfig fails at libsemanage:

genhomedircon.lo: In function `semanage_genhomedircon':
genhomedircon.c:(.text+0x18b8): undefined reference to `getpwent_r'

This was never noticed before because libsemanage depends on ustr which was broken on musl until now.

Regards, Bernd

#2 lore raw

PATCH 1/1 package/ustr: Fix musl build by forcing glibc detection to true

In reply to Bernd Kuhls

Hello,

package/ustr/0001-force-glibc.patch line 23

Quoted 8 lines · Bernd Kuhls

+--- ustr-1.0.4/configure.ac.orig 2016-05-21 18:08:02.000000000 +0200
++++ ustr-1.0.4/configure.ac 2016-05-21 18:18:47.170881727 +0200
+@@ -24,7 +24,7 @@
+ int version = __GLIBC__;

package/ustr/0001-force-glibc.patch new file +4 -0
+ 	]])],
+ 	[AC_MSG_RESULT([yes]); GLIBC_USED=1;],
+-	[AC_MSG_RESULT([no]); GLIBC_USED=0;])
++	[AC_MSG_RESULT([no]); GLIBC_USED=1;])

I know this is the easiest/shortest fix, but it's not very pretty. The good solution IMHO is to remove this glibc check completely, and instead use AC_CACHE_VAL() so that a cache variable allows to override the result of the AC_TRY_RUN() test.

That being said, you said in a reply that libsemanage, which is the only package that uses ustr, does not build with musl due to getpwent_r() being missing. getpwent_r() is a glibc-specific extension, so it will most likely not be implemented by musl. So either libsemanage can be changed to use getpwent() (making sure that libsemanage didn't need the reentrant characteristic of getpwent_r), or we should simply make libsemanage/ustr not available on musl.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com