]> code.ossystems Code Review - openembedded-core.git/commitdiff
gcc-cross: Fix linker and fortran symlinks
authorKhem Raj <raj.khem@gmail.com>
Tue, 11 Jul 2017 14:05:46 +0000 (07:05 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 17 Jul 2017 12:48:57 +0000 (13:48 +0100)
If we used -fuse-ld gcc option, then it does not work
ending in

collect2: fatal error: cannot find 'ld'                                                                                                                                                                                                       compilation terminated.

This is because we are not creating proper symlinks for BFD
and Gold linker in gcc installation

Secondly, we end up with dangling fortran compiler symlinks
if fortran is not enabled when confguring gcc, therefore
create these symlinks only when fortran support is enabled
in gcc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-devtools/gcc/gcc-cross.inc

index b08bc197ba7d92396f21d831947e277ef1997033..1e184a60db24a4a63e2093c28a891f01c55b859b 100644 (file)
@@ -161,17 +161,19 @@ do_install () {
 
        install -d ${D}${target_base_libdir}
        install -d ${D}${target_libdir}
-    
+
        # 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 [ -n "${@d.getVar('FORTRAN')}" ]; then
+               ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
+               fortsymlinks="g77 gfortran"
+       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 ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip gcc cpp $fortsymlinks; do
                ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
                ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
        done