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.

Compiler/TMS320TCI6614: Linker error: symbol "fputs" redefined. Link order, --priority doesn't help.

Part Number: TMS320TCI6614

Tool/software: TI C/C++ Compiler

Hi!

I have a floating problem with our project. Last time it occured when I copied project file and tried to use it for an another project. Linking fails with message:

<Linking>

error #10056: symbol "fputs" redefined: first defined in "/.../Our.lib.lib<debug.obj>"; redefined in "/opt/ti/ccs710/ccsv7/tools/compiler/ti-cgt-c6000_8.1.3/lib/rts6600_elf.lib<fputs.obj>"
error #10010: errors encountered during linking; "Module.Our.out" not built

Our.lib.lib contains a system stuff.

Application code in source files.

Linking command:

Invoking: C6000 Linker
"/opt/ti/ccs710/ccsv7/tools/compiler/ti-cgt-c6000_8.1.3/bin/cl6x" -mv6600 -O2 --opt_for_speed=4 -g --define=___ --diag_warning=225 --diag_wrap=off --display_error_number --asm_listing -z -m"Module.Our.map" -i"/opt/ti/ccs710/ccsv7/tools/compiler/ti-cgt-c6000_8.1.3/lib" -i"/opt/ti/ccs710/ccsv7/tools/compiler/ti-cgt-c6000_8.1.3/include" --reread_libs --display_error_number --diag_wrap=off --warn_sections --xml_link_info="Module.Our_linkInfo.xml" --rom_model -o "Module.Our.out" "./module.obj" "./___.obj" "./.../src/......obj" ".......obj" "........obj" ".........obj" "........obj" ".......obj" "../rm_linker.cmd" -l"configPkg/linker.cmd" -l"/...../Our.lib.lib" -llibc.a

I tried to change link order. Tried to remove --reread_libs and add --priority.

It doesn't help. 

I'don't udnerstand why linker uses fputs from 'standard library'... And why the project builds successfully on other machines or in another time.

Code Composer Studio Version: 7.1.0.00016. xdctools_3_32_00_06. 

  • What generally works best in these situations is to use --priority, make sure the linker sees each library name exactly one time, and those library names are in the order they should be used.  

    I suspect something in the these linker command files ...

    Andrey Grechin said:
    "../rm_linker.cmd" -l"configPkg/linker.cmd"

    ... is affecting things.  Do these files have any library names or linker options that are connected to this?

    Thanks and regards,

    -George

  • Yes they do. There are some stuff:

    -l"..../Build.Debug/configPkg/package/cfg/OurProject_pe66.oe66"
    -l"..../src/ipc/ipc.ae66"
    -l"..../src/utils/utils.ae66"
    -l"..../src/sysbios/sysbios.ae66"
    -l"..../ti/mathlib_c66x_3_1_1_0/packages/ti/mathlib/lib/mathlib.ae66"
    -l"..../pdk_tci6614/packages/ti/csl/lib/ti.csl.ae66"
    -l"..../pdk_tci6614/packages/ti/drv/rm/lib/ti.drv.rm.ae66"
    -l"..../pdk_tci6614/packages/ti/drv/srio/lib/ti.drv.srio.ae66"
    -l"..../pdk_tci6614/packages/ti/drv/cppi/lib/ti.drv.cppi.ae66"
    -l"..../pdk_tci6614/packages/ti/drv/qmss/lib/ti.drv.qmss.ae66"
    -l"..../ti/bios_6_45_01_29/packages/ti/targets/rts6000/lib/ti.targets.rts6000.ae66"
    -l"..../ti/bios_6_45_01_29/packages/ti/targets/rts6000/lib/boot.ae66"

    But

    Excluding sources step-by-step I investigated that the error appears when

    std::vector<T>.resize(newsize);
    or constructor std::vector<T>(size);

    calls present.
  • Thanks for the additional detail.  I can reproduce the problem.  I filed CODEGEN-2367 in the SDOWP system to have this addressed.  It contains a detailed description of what went wrong.  I hesitate to include the entire explanation here.  One critical detail is that the STL header calls the function puts in panic situations, like when memory allocation fails.  This starts a chain of unusual circumstances that end with the link failing.

    One workaround is to additionally supply the function puts in your custom library Our.lib.lib.  It can then call your fputs.  Is this practical?

    Thanks and regards,

    -George

  • Thank you George, good news :)

    We will try your workaround with puts.

  • Please note that this bug record has been closed. The error occurs because fputs and puts are both defined in the same file in our RTS. If you replace our definition of fputs, you must also replace the definition of puts. Here is the one we provide-- you can simply add it to your file defining fputs.

    int puts(const char *_ptr)
    {
    int count = fputs(_ptr, stdout);
    count += fputs("\n", stdout);
    return count;
    }