I got the following an error at building a project on Linux ARM machine.
The following code causes this error.
However, I could build the code on Linux x86 64bit machine.
Version of tools.
PlatformIO: 6.1.16
platformio-teensy: 5.0.0 (It uses Teensyduino v1.59)
I tried to build with using Arduino IDE but IDE2 does not support ARM and IDE1.8.19 cannot failed loading board setting of teensy so I gave up trying Arduino IDE.
I read the following threads but I cannot find any way to resolve the error.
I could avoid the error if I stop using std::function like this but I want to use std::function.
Is there any way to avoid the error on ARM machines?
Bash:
/home/asuki/.platformio/packages/toolchain-gccarmnoneeabi-teensy/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v7e-m+dp/hard/libgcc.a(pr-support.o):(.ARM.exidx+0x34): relocation truncated to fit: R_ARM_PREL31 against `.ARM.extab'
The following code causes this error.
C++:
#include <Arduino.h>
using CalcInt = std::function<int(int, int)>;
int _plus(int a, int b) { return a + b; }
CalcInt plus = _plus;
void setup() { Serial.begin(9600); }
void loop() {
Serial.println(plus(1, 2));
delay(100);
}
However, I could build the code on Linux x86 64bit machine.
CPU type | OS | Machine | Build result |
---|---|---|---|
ARM | Ubuntu22.04 64bit | Nvidia Jetson AGX Orin | Failed |
ARM | Raspberry Pi OS 64bit | Raspberry Pi 3B | Failed |
ARM | Raspberry Pi OS 32bit | Raspberry Pi 3B | Failed |
x86 | Ubuntu22.04 64bit | Lenovo ThinkPad S1 Yoga (Intel) | Succeeded |
Version of tools.
PlatformIO: 6.1.16
platformio-teensy: 5.0.0 (It uses Teensyduino v1.59)
I tried to build with using Arduino IDE but IDE2 does not support ARM and IDE1.8.19 cannot failed loading board setting of teensy so I gave up trying Arduino IDE.
I read the following threads but I cannot find any way to resolve the error.
RT1064: How to solve gcc linker error (.ARM.exidx+0x0): relocation truncated to fit: R_ARM_PREL31
Hi, According to my understanding this linker error occurs because of the following requirements from the ARM ABI standard: - There is a separate .ARM.exidx section created by the compiler which contains entries that refer to addresses in the code. - Each entry in .ARM.exidx contains a 31 bit...
community.nxp.com
How to solve gcc linker error (.ARM.exidx+0x0): relocation truncated to fit: R_ARM_PREL31: followup
Followup to old issue: Re: RT1064: How to solve gcc linker error (.ARM.ex... - NXP Community I am disappointed that the long-standing answer to a limitation of the ARM-EABI is: 1. Use C (discard 100s of our application's files) 2. Compile C++ without exceptions (ie. modify the semantics of...
community.nxp.com
I could avoid the error if I stop using std::function like this but I want to use std::function.
C++:
// using CalcInt = std::function<int(int, int)>;
typedef int(*CalcInt)(int, int);
Is there any way to avoid the error on ARM machines?
Last edited: