This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TM4C1294NCPDT: How to link a lib in the GNU compiler

Part Number: TM4C1294NCPDT

Tool/software: Code Composer Studio

Simple...  On the subject line.

I am using CCS 6.2, set to GNU c4.9.3 Linaro.   (I have already burned myself out on the TI compiler, I thought I would try this one... )

I am trying to link a library, but the linker says unable to location...

In the project settings, under GNU Linker | Libraries,  I added the search path 

"C:\ti\tirtos_tivac_2_16_01_14\products\ndk_2_25_00_09\packages\ti\ndk\netctrl\lib"

And the lib 

"netctrl_min_ipv4.am4fg"

Which is clearly present on the file system  However, the linker reports "cannot find -lnetctrl_min_ipv4.am4fg"

In the rest of the world, GCC/GNU build tools ignore the leading"lib" and trailing ".a".   But in TI world, these libs have no leading or trailing prefixes.

I can see the list of libraries in the linker.cmd script, but these are "wrapped" in a "INPUT( ...) " block.  So, something, somewhere is creating this list, because it's auto-generated, and something, somewhere else is altering the lib names to something which the linker understands.

What is the secret to getting the GNU linker to properly link these libs?

Thanks.

-CSW

  • Hello,

    Christopher Weber said:
    In the rest of the world, GCC/GNU build tools ignore the leading"lib" and trailing ".a".   But in TI world, these libs have no leading or trailing prefixes.

    Christopher Weber said:
    What is the secret to getting the GNU linker to properly link these libs?

    pre-pend the library name with a colon ( ":netctrl_min_ipv4.am4fg")

    this will cause the linker to treat the name as literal instead of needing the leading "lib" and trailing ".a"

    -l:netctrl_min_ipv4.am4fg

    Thanks

    ki

  • Awesome! Thanks!

    By the way, is this actually documented anywhere?

    -CSW
  • It should be documented in the GCC linker documentation (though not all seem to document the behavior).

    www.eecs.umich.edu/.../Linker.pdf (page 14 for the PDF or page 8 of the document)

    -l namespec
    --library=namespec
    Add the archive or object file specified by namespec to the list of files to link.
    This option may be used any number of times. If namespec is of the form
    ‘:filename’, ld will search the library path for a file called filename, otherwise
    it will search the library path for a file called ‘libnamespec.a’.
  • Well, that explains some of why I've never seen it. I use DSO's in Linux for shared, and just regular archive files for static libraries. Archives just get linked on the command line like regular object code.

    Thanks. One roadblock removed!

    -CSW
  • Ki-Soo

    This is not working.

    I am attempting to link some library that I was told to use.  I can see the file *on my file system*.  I see it is in the path.  Here is the make file command, I cut from the console.

    'Invoking: ARM Linker'
    "C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.3.LTS/bin/armcl" -mv7A8 --code_state=32 -me --define=am3359 -g --diag_warning=225 --diag_wrap=off 
    --display_error_number -z -m"BBB_Sample.map" --heap_size=0x800 --stack_size=0x800
    -i"C:/ti/pdk_am335x_1_0_7/packages/ti/transport/ndk/nimu/lib/am335x/a8/release"
    -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.3.LTS/lib"
    -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.3.LTS/include"
    --reread_libs --define=A8_CORE=1 --diag_wrap=off
    --display_error_number --warn_sections --xml_link_info="BBB_Sample_linkInfo.xml"
    --rom_model -o "BBB_Sample.out" "./main.obj" -l"configPkg/linker.cmd" -l:ti.transport.ndk.nimu.aa8fg -llibc.a <Linking> error #10008-D: cannot find file ":ti.transport.ndk.nimu.aa8fg"

    The path is C:/ti/pdk_am335x_1_0_7/packages/ti/transport/ndk/nimu/lib/am335x/a8/release  and the file is -l:ti.transport.ndk.nimu.aa8fg

    But the linker says it cannot find it.

    I am now on CCS 7.2, using the TI compiler  16.9.3 LTS.  This is a project for BBB.

    Any other suggestion?

    -CSW

  • Where is the the library ti.transport.ndk.nimu.aa8fg? I don't see any library search paths being set. Is it in the same location as the active build configuration subfolder?

  • Ki-Soo,

    In that long "code" looking area is the path, which I set with the project properties. You can see the "-i" setting for the path, and the name of the lib file in a "-l" setting.

    However, now when I retest, I am no longer getting the error "cannot find file ":ti.transport.ndk.nimu.aa8fg"

    I cannot explain why today it is working, except for the fact that I closed CCS and restarted it the next day.

    This is not a problem now.  Thanks.
    -CSW
  • Oh wait, I see the issue:

    Christopher Weber said:
    'Invoking: ARM Linker' "C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.3.LTS/bin/armcl"

    That is the TI ARM linker, not GCC. You are building with the TI build tools. The colon prefix for the library name is a GCC thing