[SOLVED] Unable to link additional lib file (libc.a etc)

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

  • [SOLVED] Unable to link additional lib file (libc.a etc)

    I have a project that requires libc.a. I know this because when I try to build it, I get the following error at linking stage :-
    cannot find libc.a: No such file or directory.


    I tried a few of the examples on the forum to try and add a path to the library files but none of them work.

    What I have at the moment is, Settings->Library Include Standard Libraries set to NO & and added the path to libc.a in Settings->Linker Aditional Input Files set to $(ProjectDir)/libs.

    Only way I could get it to work is to copy libc.a to the root dir of my solution????

    Please, how do I add libraries to my project the proper way without manually scavenging lib files and pasting them into root of my project dir?

    Oh, I also tried following a guide (looked way too simple to actually work) that made SES use GCC compiler installed separately but that didn't work either...


    I'm using SES release 7.10 on windows 10

    The post was edited 1 time, last by nibbly78 ().

  • Ok, did some more digging. Turns out libc.a is in location C:\Program Files\SEGGER\SEGGER Embedded Studio for ARM 7.10\lib

    So, simply having Settings->Library Include Standard Libraries set to YES should be sufficient but still get same error.
    I also made sure the path was set up correctly which is as follows :- $(StudioLibDir:$(StudioDir)/lib) for Settings->Library Include Standard Libraries Directory

    Lastly, as a test, I treated libc.a as if it were a .c file and added it to my project but that complained that it could not be found as well (find that hard to believe...)

    The post was edited 1 time, last by nibbly78 ().

  • Hi nibbly78,


    Thank you for your inquiry.
    Such an issue is not known to us.
    Could you provide us with a sample project for reproduction?


    Regards,
    Lucas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longerperiods 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.
  • Hello nibbly78,

    Thank you for providing the project.
    The described behavior is caused by a error in your linker script, which seems to come from a third party IDE.
    To avoid the Linker error, simply remove the following lines of your linker script.

    Source Code

    1. /DISCARD/ :
    2. {
    3. libc.a ( * )
    4. libm.a ( * )
    5. libgcc.a ( * )
    6. }
    For more information about the linker script syntax, see the GNU Linker Manual.

    However, we recommend that you create a new project in Embedded Studio using the project wizard and add your sources to it.
    With our CPU Support Packages we offer a project template to create projects directly for the desired device which additionaly set up the SEGGER IDE + toolchain correctly including any libraries etc.
    Here you can find a video explaining how to install CPU Support Packages: segger.com/products/developmen…logy/cpu-support/#gallery
    After that, simply create a new project and use the right template for your device, which was installed with the CPU Support Package.
    How is shown in the following video: segger.com/products/developmen…ect-management/#gallery-1

    On an additional note we saw that the project you provided is meant to be a bootloader project. We have some good news for you there, because we have posted an article in our wiki which explains how to create a solution with bootloader and application in Embedded Studio for a pretty much identical device: wiki.segger.com/Creating_a_sol…ootloader_and_application
    So we recommended to use that guide at least for inspiration to get a good feeling on how to most efficiently work with Embedded Studio.

    Best regards,
    Lucas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longerperiods 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.