Link (?) problem using pre-built cross-compiler

I was told to install the latest pre-build (x86_64 to ARM) "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2?revision=ca0cbf9c-9de2-491c-ac48-898b5bbc0443&la=en&hash=68760A8AE66026BCF99F05AC017A6A50C6FD832A",  I renamed the file to remove everything following the "...tar.bz2".  Once installed, I tried running a "hello world" test which fails with several errors.

I hope the "-v" switch is helpful.

I fully admit to only have used compilers installed by a sysadmin.   I have tried googling and reading about everything I could about installing and using the pre-built compiler but I'm just not getting it.  Since everybody has a first time for whatever task they're doing, I'd appreciate any help.  I'm very willing to do my research, so whatever help, info or pointers to help, is appreciated.

I do know that using both -mcpu=cortex-m0plus and -march=armv6 causes a switch conflict so I just told it what the cpu was and let it pick the architecture.

Regarding the test run, I do not know how to get the includes right, and what is left looks to be link errors.  I don't know how to fix that either.

----------

ssh'ing to x86-64 machine running ububtu 20.04, default gcc is 9.3.0.

Installing gcc 10.2.1 which should be a cross-compiler to an ARM Cortex-m0+.


alias gccm=..blah../gcc-10.2.1_m0/gcc-arm-none-eabi/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus'

Running test

$ gccm -v scott/gccsrc/hello.c
Using built-in specs.
COLLECT_GCC=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/lto-wrapper
Target: arm-none-eabi
Configured with: /mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/src/gcc/configure --target=arm-none-eabi --prefix=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native --libexecdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/lib --infodir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/arm-none-eabi --build=x86_64-linux-gnu --host=x86_64-linux-gnu --with-gmp=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-mpfr=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-mpc=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-isl=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-libelf=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Arm Embedded Toolchain 10-2020-q4-major' --with-multilib-list=rmprofile,aprofile
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 10.2.1 20201103 (release) (GNU Arm Embedded Toolchain 10-2020-q4-major)
COLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-v' '-mfloat-abi=soft' '-mthumb' '-march=armv6s-m'
 /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/cc1 -quiet -v -imultilib thumb/v6-m/nofp -iprefix /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/ -isysroot /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi -D__USES_INITFINI__ scott/gccsrc/hello.c -quiet -dumpbase hello.c -mcpu=cortex-m0plus -mfloat-abi=soft -mthumb -march=armv6s-m -auxbase hello -version -o /tmp/ccWn3kSy.s
GNU C17 (GNU Arm Embedded Toolchain 10-2020-q4-major) version 10.2.1 20201103 (release) (arm-none-eabi)
        compiled by GNU C version 4.8.4, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/10.2.1/include"
ignoring nonexistent directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/usr/local/include"
ignoring duplicate directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/10.2.1/include-fixed"
ignoring duplicate directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/include"
ignoring nonexistent directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/include
 /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/include-fixed
 /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/include
End of search list.
GNU C17 (GNU Arm Embedded Toolchain 10-2020-q4-major) version 10.2.1 20201103 (release) (arm-none-eabi)
        compiled by GNU C version 4.8.4, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e9addb35ad3a920a846c18a834db924d
COLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-v' '-mfloat-abi=soft' '-mthumb' '-march=armv6s-m'
 /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/as -v -march=armv6s-m -mfloat-abi=soft -meabi=5 -o /tmp/ccizQoAu.o /tmp/ccWn3kSy.s
GNU assembler version 2.35.1 (arm-none-eabi) using BFD version (GNU Arm Embedded Toolchain 10-2020-q4-major) 2.35.1.20201028
COMPILER_PATH=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/lib/thumb/v6-m/nofp/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-v' '-mfloat-abi=soft' '-mthumb' '-march=armv6s-m'
 /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/collect2 -plugin /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/liblto_plugin.so -plugin-opt=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccuzQXjx.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc --sysroot=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi -X /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/crti.o /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/crtbegin.o /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/crt0.o -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/lib/thumb/v6-m/nofp -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1 -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/lib /tmp/ccizQoAu.o --start-group -lgcc -lc --end-group /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/crtend.o /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/crtn.o
/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x18): undefined reference to `_exit'
/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-sbrkr.o): in function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-writer.o): in function `_write_r':
writer.c:(.text._write_r+0x10): undefined reference to `_write'
/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-closer.o): in function `_close_r':
closer.c:(.text._close_r+0xc): undefined reference to `_close'
/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-lseekr.o): in function `_lseek_r':
lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek'
/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-readr.o): in function `_read_r':
readr.c:(.text._read_r+0x10): undefined reference to `_read'
/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-fstatr.o): in function `_fstat_r':
fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat'
/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-isattyr.o): in function `_isatty_r':
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'
collect2: error: ld returned 1 exit status
localuser@buildbox:~$

  • OK, several changes to alias' and the gccm script.
    ----------
    m0='/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin'

    alias gccm='$m0/arm-none-eabi-gcc -o hello -mcpu=cortex-m0plus -l=nosys'

    $ gccm ~/scott/gccsrc/hello.c
    ----------
    Results:

    ~$ gccm ~/scott/gccsrc/hello.c
    /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: cannot find -l/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabinosys
    collect2: error: ld returned 1 exit status
    ~$

    ----------

    I currently don't know what this library is, how it differs from "nosys" mentioned in the posts above, and even where it is.  Even Google doesn't find it.

More questions in this forum