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/AM4376: Linker error

Part Number: AM4376

Tool/software: Code Composer Studio

Using TI AM437x PDK and CCS10. I'm getting this error on link ->

c:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/hard\libstdc++_nano.a(locale_init.o): In function `(anonymous namespace)::get_locale_mutex()':
locale_init.cc:(.text._ZN12_GLOBAL__N_116get_locale_mutexEv+0xc): undefined reference to `__sync_synchronize'
c:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/hard\libstdc++_nano.a(cxx11-ios_failure.o): In function `(anonymous namespace)::__io_category_instance()':
cxx11-ios_failure.cc:(.text._ZN12_GLOBAL__N_122__io_category_instanceEv+0xc): undefined reference to `__sync_synchronize'
c:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/hard\libstdc++_nano.a(locale.o): In function `std::locale::_Impl::_M_install_cache(std::locale::facet const*, unsigned int)':
locale.cc:(.text._ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetEj+0x18): undefined reference to `__sync_synchronize'
collect2.exe: error: ld returned 1 exit status

Googling this says this should be resolved by using -mcpu=cortex-a9, and I set that in CCS, but I do not see that flag come in the link options. Some articles say try setting -march=armv7-a too, I tried that, no luck

  • Hi Arun,

    What version of PRSDK are you using?

    >> CCS10

    Do you mean CCS 9.1.0?

    What code are you attempting to compile? Is the code from PRSDK, or your own application code?

    >> Googling this says this should be resolved by using -mcpu=cortex-a9 
    >> Some articles say try setting -march=armv7-a

    Can you please share the Google search terms you used & any the links to the pages you've been consulting?

    >> I set that in CCS, but I do not see that flag come in the link option

    Can you please share the procedure you're following to set the flags?

    Regards,
    Frank

  • What version of PRSDK are you using? pdk_am437x_1_0_15

    >> CCS10

    Do you mean CCS 9.1.0? No, CCS 10.0.0.000010

    What code are you attempting to compile? Is the code from PRSDK, or your own application code? Application code

    >> Googling this says this should be resolved by using -mcpu=cortex-a9 
    >> Some articles say try setting -march=armv7-a

    Can you please share the Google search terms you used & any the links to the pages you've been consulting?

    https://bugs.archlinux.org/task/53732

    https://github.com/devkitPro/buildscripts/issues/26

    https://gcc.gnu.org/legacy-ml/gcc-patches/2012-10/msg00716.html

    >> I set that in CCS, but I do not see that flag come in the link option

    Can you please share the procedure you're following to set the flags? I go to Project properties > CCS Build > GNU Compiler > Runtime and set the -mcpu and -march options in the textboxes.

  • Hi Arun,

    It's strongly recommended to use the CCS & compiler versions which are packaged with the PRSDK / PDK release.

    pdk_am437x_1_0_15 was released with PRSDK 6.0.0.7 (http://software-dl.ti.com/processor-sdk-rtos/esd/AM437X/06_00_00_07/index_FDS.html).

    The compiler version you're using matches the release version (see http://software-dl.ti.com/processor-sdk-rtos/esd/docs/06_00_00_07/rtos/Release_Specific.html#processor-sdk-rtos-release-notes).

    However, the CCS version 9.0.1 was released with PRSDK 6.0.0.7. Can you see if using the recommended CCS version has any positive impact? CCS can be downloaded here: https://software-dl.ti.com/ccs/esd/documents/ccs_downloads.html

    Regards,
    Frank

  • Hi Frank,

    We have a few users who are on 9.0.1, and a 3 (incl me) migrating to 10.0.0. We all have the same problem. We are using this to handle the error now. We add it to the application code. My understanding is GCC (which is the same for all CCS versions since its the one from the PDK) isn't emitting the proper intrinsic for __sync_synchronize for an ARM-v7a which has the DMB instruction.

    extern "C" void __sync_synchronize()
    {
              __asm__ __volatile__ (
              "dmb ish"
             );
    }

    Regards,

    Arun

  • Hi Arun,

    Is this link of any help? https://e2e.ti.com/support/tools/ccs/f/81/t/713517

    Given that you have a workaround, are you still looking for help with this issue? If so, can you please provide me simple example which demonstrates the problem? I've never encountered the problem before.

    Regards,
    Frank

  • Create a new empty CCS project, replace main.c with this, and rename it to main.cpp. Compile and see the errors, also included.

    #include <iostream>

    int main()
    {
        auto lambda = [](auto x){ return x; };
        return 0;
    }

    **** Clean-only build of configuration Debug for project __syncError ****

    "C:\\ti\\ccs1000\\ccs\\utils\\bin\\gmake" -k -j 32 clean -O

    DEL /F "__syncError.hex" "__syncError.out"
    DEL /F "startup_ARMCA9.d"
    DEL /F "main.o" "startup_ARMCA9.o"
    DEL /F "main.d"
    Could Not Find C:\Users\akcheria\T1\__syncError\Debug\__syncError.hex
    Finished clean

    **** Build Finished ****

    **** Build of configuration Debug for project __syncError ****

    "C:\\ti\\ccs1000\\ccs\\utils\\bin\\gmake" -k -j 32 all -O

    Building file: "../startup_ARMCA9.S"
    Invoking: GNU Compiler
    "C:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc-9.2.1.exe" -c -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -marm -Dam4379 -I"C:/Users/akcheria/T1/__syncError" -I"C:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -specs="nosys.specs" -MMD -MP -MF"startup_ARMCA9.d" -MT"startup_ARMCA9.o" -x assembler-with-cpp -o"startup_ARMCA9.o" "../startup_ARMCA9.S"
    cc1.exe: warning: switch '-mcpu=cortex-a9' conflicts with '-march=armv7-a' switch
    Finished building: "../startup_ARMCA9.S"

    Building file: "../main.cpp"
    Invoking: GNU Compiler
    "C:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc-9.2.1.exe" -c -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -marm -Dam4379 -I"C:/Users/akcheria/T1/__syncError" -I"C:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -specs="nosys.specs" -MMD -MP -MF"main.d" -MT"main.o" -fno-threadsafe-statics -o"main.o" "../main.cpp"
    cc1plus.exe: warning: switch '-mcpu=cortex-a9' conflicts with '-march=armv7-a' switch
    ../main.cpp: In function 'int main()':
    ../main.cpp:5:10: warning: variable 'lambda' set but not used [-Wunused-but-set-variable]
    5 | auto lambda = [](auto x){ return x; };
    | ^~~~~~
    Finished building: "../main.cpp"

    Building target: "__syncError.out"
    Invoking: GNU Linker
    "C:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc-9.2.1.exe" -mtune=cortex-a9 -Dam4379 -Og -g -gdwarf-3 -gstrict-dwarf -Wall -specs="nosys.specs" -mcpu=cortex-a9 -Wl,-Map,"__syncError.map" -Wl,--defsym,STACKSIZE=0x18000 -Wl,--defsym,HEAPSIZE=0x400 -o"__syncError.out" "./main.o" "./startup_ARMCA9.o" -Wl,-T"../AM437x.lds" -Wl,--start-group -lstdc++_nano -Wl,--end-group
    makefile:144: recipe for target '__syncError.out' failed
    c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib\libstdc++_nano.a(locale.o): in function `std::locale::_Impl::_M_install_cache(std::locale::facet const*, unsigned int)':
    locale.cc:(.text._ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetEj+0x18): undefined reference to `__sync_synchronize'
    c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib\libstdc++_nano.a(locale_init.o): in function `(anonymous namespace)::get_locale_mutex()':
    locale_init.cc:(.text._ZN12_GLOBAL__N_116get_locale_mutexEv+0xc): undefined reference to `__sync_synchronize'
    c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib\libstdc++_nano.a(cxx11-ios_failure.o): in function `(anonymous namespace)::__io_category_instance()':
    cxx11-ios_failure.cc:(.text._ZN12_GLOBAL__N_122__io_category_instanceEv+0xc): undefined reference to `__sync_synchronize'
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [__syncError.out] Error 1
    makefile:140: recipe for target 'all' failed
    gmake: *** [all] Error 2

    **** Build Finished ****