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/CC3200: Issue in compiling the source code with the latest ARM Compilers

Part Number: CC3200


Tool/software: TI C/C++ Compiler

We are currently having an issues when trying to compile the ARM TI compiler which is 16.12. 0STS(Short term support), but are having the following error.

Note: We use code composer studio development environment for compilation.

<Linking>

error: symbol "errno" has already been defined

>> Compilation failure

>> Compilation failure

>> Compilation failure


We have attempted the following:

  • tested with all of the compiler version after the ARM compiler 5.2.9 release with no luck.
  • un-defined the macro in project properties, but it does not works.
  • disabled the “ errno“ macro by changing  #ifndef _ERRNO to  #ifdef _ERRNO in below files so that the #define errno would get disable, but this did not work.

C:\ti\ccsv6\tools\compiler\ti-cgt-arm_16.12.0.STS\include\errno.h

C:\ti\ccsv6\tools\compiler\ti-cgt-arm_16.12.0.STS\libs\src\errno.h

 C:\ti\ccsv6\tools\compiler\ti-cgt-arm_16.12.0.STS\libs\src\errno.h 

We also tried in latest long term support(16.9.0LTS) compilers but the same compile error occurs.

Currently we believe the “errno” is defined in  this “rtsv7M4_T_le_eabi lib” library which is available in the  below folder location, but we are not able to disable this macro from this library.

 C:\ti\ccsv6\tools\compiler\ti-cgt-arm_16.12.0.STS\lib\ rtsv7M4_T_le_eabi lib

 How can we disable this macro for an error free compilation?

  • I have never seen this before.  I don't know what is causing it.  But I have a hard time seeing how it comes from the RTS library.  My guess (and this is only a guess) is that you have multiple definitions of errno in your own code.  But how might you see that?

    First, search for errno anywhere in your C/C++ files.  That will probably turn up nothing.  Then build everything with the switch --gen_preprocessor_listing.  This switch causes the compiler to create a preprocessor listing file with the extension .rl.  Among other things, this file shows source lines before and after preprocessor expansion occurs.  I suspect you will find multiple definitions of errno.

    Please do not confuse a definition with a declaration. Many details aside, this is a definition ...

    int errno; /* definition */

    ... and this is a declaration ...

    extern int errno; /* declaration */

    Once you find those multiple definitions, you should be able trace back through the preprocessing to discover how it happened.

    Please read about --gen_preprocessor_listing in the ARM compiler manual.  Unfortunately, the manual has an error.  It uses --gen_parser_listing where --gen_preprocessor_listing should be used instead.

    Thanks and regards,

    -George

  • The project already has errno defined and we cannot change this because it use is within a pre-built lib object that we are including.

    This does not cause any issues with compiling or running our code with TI Arm compilers that are version 5.2.9 and older.

    We started having problems after trying to compile our code with the newer compilers, specifically the 16.12.0STS version.

    From the error that we are getting, it seems that the newer version also has a definition for errno built into some library used by the compiler.

    I would like to know if there is anything we could do to remove the inclusion of the errno definition used by the newer compiler.

  • The short answer: no, you can't modify or remove errno from the library without major revision.

    The long answer:

    ARM EABI defines two modes for using errno, the normal mode and AEABI portable mode. See the ARM document "C Library ABI for the ARM® Architecture" (ARM IHI 0039D) at infocenter.arm.com/.../index.jsp

    Basically, if you add this definition of _AEABI_PORTABILITY_LEVEL:

    #define _AEABI_PORTABILITY_LEVEL 1

    You alter how errno gets declared. It is possible that the pre-build lib you are using has done this. If so, your code needs to be compiled to match. It is also possible that the TI RTS library would need to be recompiled, I'm not sure.