Skip to contentSkip to conversation

nss: Fix build on Centos 7

PATCH New Marek Vasut 1 participant 1 message Jun 3, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nss: Fix build on Centos 7

Centos 7 has glibc 2.18 and nss-native build fails due to implicit declaration of function putenv during build. This is because of the Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

putenv(): _XOPEN_SOURCE

      || /* Glibc since 2.19: */ _DEFAULT_SOURCE
      || /* Glibc versions <= 2.19: */ _SVID_SOURCE

and because nss coreconf/Linux.mk only defines

-D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE

So on such system with glibc 2.18, neither macro makes putenv() available. Add -D_XOPEN_SOURCE for the Centos 7 and glibc 2.18 native build case.

Cc Armin Kuster <[email protected]>
Cc Armin Kuster <[email protected]>
Cc Khem Raj <[email protected]>
Cc Richard Purdie <[email protected]>
Cc Ross Burton <[email protected]>
---
 meta-oe/recipes-support/nss/nss_3.64.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-support/nss/nss_3.64.bb +2 -0
index fce5a856e..d4d7a8733 100644
@@ -45,6 +45,8 @@ TDS = "${S}/tentative-dist-staging"
 
 TARGET_CC_ARCH += "${LDFLAGS}"
 
+CFLAGS_append_class-native = " -D_XOPEN_SOURCE "
+
 do_configure_prepend_libc-musl () {
     sed -i -e '/-DHAVE_SYS_CDEFS_H/d' ${S}/nss/lib/dbm/config/config.mk
 }
Signature · 1 line
2.30.2