Lto-wrapper error

Ubuntu linux copiles a program just fine but Manjaro gives the lto-wrapper error. lto-wrapper: fatal error: /usr/bin/avr-gcc returned 1 exit status

Researched it and installed board manager 1.6.21; installed
http://downloads.arduino.cc/packages/package_avr_7.3.0_index.json; and installed arduino-Makefile (yay -S arduino-mk ). Still get the error.

Somebody said that this is an Arch/Manjaro bug.

What program?

Please see [HowTo] Request support

Arduino.

arduino is already in the ARM64 repos, why are you compiling it?

Either way, are you compiling it on an ARM64 device or cross-compiling for it?

Hi!

This looks like a GCC LTO problem in AVR compiler.
There is an upstream gcc bug id=105753 which contains a proposed patch:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105753

I’m getting the same message when compiling an Arduino sketch (the OP mentioned “compiling a program”, but (s)he was actually refering to an Arduino sketch):

Arduino: 1.8.19 (Linux), Board "Arduino BT, ATmega328P"

during RTL pass: combine
/usr/share/arduino/hardware/archlinux-arduino/avr/cores/arduino/main.cpp: In function 'main':
/usr/share/arduino/hardware/archlinux-arduino/avr/cores/arduino/main.cpp:51:1: internal compiler error: in add_clobbers, at config/avr/avr-dimode.md:2705
   51 | }
      | ^
0x5af234 _start
	../sysdeps/x86_64/start.S:115
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: /usr/bin/avr-gcc returned 1 exit status
compilation terminated.
/usr/bin/avr-ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
exit status 1
Compilation error for the Arduino BT board.

Here is an example sketch failing to compile (needs the IRRemote library):

#include <IRremote.hpp>
int IR = 29;
IRrecv irrecv(IR);
decode_results results;

void setup() {
 Serial.begin(9600);
 irrecv.enableIRIn(); 
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value);
    irrecv.resume();
  }
}

Yes, thank you, Arduino sketches, but only in few sketches so far. How would one apply the proposed patch to Manjaro? Perhaps Majaro needs to create a kernal update or whatever to solve this problem.

Try compiling your Arduino sketch with -fno-lto as a workaround.

Hi @Kevin_Kofler !
Arduino IDE has no way of customising gcc flags.
Because in Ubuntu it works, I guess they applied the proposed patch to gcc and I think Manjaro can do the same, even only as a temporary workaround, until a proper solution is found. Currently, some sketches fail to compile on Manjaro Stable on x86_64 (I do not know about Manjaro on ARM, so this bug should be reclassified for x86_64 Stable). This bug only affects gcc on avr platform, which is usually Arduino and clones, so raising it against the Arduino IDE and not GCC looks like the sensible choice.
In my example, line 13 Serial.println(results.value) seems to be calling the code that is failing.

1 Like

This seems to be pretty clearly a bug in the AVR backend of GCC. (And I am not even sure LTO is at fault, actually. The invocation goes collect2avr-ldlto-wrapperavr-gcc, i.e., delayed compilation at link time, as done with LTO, but compiling the same code directly with avr-gcc might actually run into the same error for all I know.)

To try the patch, as long as there is no prebuilt package including it, you need to recompile avr-gcc with the patch. Depending on what your host device is, it can take a long time. (E.g., I wish you good luck trying to compile GCC on a PinePhone or on one of the several ultracheap ARM boards out there. )

I am on x86_64 and I guess the OP is also on x86_64 and selected ARM by mistake, perhaps thinking that arduino is ARM.
I’m going to wait until this is fixed by the distro. I migrated to Manjaro after 12 years on Gentoo, so if I’m going to compile anything, it will be Gentoo again. That is Gentoo’s strength: being able to make things work again in an hour, by patching and recompiling. This is missing in binary distros. If I’m on a binary distro I may find myself on the Stable branch and being blocked by some obscure trivial bug that’s taking ages to be patched.

1 Like

Thanks. Where is the distinction made between AVR and ARM? In the Arduino board manager?

Hi @Katabasis !
When you are selecting ARM you are refering at the sistem running the Arduino IDE - your computer, not at the Arduino board, because this forum is refering at Manjaro systems, not Arduino boards. The error is thrown by the compiler running on your computer. It is important to say what type of computer you have when raising bug reports. Example ARM computers that can run Manjaro are Raspberry Pi and Pine Phone and your bug could be observed on such cumputers only, but not on x86_64, for example.
AVR is a different architecture (processor) than ARM, just like ARM is different from x86_64.

Hi,

I had the same error. I have installed the “Arduino AVR Boards” via Board Manager. You have two sub menus in the board menu then, “Arch Linux Arduino AVR Boards” and “Arduino AVR Boards”. Chose a board from “Arduino AVR Boards” and it compiled.

Regards