[riot-users] Compilation woes and segmentation fault

Ludwig Ortmann ludwig.ortmann at fu-berlin.de
Sun Feb 23 10:57:36 CET 2014


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

On 02/23/2014 08:38 AM, Mark wrote:
> 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! :)
>
> -- 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:
> + * http://sourceforge.net/p/predef/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
> +
>   /**
>    * internal functions
>    */
> @@ -74,28 +96,6 @@ int unregister_interrupt(int sig);
>
>   //#include <sys/param.h>
>
> -/* enable signal handler register access on different platforms
> - * check here for more:
> - * http://sourceforge.net/p/predef/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
> -
>   #include "kernel_internal.h"
>   #include "sched.h"
>
> diff --git a/cpu/native/irq_cpu.c b/cpu/native/irq_cpu.c
> index 2de5378..ae52d3e 100644
> --- a/cpu/native/irq_cpu.c
> +++ b/cpu/native/irq_cpu.c
> @@ -33,7 +33,6 @@
>   // __USE_GNU for gregs[REG_EIP] access under Linux
>   #define __USE_GNU
>   #include <signal.h>
> -#undef __USE_GNU
>
>   #include "irq.h"
>   #include "cpu.h"
> @@ -41,6 +40,7 @@
>   #include "lpm.h"
>
>   #include "native_internal.h"
> +#undef __USE_GNU
>
>   #define ENABLE_DEBUG (0)
>   #include "debug.h"
> --- cut here ---
> _______________________________________________
> users mailing list
> users at riot-os.org
> http://lists.riot-os.org/mailman/listinfo/users
>


More information about the users mailing list