[SOLVED] SES external build fails on linking

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] SES external build fails on linking

    I extracted content of the .tar gcc-arm-none-eabi 2020 to my projects folder on the MacOS. I added toolchain folder to SES and I am able to build the source files, but it fails immediately on linking.
    I created new project, so it just contains boilerplate files for CortexM. I dont use any external library. Seems like some option in the SES makes something weird in the linker command, but I cant figure out which ..

    Source Code

    1. 1> /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/collect2 -plugin /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/liblto_plugin.so -plugin-opt=/tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/lto-wrapper -plugin-opt=-fresolution=/var/folders/fq/1k29xj916kbbcn6m8jjbkkqw0000gn/T//ccLgHk0K.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc --sysroot=/tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../arm-none-eabi -EL -X -o Output/Debug External/Exe/gccTest.elf /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/thumb/v7e-m+fp/hard/crti.o /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/thumb/v7e-m+fp/hard/crtbegin.o /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/crt0.o -L/tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/thumb/v7e-m+fp/hard -L/tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard -L/tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../arm-none-eabi/lib/thumb/v7e-m+fp/hard -L/tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1 -L/tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc -L/tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib -L/tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../arm-none-eabi/lib --gc-sections --start-group -lgcc -lnosys Output/gccTest Debug External/Obj/SEGGER_RTT.o Output/gccTest Debug External/Obj/SEGGER_RTT_Syscalls_GCC.o Output/gccTest Debug External/Obj/main.o Output/gccTest Debug External/Obj/HardFaultHandler.o Output/gccTest Debug External/Obj/SEGGER_HardFaultHandler.o Output/gccTest Debug External/Obj/startup_ARMCM_GCC.o -Map=Output/Debug External/Exe/gccTest.map -lstdc++ -lm -lc --start-group -lgcc -lc --end-group /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/thumb/v7e-m+fp/hard/crtend.o /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/thumb/v7e-m+fp/hard/crtn.o -T Setup/flash.ld
    2. 1> /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: missing --end-group; added as last command line option
    3. 1> /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: cannot find -lc
    4. 1> /tmp/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: cannot find -lc
    5. 1> collect2: error: ld returned 1 exit status
    6. Build failed

    there are only two places in this output which contains --start-group, where first one doesnt contain --end-group

    this one doesnt have --end-group.

    Source Code

    1. --gc-sections --start-group -lgcc -lnosys Output/gccTest Debug External/Obj/SEGGER_RTT.o


    And then the other one contains -lc parameter which I would assume is somehow interpreted as a c library ? But it cant find it on the filesystem ?

    Any idea why am I getting these linker errors and how to fix that ?
  • I fixed this problem, but will still leave the original question as it might help someone else with the same issue.
    As I suspected originally, it was related to the c library, libc.a on the mac os.
    .tar.gz was "corrupted' in a way that it didnt re-create symbolic libraries properly. And as libc.a was linked to the libg.a, but link was invalid, linker couldnt find the library.

    Deleting the libc.a sym link and re-linking the libg.a again fixed the issue.
  • Hello,

    Great to hear that you are up and running again.
    For completeness a general guide on how to use external toolchains with ES is explained here:
    wiki.segger.com/Use_an_externa…hain_with_Embedded_Studio

    This thread will be closed now.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.