I am trying to upgrade my compiler to support C++11, the kernel of my target machine is 2.6.33.20.
After some research, I came across the Linaro-Toolchains and, according to the file
command, the version 5.5.0 produces a sufficiently new binary, that should still work for the kernel (the latest Ubuntu ARM-Toolchain produces 'KERNEL TOO OLD').
The trivial testing program
//#include <functional>
#include <stdio.h>
int main(void)
{
// auto lambda = [](int value) { printf("Wert: %d\n", value); };
// lambda(20);
printf("My output\n");
return 0;
}
compiles fine with the command arm-linux-gnueabi-g++ -o test -static-libstdc++ -std=gnu++11 main.cpp
, when I execute file
on the executable, it outputs, test: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=2d49dc2492f7fb2ee5992f7614604aac370e42f7, with debug_info, not stripped
.
But when I attempt to run the executable on the target system, the console tells me 'Segmentation fault' and nothing else.
The file command run over the same source but compiled with the old (Pre-C++11) compiler yields: test: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.14, not stripped
According to Makefile for nontrivial hello world cross building leads to segemnation fault on Raspberry I've tried comparing the output of objdump -x
, however I don't even know what to look for. I can see that the offsets are different and that the new compiler inserts a line 2 .note.gnu.build-id 00000024 00010168 00010168 00000168 2**2
, but I have know idea what that's supposed to mean or what to do about it.
As a side note: The arm-linux-gnueabi-g++ shipped with Ubuntu 14.04 is known to work (with C++11 support), however I can't seem to find a way to pack the thing into a folder to be used as a transferable toolchain.
Edit: Following the (linked) question ARM cross compiling I've tried to execute 'readelf' on the binaries and did find a noteworthy difference, namely the 'target architecture'.
The old compiler targets v5T
the new one v7
, which may well be more than enough reason for the program to not work. I am currently pursuing the compiler switches.
Aucun commentaire:
Enregistrer un commentaire