error: Id returned 1exit status, recipe for target *.elf failed

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I Have C++ code that compiles for UC3 but does not compile for megaAVR I get the following errors:

 

error: Id returned 1exit status

error: recipe for target *.elf failed

 

Anyone know what they mean? or able to help with where to look?

Last Edited: Sun. Jun 3, 2018 - 06:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you got to the Linker stage (ld) the individual C++ files must have compiled to object (.o) successfully.
.
Copy-paste from the Output window.
You have either omitted a file or you have two files with the same definition.
Or more likely, you have used too much SRAM or Flash.
.
David.

Last Edited: Sun. Jun 3, 2018 - 07:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

------ Build started: Project: Atmega, Configuration: Debug AVR ------
Build started.
Project "Atmega.cppproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "K:\Projects\WebServer\WebServer15\Atmega\Atmega.cppproj" (target "Build" depends on it):
 Task "RunCompilerTask"
  Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
  C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 8 --output-sync
  Building target: Atmega.elf
  Invoking: AVR8/GNU Linker : 5.4.0
  Atmega/src/CSF/enc28j60.o:(.rodata._ZTC10enc28j60_t694_6http_t[vtable for enc28j60_t]+0x1c): undefined reference to `__cxa_pure_virtual'
  Atmega/src/CSF/enc28j60.o:(.rodata._ZTC10enc28j60_t694_6http_t[vtable for enc28j60_t]+0x1e): undefined reference to `__cxa_pure_virtual'
  Atmega/src/CSF/enc28j60.o:(.rodata._ZTC10enc28j60_t694_6http_t[vtable for enc28j60_t]+0x20): undefined reference to `__cxa_pure_virtual'
  Atmega/src/CSF/enc28j60.o:(.rodata._ZTC10enc28j60_t694_6http_t[vtable for enc28j60_t]+0x22): undefined reference to `__cxa_pure_virtual'
  Atmega/src/CSF/enc28j60.o:(.rodata._ZTC10enc28j60_t694_6http_t[vtable for enc28j60_t]+0x24): undefined reference to `__cxa_pure_virtual'
  Atmega/src/CSF/enc28j60.o:(.rodata._ZTC10enc28j60_t694_6http_t[vtable for enc28j60_t]+0x26): more undefined references to `__cxa_pure_virtual' follow
collect2.exe(0,0): error: ld returned 1 exit status
  make: *** [Atmega.elf] Error 1
  "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-g++.exe" -o Atmega.elf  Atmega/src/CSF/arp.o Atmega/src/CSF/dhcp.o Atmega/src/CSF/dns.o Atmega/src/CSF/enc28j60.o Atmega/src/CSF/http.o Atmega/src/CSF/icmp.o Atmega/src/CSF/ip.o Atmega/src/CSF/mac.o Atmega/src/CSF/mb.o Atmega/src/CSF/mbap.o Atmega/src/CSF/mem.o Atmega/src/CSF/misc.o Atmega/src/CSF/net.o Atmega/src/CSF/ringmem.o Atmega/src/CSF/tcp.o Atmega/src/CSF/tcp_block.o Atmega/src/CSF/udp.o src/cpu.o   -Wl,-Map="Atmega.map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=atmega1284 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.150\gcc\dev\atmega1284" 
K:\Projects\WebServer\WebServer15\Atmega\Debug\Makefile(239,1): error: recipe for target 'Atmega.elf' failed
  The command exited with code 2.
 Done executing task "RunCompilerTask" -- FAILED.
Done building target "CoreBuild" in project "Atmega.cppproj" -- FAILED.
Done building project "Atmega.cppproj" -- FAILED.

Build FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ZIP up and attach your AS7 project.

 

Quite honestly,   AS7 works fine for C++ projects.

 

If your original UC3 project worked ok,   it should rebuild for a mega1284 ok too.

I do not have any experience with UC3 but plenty of code that runs on Mega, Xmega, ARM-M0, ARM-M3, ARM-M4

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you Google cxa_pure_virtual? It should have hit the sticky thread at the top of the compiler forum

 

This.. https://www.avrfreaks.net/forum/...

Last Edited: Sun. Jun 3, 2018 - 09:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had forgotten.   It looks as if I just added

extern "C" void __cxa_pure_virtual()
{
    while (1);
}

to my "usual" glue file.cpp

 

I am surprised that there is not a weak function already in an object library.

OTOH,   it is probably wise that user actually thinks out an implementation of some sort or another.

 

Of course,   I had forgotten completely !!

But at least that form of catch-all means a debugger ends up here (or times out a watchdog).

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Guys,

 

No idea why I needed to do it, but I put the code in from the sticky note and it worked!

 

It was very strange I simplified the code down as far as I could and I found if I removed a constructor it would compile,

if I left it in it would fail. I tried making a simple example to recreate it but I couldn't.

 

I had also seen the odd segmentation error mentioned in the sticky, nothing that a recompile didn't fix but hopefully that's fixed too.

 

Cheers, Now I can get some sleep!