Compilation woes and segmentation fault

I'm using ubuntu 10.04.1 with native gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3.

* Cloned the RIOT-OS/RIOT repo * make -B clean * cd examples/hello-world && make

-- log -- Building application hello-world for native w/ MCU native. "make" -C /home/mark/RIOT/boards/native make[1]: Entering directory `/home/mark/RIOT/boards/native' make[2]: Entering directory `/home/mark/RIOT/boards/native/drivers' In file included from native-uart0.c:38: /home/mark/RIOT/cpu/native/include/native_internal.h:52: error: expected �=�, �,�, �;�, �asm� or �__attribute__� before �native_isr_context� /home/mark/RIOT/cpu/native/include/native_internal.h:53: error: expected �=�, �,�, �;�, �asm� or �__attribute__� before �end_context� /home/mark/RIOT/cpu/native/include/native_internal.h:54: error: expected �=�, �,�, �;�, �asm� or �__attribute__� before �*� token make[2]: *** [/home/mark/RIOT/examples/hello-world/bin/native/native-uart0.o] Error 1 -- log --

"ucontext.h" is added at the latter part of the file. I had to move it to the front to make it work.

After that, a new satan! :slight_smile:

-- log -- make[2]: Entering directory `/home/mark/RIOT/cpu/native' irq_cpu.c: In function �native_isr_entry�: irq_cpu.c:348: error: �REG_EIP� undeclared (first use in this function) irq_cpu.c:348: error: (Each undeclared identifier is reported only once irq_cpu.c:348: error: for each function it appears in.) -- log --

Had to alter the __USE_GNU define. Patch form is provided at the end of this mail.

After the build, when I tried to run the file, it resulted in a seg fault. Used -g and gdb to debug. Had kept a bpoint @ main and gave run, it got seg fault before even reaching main.

Any ideas on how to fix this?

\Mark/|

--- cut here --- diff --git a/cpu/native/include/native_internal.h b/cpu/native/include/native_internal.h index ca075ea..b508926 100644 --- a/cpu/native/include/native_internal.h +++ b/cpu/native/include/native_internal.h @@ -14,6 +14,28 @@

#include <signal.h>

+/* enable signal handler register access on different platforms + * check here for more: + * Pre-defined Compiler Macros / Wiki / OperatingSystems + */ +#ifdef BSD // BSD = (FreeBSD, Darwin, ...) +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE +#include <ucontext.h> +#undef _XOPEN_SOURCE +#else +#include <ucontext.h> +#endif +#elif defined(__linux__) +#ifndef _GNU_SOURCE +#define GNU_SOURCE +#include <ucontext.h> +#undef GNU_SOURCE +#else +#include <ucontext.h> +#endif +#endif // BSD/Linux

Hi Mark,

please try upgrading your Ubuntu, the support period for your version has ended anyways.

Ubuntu 12.04 LTS Precise Pangolin is the lower bound of what is being supported at the moment and native will be working there again once this has been merged (probably next week): https://github.com/RIOT-OS/RIOT/pull/762

Otherwise native is working with Ubuntu 13.10 Saucy Salamander.

Cheers, Ludwig