Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22027

gcc android cross compiling libgcc crtbegin_so.o crtend_so.o error

$
0
0

I trying to build a gcc cross compiler for target arm-linux-androideabi from Ubuntu 20.04 LTS machine

tutorial page https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/

target sources

binutils version 2.34 source https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.xz

linux kernel headers version 3.10.54 (my android device`s kernel version) source https://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/linux-3.10.54.tar.xz

glibc version 2.30 source https://ftp.gnu.org/gnu/glibc/glibc-2.30.tar.xz

gcc version 9.3.0 source https://ftp.gnu.org/gnu/gcc/gcc-9.3.0/gcc-9.3.0.tar.xz

build machine sources

lsb_release -a

output:

Distributor ID: UbuntuDescription:    Ubuntu 20.04 LTSRelease:    20.04Codename:   focal

lscpu

output(Which I think is useful):

Architecture:                    x86_64CPU op-mode(s):                  32-bit, 64-bit

binutil version

ld -v

output:

GNU ld (GNU Binutils for Ubuntu) 2.34

linux kernel version

uname -v

output:

5.4.0-33-generic

glibc version

/lib/x86_64-linux-gnu/libc.so.6 -v

output:

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 APARTICULAR PURPOSE.Compiled by GNU CC version 9.3.0.libc ABIs: UNIQUE IFUNC ABSOLUTEFor bug reporting instructions, please see:<https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>

gcc version

gcc --version

output:

gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0

directory tree

~/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*

my build scripts

funcs.sh ->functions script

#!/bin/bashtraps(){    case $1 in        0)            set -e            ;;        1)            set +e            ;;        * | h)    esac    trap 'echo "\###############################ERROR  $?  $$ { $BASH_COMMAND }*******************************"' ERR    trap 'echo -n "\({[]}) EXIT  $?  $$ { $BASH_COMMAND }"' EXITtrap '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[@]};doecho -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}

main.sh ->main script (the script which I run)

#!/bin/bash. funcs.shvars uvars s arm-linux-androideabiecho -n "" | tee ${OPDIR}/${TARGET}/scripts/build/log/commandstraps 0set_help vars "s u""- target""enable_variables disable_variables"clear_allbuild_binutils 2.34 \| tee ${OPDIR}/${TARGET}/scripts/build/log/binutils.logbuild_linux 3.10.54 \| tee ${OPDIR}/${TARGET}/scripts/build/log/linux.logbuild_gcc_com 9.3.0 \| tee ${OPDIR}/${TARGET}/scripts/build/log/gcc_com.logbuild_std_lib 2.30 \| tee ${OPDIR}/${TARGET}/scripts/build/log/std_lib.logbuild_crt_lib \| tee ${OPDIR}/${TARGET}/scripts/build/log/crt_lib.logbuild_libgcc \| tee ${OPDIR}/${TARGET}/scripts/build/log/libgcc.logbuild_libc \| tee ${OPDIR}/${TARGET}/scripts/build/log/libc.logbuild_libstdc \| tee ${OPDIR}/${TARGET}/scripts/build/log/libstdc.log

everything go well and everything builded just

from build-gcc directory make all-target-libgcc

or from build-gcc/arm-linux-androideabi/libgcc directory make all

or from build-gcc/arm-linux-androideabi/armv7-a/libgcc directory make all

gives that error

/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

Viewing all articles
Browse latest Browse all 22027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>