Sprintf Errors when making with latest firmware develop branch

Hi,

I've been using an older version of the firmware develop branch that compiles my app without any errors. However, the latest version of the firmware develop branch (which I "git pull"(ed)) when compiled gives me a bunch of sprintf errors (these errors occur when I run "make clean all PLATFORM=photon APP=MY_APP_NAME"):

sprintf' referenced in section .text._Z13SF_command_BL6String' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans1.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin) sprintf' referenced in section .text._Z21sendinteractionrecordv' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans1.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin)
sprintf' referenced in section .text._Z15progressButtons12accuracyenum' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans1.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin) sprintf' referenced in section .text._Z15progressButtons12accuracyenum' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans1.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin)
sprintf' referenced in section .text._Z18correctConsequencev' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans1.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin) sprintf' referenced in section .text._Z16senddevicereportv' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans3.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin)
sprintf' referenced in section .text._Z11finishTrialv' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans3.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin) sprintf' referenced in section .text._Z14DL_P_PlayAudioii' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans3.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin)
sprintf' referenced in section .text._ZN10RestClient7requestEPKcS1_S1_P6String.constprop.22' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans5.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin) sprintf' referenced in section .text._Z6DL_cmdcPcm' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans7.ltrans.o: defined in discarded section .text' of rt_dynalib.o (symbol from plugin)
sprintf' referenced in section .text._Z19DL_L_LightwithFlashiiiii' of /var/folders/21/gd3g8pn90tlfm0tty3mzztj80000gp/T//cclGBaz5.ltrans7.ltrans.o: defined in discarded section `.text' of rt_dynalib.o (symbol from plugin)
collect2: error: ld returned 1 exit status
make[1]: *** [../../../build/target/user-part/platform-6-m-lto/applications/cleverpet-behaviorlayer/cleverpet-behaviorlayer.elf] Error 1
make: *** [modules/photon/user-part] Error 2

Will there be fixes for sprintf in later revisions of the branch?

@LeoW

I ran into the same thing this morning when I did a git pull on the develop branch.

Maybe I need to do a total rebuild to use this new code? Not sure.

Anybody have a specific process that should be followed in terms of rebuilding when a git pull is done?

“make < all your usual PLATFORM & APP arguments > clean” is useful if weird stuff happens after a git pull.

1 Like

@HardWater
I’ve looked and found a previous post mentioning this problem as well! Sprintf not working on develop. If you just want your app to run you can revert to a previous version of the branch (that’s what I’ve been doing so far, but I’m hoping they update to include sprintf in future versions). It appears they removed support for sprintf because of the amount of flash memory it requires to implement.

@AndyW
Thanks for chiming in! With the default app, it will “make” the file correctly, but since I am using sprintf in my app, “make < all your usual PLATFORM & APP arguments > clean” will cause sprintf errors because of the reasons mentioned above (or at least from what I know) :frowning:

1 Like

if you are using a Spark core, i recommend staying with the stable branch of the firmware since the latest firmware might not be fully tested.

Hi @kennethlimcp, I am using a photon, any suggestions for photon users? :smile:

Open an issue at https://github.com/spark/firmware i guess?

It’s a compiler issue. Please be sure you’re using the latest arm gcc compiler - 2015 q2. Alternatively, add COMPILE_LTO=n to your make arguments and that will also fix the problem.