Linker Problem: undefined reference to `__errno'
Hi,
I’m trying to get to grips with System Workbench for STM32 & STM32F429i-Disco board.
I’m trying to build the STemWin_SampleDemo project for STM32F429I-Discovery, supplied in STM32Cube_FW_F4_V1.8.0
but it comes up with a linker error :
w_sqrt.c:(.text.sqrt+0xa8): undefined reference to `__errno’
collect2.exe: error: ld returned 1 exit status
I’ve tried everything I can find suggested here & elsewhere ( mainly revolving around linking the math library with -lm, but this makes no difference.)
I was kinda hoping that a project supplied by ST from their STMcube suite using the ST (supplied?) IDE would compile without issue so i could use it as a platform to work from.
Other projects, including the ‘STM32F429I-Discovery’ demonstration project, (also using the STemWin library) build & link without issue.
build log:
‘Building target: STM32F429I_DISCO_MB1075.elf’
‘Invoking: MCU GCC Linker’
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -L................\Middlewares\ST\STemWin\Lib -specs=nosys.specs -specs=nano.specs -T”..\STM32F429NIHx_FLASH.ld” -Wl,-Map=output.map -Wl,gc-sections -lm -o “STM32F429I_DISCO_MB1075.elf” ./Middlewares/STemWin/Config/GUIConf.o ./Middlewares/STemWin/Config/GUI_X.o ./Middlewares/STemWin/Config/LCDConf_stm32f429i_disco_MB1075.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_cortex.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_crc.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_dma.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_dma2d.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_flash.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_flash_ex.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_gpio.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_i2c.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_i2c_ex.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_i2s.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_i2s_ex.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_ltdc.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_pwr.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_pwr_ex.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_rcc.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_rcc_ex.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_rtc.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_rtc_ex.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_sdram.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_spi.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim_ex.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_uart.o ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_ll_fmc.o ./Drivers/CMSIS/system_stm32f4xx.o ./Drivers/BSP/STM324x9I_DISCO/stm32f429i_discovery.o ./Drivers/BSP/STM324x9I_DISCO/stm32f429i_discovery_io.o ./Drivers/BSP/STM324x9I_DISCO/stm32f429i_discovery_sdram.o ./Drivers/BSP/STM324x9I_DISCO/stm32f429i_discovery_ts.o ./Drivers/BSP/Components/ili9341.o ./Drivers/BSP/Components/stmpe811.o ./Application/User/calibration.o ./Application/User/main.o ./Application/User/rtc.o ./Application/User/stm32f4xx_it.o ./Application/SW4STM32/startup_stm32f429xx.o ./Application/Demo/GUIDEMO.o ./Application/Demo/GUIDEMO_AntialiasedText.o ./Application/Demo/GUIDEMO_Automotive.o ./Application/Demo/GUIDEMO_BarGraph.o ./Application/Demo/GUIDEMO_Bitmap.o ./Application/Demo/GUIDEMO_ColorBar.o ./Application/Demo/GUIDEMO_Conf.o ./Application/Demo/GUIDEMO_Cursor.o ./Application/Demo/GUIDEMO_Fading.o ./Application/Demo/GUIDEMO_Graph.o ./Application/Demo/GUIDEMO_IconView.o ./Application/Demo/GUIDEMO_ImageFlow.o ./Application/Demo/GUIDEMO_Intro.o ./Application/Demo/GUIDEMO_Listview.o ./Application/Demo/GUIDEMO_RadialMenu.o ./Application/Demo/GUIDEMO_Resource.o ./Application/Demo/GUIDEMO_Skinning.o ./Application/Demo/GUIDEMO_Speed.o ./Application/Demo/GUIDEMO_Speedometer.o ./Application/Demo/GUIDEMO_Start.o ./Application/Demo/GUIDEMO_TransparentDialog.o ./Application/Demo/GUIDEMO_Treeview.o ./Application/Demo/GUIDEMO_VScreen.o ./Application/Demo/GUIDEMO_WashingMachine.o ./Application/Demo/GUIDEMO_ZoomAndRotate.o ./Application/Demo/syscalls.o -l:STemWin528_CM4_GCC.a
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.3.0.201507241045/tools/compiler/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libm.a(lib_a-w_sqrt.o): In function `sqrt’:
w_sqrt.c:(.text.sqrt+0x9e): undefined reference to `__errno’
w_sqrt.c:(.text.sqrt+0xa8): undefined reference to `__errno’
collect2.exe: error: ld returned 1 exit status
make: *** STM32F429I_DISCO_MB1075.elf Error 1
Any ideas on how to resolve this would be welcome
TIA... Daemy
P.S. same project compiles without issue on a Keil/Arm compiler but I don’t have easy access to that :-(
P.P.S. Intestingly, my own project throws the same error if I include the sqrt function, but not with other maths functions (sin() etc.), but the demo project still throws the error, referencing sqrt, even if I delete all use of sqrt from the project...???