GCC Android交叉编译libgcc crtbegin_so.o crtend_so.o错误

GCC Android交叉编译libgcc crtbegin_so.o crtend_so.o错误,gcc,cross-compiling,glibc,Gcc,Cross Compiling,Glibc,我试图从LTS(Focal Fossa)机器上为目标arm linux Androidabi构建一个GCC交叉编译器 目标源 binutils版本2.34 Linux内核头版本3.10.54(我的Android设备的内核版本) glibc版本2.30 GCC版本9.3.0 建立机器资源 lsb\U发布-a 输出 lscpu 输出(我认为是有用的) binutil版本 ld-v 输出 Linux内核版本 uname-v 输出 glibc版本 /lib/x86_64-linux-gnu/libc.

我试图从LTS(Focal Fossa)机器上为目标arm linux Androidabi构建一个GCC交叉编译器

目标源 binutils版本2.34

Linux内核头版本3.10.54(我的Android设备的内核版本)

glibc版本2.30

GCC版本9.3.0

建立机器资源
lsb\U发布-a

输出
lscpu

输出(我认为是有用的) binutil版本

ld-v

输出 Linux内核版本
uname-v

输出 glibc版本
/lib/x86_64-linux-gnu/libc.so.6-v

输出 目录树 我的构建脚本 funcs.sh->函数脚本

main.sh->main脚本(我运行的脚本)

一切进展顺利,一切顺利

从buildgcc目录
生成所有目标libgcc

或者从buildgcc/armlinux androideabi/libgcc目录
makeall

或者从buildgcc/armlinux androideabi/armv7-a/libgcc目录
makeall

给出了那个错误

/home/home/gcc-cross-build/arm-linux-androideabi/cross-gcc/arm-linux-androideabi/bin/ld: cannot find crtbegin_so.o: No such file or directory
/home/home/gcc-cross-build/arm-linux-androideabi/cross-gcc/arm-linux-androideabi/bin/ld: cannot find crtend_so.o: No such file or directory
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
GNU ld (GNU Binutils for Ubuntu) 2.34
5.4.0-33-generic
GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9) stable release version 2.31.
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 9.3.0.
libc ABIs: UNIQUE IFUNC ABSOLUTE
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
~/gcc-cross-build
| |-- arm-linux-androideabi
|     |-- binutils-2.34 -> *binutils source directory*
|     |-- gcc-9.3.0 -> *gcc source directory*
|     |-- glibc-2.30 -> *glibc source directory*
|     |-- linux-3.10.54 -> *Linux kernel headers source directory*
|     |-- build-binutils -> *binutils build directory*
|     |-- build-gcc -> *gcc build directory*
|     |-- build-glibc -> *glibc build directory*
|     |-- cross-gcc -> *builded gcc cross compiler files directory (prefix)*
|     |-- scripts -> *automaticly gcc cross compiler build scripts directory*
|         |-- build -> *the directory that contain the build scripts that I used here*
#!/bin/bash

traps()
{
    case $1 in
        0)
            set -e
            ;;
        1)
            set +e
            ;;
        * | h)

    esac

    trap 'echo "\
###############################
ERROR  $?  $$ { $BASH_COMMAND }
*******************************
" ' ERR


    trap 'echo -n "\



({[]}) EXIT  $?  $$ { $BASH_COMMAND }



" ' EXIT

trap 'echo $BASH_COMMAND &>> ${OPDIR}/${TARGET}/scripts/build/log/commands' DEBUG


}

set_help()
{
    if !(($#==4))
    then
        echo error
        return 1
    fi
    export opt=($2)
    export opt_t=($3)
    export opt_h=($4)
    export opt_help="$(\
for i in ${!opt[@]};
do
echo -e "\t\t${opt[$i]}\t\b\b\b\b[${opt_t[$i]}]\t\b${opt_h[$i]}";
done\
)"
    export ${1}_help="\
usage $1 [option]
    available options
${opt_help}\
"
    return 0
}

vars()
{
    case $1 in
    s)
        export OPDIR=${HOME}/gcc-cross-build
        export TARGET=$2
        export PREFIX=${OPDIR}/$TARGET/cross-gcc
        export TARGET_PREFIX=$PREFIX/$TARGET
        export PATH=$PATH:$PREFIX/bin
        ;;
    u)
        unset OPDIR
        unset TARGET
        unset PREFIX
        unset TARGET_PREFIX
        export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
        ;;
    * | h)
        echo "$vars_help"
        ;;
    esac
    #. vars.sh u
    #. vars.sh s arm-linux-androideabi
}

