AnsweredAssumed Answered

Possible bug samewhere in Newlibnano

Question asked by Massimo Manca on Aug 2, 2016
Latest reply on Aug 5, 2016 by A VT


I am building a project based on mbed. I downloaded the last mbed source code from mbed-dev than I compile it as a static library and link it to my application project. I build the library for debug and release. If in my application I link the release library everything works but if I link the debug library... I have this error:


Building target: MBED1768TestColibriNew.axf

Invoking: MCU C++ Linker

arm-none-eabi-c++ -nostdlib -L"C:\Dati\ProjectsWorkspaceEmb\LpcXpresso8\MBED1768Colibri\MBED1768TestColibriNew" -L"C:\Dati\ProjectsWorkspaceEmb\LpcXpresso8\MBED1768Colibri\GenericC++Lib\Debug" -L"C:\Dati\ProjectsWorkspaceEmb\LpcXpresso8\MBED1768Colibri\mbed-dev\Debug" -Xlinker -Map="" -Xlinker --gc-sections -mcpu=cortex-m3 -mthumb -T LPC1768.ld -o "MBED1768TestColibriNew.axf"  ./ErrorCodes.o ./TestAltimeter.o ./TestBitFieldEnum.o ./TestDebug.o ./TestDebugNew.o ./TestEndian.o ./TestErrorHandler.o ./TestEthernet.o ./TestGSM.o ./TestGenMath.o ./TestHost.o ./TestI2C.o ./TestImu.o ./TestInet.o ./TestIni.o ./TestIpAddr.o ./TestLM75B.o ./TestLcd.o ./TestLocalFileSystem.o ./TestLogger.o ./TestLoggerVcd.o ./TestMPL3115A2.o ./TestMySql.o ./TestPost.o ./TestRGB.o ./TestSDFileSystem.o ./TestSingleton.o ./TestSscanf.o ./bist.o ./fusion.o ./i2cext.o ./main.o ./post.o ./process.o ./rgb.o   -lmbed-dev -lGenC++Lib

C:\Users\massimo\AppData\Local\Temp\ccBse0di.ltrans2.ltrans.o: In function `__wrap_main':

<artificial>:(.text+0x4a4): undefined reference to `__real_main'

collect2.exe: error: ld returned 1 exit status

make: *** [MBED1768TestColibriNew.axf] Error 1


05:00:58 Build Finished (took 37s.33ms)


__wrap_main and __real_main would be defined internaly in newlibnano.

The strange situation is that if I set the Debug configuration changing optimisations to optimize for size and change the debugging options to none the project is correctly built. So seems to me that the error I found is related how I compile my project and this is not so good.

Anyone experienced the same problem? Any suggestion is welcome!!!