[OE-core] [PATCH] perl-native: process -fstack-protector-strong

wenzong.fan at windriver.com wenzong.fan at windriver.com
Mon Jan 16 07:28:03 UTC 2017


From: Wenzong Fan <wenzong.fan at windriver.com>

perl-native provides configuration information for building host perl
modules. This information (includes CCFLAGS, LDFLAGS ...) is based on
the host gcc that used to build perl-native.

While using prebuild perl-native to build perl modules and meet:
1. the prebuild perl-native was built on a host that gcc includes
   option '-fstack-protector-strong';
   (such as CentOS 7 64bits, gcc version 4.8.5)
2. the perl modules (such as libdbi-perl-native) need to be built
   with host gcc;
3. the host gcc does not support '-fstack-protector-strong';
   (such as Ubuntu 14.04 64bits, gcc version 4.8.4)

Then below error occurs:

  gcc: error: unrecognized command line option \
  '-fstack-protector-strong'

Just re-check and replace the gcc option before sstate caches were
populated to sysroot for fixing the issue.

Signed-off-by: Wenzong Fan <wenzong.fan at windriver.com>
---
 meta/recipes-devtools/perl/perl-native_5.24.0.bb | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/meta/recipes-devtools/perl/perl-native_5.24.0.bb b/meta/recipes-devtools/perl/perl-native_5.24.0.bb
index af2ad7b..65d65cd 100644
--- a/meta/recipes-devtools/perl/perl-native_5.24.0.bb
+++ b/meta/recipes-devtools/perl/perl-native_5.24.0.bb
@@ -123,5 +123,17 @@ EOF
 	cat ${SYSROOT_DESTDIR}${bindir}/../nativeperl
 }
 
+SSTATEPOSTUNPACKFUNCS += "perl_sstate_postunpack"
+perl_sstate_postunpack() {
+        if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
+        then
+                tmpdir=`mktemp -d`
+                echo "int main(void) { return 0; }" > $tmpdir/gcctest.c
+                if ! ${CC} -fstack-protector-strong -o $tmpdir/gcctest $tmpdir/gcctest.c > /dev/null 2>&1; then
+                        sed -i -e 's/fstack-protector-strong/fstack-protector/g' ${BUILD_SYS}${libdir_native}/perl-native/perl/${PV}/Config_heavy.pl
+                fi
+        fi
+}
+
 # Fix the path in sstate
 SSTATE_SCAN_FILES += "*.pm *.pod *.h *.pl *.sh"
-- 
2.7.4




More information about the Openembedded-core mailing list