Odd local and CLI compile errors

I am getting local and CLI compile errors which did not come up when I first compiled some code (locally) a couple of months ago. I am now getting these errors:

undefined reference to 'String::operator=(String&&)'

I can share the code (openweathermap stuff) but it has a lot of files. I just wonder if anyone has seen this and if it is a simple fix before I post the code? :smile:

1 Like

Some of the operator= code in String is #ifdef out with an experimental compiler switch #ifdef __GXX_EXPERIMENTAL_CXX0X__. I have never tested what happens when you turn that switch on.

The work around is change code like this:

myString1 = myString2;

to be like this:

myString1 = "";
myString1 += myString2;

The former tries to copy a pointer while the later copies the data out of string2 into string1.

1 Like

@bko, did something change with the compilers or perhaps c11 has been enabled but the code compiled just fine in the past. I have posted the files and perhaps you can get a chance to compile it as a single directory in spark CLI. The error messages don’t obviously point to the errors. :smile:

compiles fine locally here on linux with the gcc-arm-none-eabi-4_8-2014q2-20140609-linux.tar.bz2 toolchain (not spark-cli):

arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.4 20140526 (release) [ARM/embedded-4_8-branch revision 211358]

@sej7278, have you tried with spark CLI? I am updating my version 4.8 2014q1 to 4.8 2014q3 to see it that resolves the issue.

no i don’t tend to bother with the cloud stuff, didn’t notice there’s a q3 version of gcc

i suspect an upgrade will help you as the c++11 stuff it pretty bleeding edge even in x86 gcc 4.9, and takes a while to get backported to 4.8 for arm/avr.

@sej7278, with the new version of gcc and doing a clean make, it compiled fine now. It may be that the cloud still uses an older version of gcc. Thanks for the helping hand!

@zachary, @Dave, can you check to make sure the compile farm is using the latest gcc version :smile:

well the q2 update anyway, q3 literally got released a few hours ago!

1 Like

@sej7278, LOL… I AM ON THE EDGE!!! :stuck_out_tongue:

4 Likes

I can verify I haven’t updated GCC in the last few hours :slight_smile:

Strictly speaking it’s currently version:

gcc version 4.8.4 20140526 (release) [ARM/embedded-4_8-branch revision 211358] (GNU Tools for ARM Embedded Processors) 
1 Like

same as mine, that’s q2, so should have worked fine via spark-cli

just confirmed peekay’s program works with q3 too (and the dfu-suffix PR with 0.8, oh that’s another thread)

Can someone test it with spark CLI cause it doesn’t work for me.

i had to delete README.md but no it doesn’t compile for me either, same String&& error with spark-cli 0.4.1

seems to be a known issue: https://community.spark.io/t/having-trouble-compiling-code-on-spark-that-works-on-arduino/3328/3

Thanks for test @sej7278! @Dave, the code should compile with the CLI but it doesn’t. Any ideas why?

1 Like

Okay, I grabbed the code and did a compile, I changed HttpClient.h with this to get rid of the fd_set defined twice stuff:

#include "application.h"
//#include "spark_wiring_string.h"
//#include "spark_wiring_tcpclient.h"
//#include "spark_wiring_usbserial.h"

I think the string error undefined reference to String::operator=(String&&)' is something that’s been around for a while… I actually assigned this bug to the firmware team in December 2013… but I’ll run it by the team again and see if we can get a solution.

Thanks!
David

@Dave yet it compiles just fine locally with q2 and q3 of guy!

So you’re thinking just updating the toolchain server-side will resolve it? I’m a tiny bit cautious about deploying something only released a day or two ago, but I’ll bring it up with the team and see when we can get that out. :slight_smile:

Thanks,
David

No need to update @Dave. It seems production is running get q2 which should compile so not sure what is going on.

So something that may be an interesting lead… I went to compile this locally with make APP=weather with all of the files in the weather folder, and it was giving me the same error as the cloud. But when I switched to make clean all APP=weather it compiled just fine.

This has come up before if I remember correctly. Is there a way to force make clean all on the cloud @Dave ?

nah it compiles fine for me without cleaning, you probably had some old stuff in your core-firmware checkout