[OE-core] [PATCH] RFC, DO-NOT-MERGE gcc-cross: don't create symlinks for tools which don't exist

Martin Jansa martin.jansa at gmail.com
Thu Apr 3 14:26:58 UTC 2014


* RFC only, because it maybe doesn't fix any real issue (I've noticed
  only because I was comparing 2 sysroots debuging some other issues and
  was wondering why we have so many dangling symlinks).

* first symlink is bypassing sstate (created in
  ${STAGING_DIR_NATIVE} instead of ${D}${STAGING_DIR_NATIVE}) this is
  maybe worth fixing

* was g++ omitted intentionally from symlinks?

* should binutils provided tools be created by binutils recipes? Or was
  it simplified like this, so that binutils don't need to know gcc's BINV?

* the same does apply to gcc-cross-initial and gcc-cross-canadian, so if
  we decide to implement this or something similar it should cover all 3

* g77 and gfortran aren't created by default, so it was creating dangling
  symlinks, which probably doesn't hurt

* I've tested that resulting image/ looks the same before and after this
  patch with exception of g++ link (and possibly gfortran one when
  enabled).

Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
---
 meta/recipes-devtools/gcc/gcc-cross.inc | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc
index 777c970..c99923f 100644
--- a/meta/recipes-devtools/gcc/gcc-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross.inc
@@ -148,14 +148,22 @@ do_install () {
     
 	# Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77
 	# gfortran is fully backwards compatible. This is a safe and practical solution. 
-	ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
-
+	if [ -f ${D}${STAGING_DIR_NATIVE}${prefix_native}/bin/${MULTIMACH_TARGET_SYS}/${TARGET_PREFIX}gfortran ] ; then
+		ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${D}${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
+	fi
 	
 	# Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
 	# found. These need to be relative paths so they work in different locations.
 	dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
 	install -d $dest
-	for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+	for t in g77 gcc g++ cpp gfortran; do
+		if [ -f ${D}${STAGING_DIR_NATIVE}${prefix_native}/bin/${MULTIMACH_TARGET_SYS}/${TARGET_PREFIX}$t ] ; then
+			ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
+			ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
+		fi
+	done
+	# these aren't provided by gcc, so add them without existence check
+	for t in ar as ld nm objcopy objdump ranlib strip; do
 		ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
 		ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
 	done
-- 
1.9.1




More information about the Openembedded-core mailing list