collect2.exe: error: ld returned 1 exit status

Status
Not open for further replies.
Hi Bruce, would you mind to elaborate on your fix?
I just ran into the same "collect2.exe: error: ld returned 1 exit status" issue when I tried to compile a Teensy LC sketch using the Optimize: "Fastest" option.
Compiling the same sketch with the Optimize: "Smallest code" option did not throw that error...strange...

Thanks,
Paul
 
that error usually means that you have a functor declaration in a class but the actual functor is missing (in the cpp), perhaps it was compiled out during that specific optimisation
 
Thanks Tonton81.
To be honest I'm a bit surprised that 'just' changing an optimization setting could lead to a (linker?) error.
Since I'm not that proficient in coding how could I get this working? Actually I mean: where should I start looking? Just keep reducing the code until the error does not show up anymore and take it from there?
If you want, I can post the small code that shows the error happening.

Regards,
Paul
 
To be honest I'm a bit surprised that 'just' changing an optimization setting could lead to a (linker?) error.

Selecting optimizing level 'smallest' for a T-LC does not only change the level to -Os it also adds --specs=nano.specs to the linker flags which changes the linked in c-library. I assume it is related to this. Maybe one of the library functions you are using is not present in one of the c libraries. Here some info: http://pabigot.github.io/bspacm/newlib.html

Your code would be interesting indeed.
 
Last edited:
include 1 library at a time until it starts to fail, also make sure you call the exact same functors used by it, because not using certain functions they will be compiled out, then using the function would lead to an error as seen here
 
Your code would be interesting indeed.
Here it is:
Code:
#include <Audio.h>

AudioSynthWaveformSine   sine1;
AudioOutputI2S           i2s1;
AudioConnection          patchCord1(sine1, 0, i2s1, 0);
AudioConnection          patchCord2(sine1, 0, i2s1, 1);

void setup()
{
  AudioMemory(1);
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);

  sine1.frequency(1000);
  sine1.amplitude(1.0);  // 0dB
}

void loop()
{
}
But the emberrassing part is that after posting this issue on the forum, I decided to upgrade to Arduino 1.8.15/Teensyduino1.54 [from 1.8.13/1.53]. But now I can't select USB Type: "Audio" in the menu for the Teensy LC...and thus not compile...hence can't reproduce the error.

I'm confused; I thought with Teensyduino 1.54 Audio support was added for the Teensy LC?

Paul
 
Status
Not open for further replies.
Back
Top