Cannot compile in WebIDE anymore - Compile error : could not compile

Hi All, apologies if the format is clunky, my first post in this forum.

Been using and developing with Electrons for about 6 weeks, steep learning curve but mostly going ok. Have tested in the field, like most of the tools and have been tracking down a path to use this device for a nationwide deployment to 10,000 sites BUT ran into a problem yesterday when we started having patchy internet connection here at work. My code, which had been compiling and functioning just fine, started throwing up odd errors then broke entirely. I tracked down some of the initial problems in the raw messaging to the IDE suddenly deciding I was compiling for a core device (I don’t have any of those). I changed the target (this took a while to work out where to do that) though the IDE no longer printed any text in the lower right corner to show target or OS version, just a blank space. I have tried the following, several times in combination;
Cleared cache, log out, login, changed browser, renamed project, new project, copy and paste once functional code into new project, tried the desktop IDE, nothing has fixed my problem.
I’ve had to bump a field trial to next week because of this very opaque problem so it’s really starting to be an impediment.
So I’m back at the point where all I get after clicking “Verify” is the message “Error : could not compile, please review your code” Uh huh. Not very useful.
As far as I can see from forums, this has occurred for other people but the problem wasn’t traced.

Some of my earlier project versions of this code still compile and i could back up several days but WHY is the problem occurring, it could just as readily come back for all I know.

The raw output gives some clue that the code is fine but the linker is failing which seems a little out of my control. The last chunk of the messaging shows as below but I don’t know what i can do to fix the problem, undefined references to _read, _Iseek etc, WHAT am i meant to do to resolve this problem

cheers

Building target: target/workspace.elf
Invoking: ARM GCC C++ Linker
mkdir -p target/
arm-none-eabi-g++ -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=10 -DPLATFORM_NAME=electron -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00A -DUSBD_PID_CDC=0xC00A -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -DINCLUDE_PLATFORM=1 -fno-builtin -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING=0.7.0 -DRELEASE_BUILD -Werror -I../../../user/inc -I../../../dynalib/inc -I../../../services/inc -I../../../hal/inc -I../../../hal/shared -I/rtos/FreeRTOSv8.2.2/FreeRTOS/Source/include -I/rtos/FreeRTOSv8.2.2/FreeRTOS/Source/portable/GCC/ARM_CM3 -I../../../hal/src/electron -I../../../hal/src/stm32f2xx -I../../../hal/src/stm32 -I../../../system/inc -I../../../rt-dynalib/inc -I../../../wiring/inc -I../../../modules/shared/stm32f2xx/inc -I../../../modules/electron/system-part2/inc -I../../../modules/shared/stm32f2xx/inc -I../../../platform/shared/inc -I../../../platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I../../../platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../../../platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I../../../platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I../../../platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../../../platform/MCU/shared/STM32/inc -I../../../platform/MCU/STM32F2xx/CMSIS/Include -I../../../platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I. -MD -MP -MF target/workspace.elf.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x8080000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=5 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,2,207 -DMODULE_DEPENDENCY2=0,0,0 -D_WINSOCK_H -D_GNU_SOURCE target//obj/src/user_module.o target//obj/src/module_info.o target//obj/src/user_export.o target//obj/src/newlib_stubs.o  --output target/workspace.elf -nostartfiles -Xlinker --gc-sections -L../../../build/arm/linker/stm32f2xx -L../../../build/arm/linker/stm32f2xx  -L../../../build/target/user/platform-10-m -L../../../build/target/services-dynalib/arm/ -L../../../build/target/hal-dynalib/platform-10-m/ -L../../../build/target/system-dynalib/platform-10-m/ -L../../../build/target/rt-dynalib/platform-10-m/ -L../../../build/target/wiring/platform-10-m/ -L../../../build/target/communication-dynalib/platform-10-m/ -L../../../build/target/platform/platform-10-m/ -L../../../build/target/wiring_globals/platform-10-m/ -L../../../build/arm/linker -Wl,--whole-archive -luser -lhal-dynalib -lservices-dynalib -lsystem-dynalib -lrt-dynalib -lwiring -lcommunication-dynalib -lplatform -lwiring_globals -Wl,--no-whole-archive -lnosys --specs=nano.specs -L../../../modules/electron/system-part1 -L../../../modules/electron/system-part3 -L../../../modules/electron/system-part2 -L. -T./linker.ld -Wl,--defsym,USER_FIRMWARE_IMAGE_SIZE=0x20000 -Wl,--defsym,USER_FIRMWARE_IMAGE_LOCATION=0x8080000 -Wl,-Map,target/workspace.map
/usr/local/gcc-arm-embedded/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/lib/armv7-m/libg_nano.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x10): undefined reference to `_write'
/usr/local/gcc-arm-embedded/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/lib/armv7-m/libg_nano.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0xc): undefined reference to `_close'
/usr/local/gcc-arm-embedded/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/lib/armv7-m/libg_nano.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat'
/usr/local/gcc-arm-embedded/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/lib/armv7-m/libg_nano.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'
/usr/local/gcc-arm-embedded/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/lib/armv7-m/libg_nano.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek'
/usr/local/gcc-arm-embedded/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/lib/armv7-m/libg_nano.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x10): undefined reference to `_read'
collect2: error: ld returned 1 exit status
../../../build/module.mk:222: recipe for target 'target/workspace.elf' failed
make[1]: Leaving directory '/firmware/modules/electron/user-part'
make[1]: *** [target/workspace.elf] Error 1
../build/recurse.mk:11: recipe for target 'modules/electron/user-part' failed
make: *** [modules/electron/user-part] Error 2

Hi @petenz1

I edited your post to format the compiler output using the three-backquotes on a line by themselves (top and bottom) to make it more readable.

The errors you are getting (_write, _close, etc.) indicate that you are trying to use printf or some similar function from stdio.h that is not available on this platform. You can use sprintf and the Arduino Wiring .print and .println methods to Serial or other classes. I am focusing on printf because that the usual culprit here, but it could fopen or fseek or any number of other functions. The call to this could also be in a library you added for debugging etc.

So if you look around your code for any stdio.h function calls, you should find the problem.

2 Likes

Thanks bko!

I think I’ve just stumbled across the same thing, but the internet connectivity and target change from yesterday threw me off as the core vs electron errors were were the first hint of problems, the string one was buried under that, bad timing I guess.

I was indeed trying to use string functions that were c compliant but not Particle compliant. Many thanks for the quick response…

cheers

1 Like