clear_all()
{
    cd ${OPDIR}/${TARGET}
    for i in $(ls -d build-*)
    do
    rm -rfv ${i}/*
    done
    rm -rfv cross-gcc/*
}

build_binutils()
{
    cd ${OPDIR}/${TARGET}
    cd build-binutils
    ../binutils-${1}/configure --prefix=$PREFIX --target=$TARGET
    make -j4 all
    make install
}

build_linux()
{
    cd ${OPDIR}/${TARGET}
    cd linux-${1}
    make ARCH=arm INSTALL_HDR_PATH=${TARGET_PREFIX} \
    headers_install
}


build_gcc_com()
{
    cd ${OPDIR}/${TARGET}
    cd build-gcc
    ../gcc-${1}/configure --prefix=$PREFIX --target=$TARGET \
        --with-pkgversion='Alcatel Onetouch Pixi 3(10) v1' \
        --enable-languages=c,c++ --with-newlib
    make -j4 all-gcc
    make install-gcc
}

build_std_lib()
{
    cd ${OPDIR}/${TARGET}
    cd build-glibc
    ../glibc-${1}/configure --prefix=$TARGET_PREFIX --build=$MACHTYPE --host=$TARGET --target=$TARGET \
    --with-headers=${TARGET_PREFIX}/include libc_cv_forced_unwind=yes
    make install-bootstrap-headers=yes install-headers
    make install_root=${TARGET_PREFIX} prefix="" install
}

build_crt_lib()
{
    cd ${OPDIR}/${TARGET}
    cd build-glibc
    make -j4 csu/subdir_lib
    install csu/crt1.o csu/crti.o csu/crtn.o \
    ${TARGET_PREFIX}/lib
    ${TARGET}-gcc -nostdlib -nostartfiles \
    -shared -x c /dev/null -o ${TARGET_PREFIX}/lib/libc.so
    touch ${TARGET_PREFIX}/include/gnu/stubs.h
}


build_libgcc()
{
    cd ${OPDIR}/${TARGET}
    cd build-gcc
    make -j4 all-target-libgcc
    make install-target-libgcc
}

build_libc()
{
    cd ${OPDIR}/${TARGET}
    cd build-glibc
    make -j4 all
    make install
}

build_libstdc()
{
    cd ${OPDIR}/${TARGET}
    cd build-gcc
    make -j4 all
    make install
}
#!/bin/bash

. funcs.sh

vars u

vars s arm-linux-androideabi

echo -n "" | tee ${OPDIR}/${TARGET}/scripts/build/log/commands

traps 0

set_help vars "s u" "- target" "enable_variables disable_variables"

clear_all

build_binutils 2.34 \
| tee ${OPDIR}/${TARGET}/scripts/build/log/binutils.log

build_linux 3.10.54 \
| tee ${OPDIR}/${TARGET}/scripts/build/log/linux.log

build_gcc_com 9.3.0 \
| tee ${OPDIR}/${TARGET}/scripts/build/log/gcc_com.log

build_std_lib 2.30 \
| tee ${OPDIR}/${TARGET}/scripts/build/log/std_lib.log

build_crt_lib \
| tee ${OPDIR}/${TARGET}/scripts/build/log/crt_lib.log

build_libgcc \
| tee ${OPDIR}/${TARGET}/scripts/build/log/libgcc.log

build_libc \
| tee ${OPDIR}/${TARGET}/scripts/build/log/libc.log

build_libstdc \
| tee ${OPDIR}/${TARGET}/scripts/build/log/libstdc.log
/home/home/gcc-cross-build/arm-linux-androideabi/cross-gcc/arm-linux-androideabi/bin/ld: cannot find crtbegin_so.o: No such file or directory
/home/home/gcc-cross-build/arm-linux-androideabi/cross-gcc/arm-linux-androideabi/bin/ld: cannot find crtend_so.o: No such file or directory