[2/3] adt_installer_internal:fix perl lib version mismatch

Submitted by Hongxu Jia on June 26, 2013, 4:38 a.m.


Message ID 6ddc350b819c49dafaf0b5c6879ad96479052b0b.1372215660.git.hongxu.jia@windriver.com
State Accepted
Commit 487d1fa7b79e89518494986461c157bace842613
Headers show

Commit Message

Hongxu Jia June 26, 2013, 4:38 a.m.
When run "autoreconf" in toolchain, there is an error if the host's perl's
version is not the same as the one in the SDK, the error says that the
executable perl mismatches the perl lib's version.

This is because most of the autotools' scripts use the "#!/usr/bin/perl -w"
which is host perl, but the gnu-configize uses "#! /usr/bin/env perl" which
invokes the perl wrapper in the SDK, and the wrapper will set the PERL5LIB to
the SDK which causes the mismatch. We can make all the perl scripts to use the
host perl or the SDK perl to fix this problem.

[YOCTO #4758]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
 .../installer/adt-installer/scripts/adt_installer_internal         | 7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
index 25c955a..16677e7 100755
--- a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
@@ -220,6 +220,13 @@  for l in $(find $NATIVE_INSTALL_DIR -type l); do
     $SUDO ln -sfn $(readlink $l|sed -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:") $l
+# find out all perl scripts in $OECORE_NATIVE_SYSROOT and modify them
+# replacing the host perl with SDK perl.
+for perl_script in $($SUDO grep -m 1 "^#!.*perl" -rl $OECORE_NATIVE_SYSROOT); do
+    $SUDO sed -i -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" -e \
+        "s: /usr/bin/perl: /usr/bin/env perl:g" $perl_script
 echo_info "\nSuccessfully installed selected native ADT!"