[riot users] make term fails with segfault

Hi,

I wanted to test RIOT OS for the first time. I followed the tutorial at https://github.com/RIOT-OS/Tutorials/tree/master/task-01 I can run make all without any errors but as soon as I try to run make term I get this:

make term .../Tutorials/task-01/bin/native/Task01.elf .../Tutorials/task-01/../RIOT/Makefile.include:400: recipe for target 'term' failed make: *** [term] Segmentation fault

Any ideas how to fix this?

Cheers, Felix

Hi Felix,

Welcome to the RIOT community! :slight_smile:

make term .../Tutorials/task-01/bin/native/Task01.elf .../Tutorials/task-01/../RIOT/Makefile.include:400: recipe for target 'term' failed make: *** [term] Segmentation fault

Any ideas how to fix this?

I just tried this locally, it worked fine. What OS are you on?

Please try adding "-g" to CFLAGS in the tasks Makefile, then recompile with "make clean all". You should then be able to launch native/Task01.elf through gdb ("gdb native/Task01.elf", enter "run", wait until it crashes, type "bt" to get backtrace).

Hi Kaspar,

seems my glibc is not working as expected from RIOT. I have no clue how to fix this though. Any idea?

I am using: ~$ cat /proc/version Linux version 4.4.157 (root@hive64.slackware.lan) (gcc version 5.5.0 (GCC) ) #2 SMP Fri Sep 21 00:36:59 CDT 2018

Here is the output of gdb:

(gdb) run Starting program: .../Tutorials/task-01/bin/native/Task01.elf

Program received signal SIGSEGV, Segmentation fault. 0xf7e6505a in _getopt_internal_r () from /lib/libc.so.6 (gdb) bt #0 0xf7e6505a in _getopt_internal_r () from /lib/libc.so.6 #1 0xf7e65e32 in _getopt_internal () from /lib/libc.so.6 #2 0xf7e65f47 in getopt_long () from /lib/libc.so.6 #3 0x08048dfd in startup (argc=24641422, argv=0x8050000, envp=0x1)     at .../Tutorials/RIOT/cpu/native/startup.c:303 #4 0x0804c49d in __do_global_ctors_aux () #5 0x0177ff8e in ?? () #6 0x08050000 in ?? () #7 0x08048a70 in _init () #8 0xffffd17c in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?)

I installed a multilib environment on my OS. RIOT uses the 32bit version of glibc. I also have a 64bit version installed though. Could this lead to any confusion?

Here are my glibc versions:

$ /lib/libc.so.6 GNU C Library (GNU libc) stable release version 2.23, by Roland McGrath et al. Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 5.3.0. Available extensions:   crypt add-on version 2.1 by Michael Glad and others   GNU Libidn by Simon Josefsson   Native POSIX Threads Library by Ulrich Drepper et al   BIND-8.2.3-T5B libc ABIs: UNIQUE IFUNC For bug reporting instructions, please see: <http://www.gnu.org/software/libc/bugs.html&gt;\.

$ /lib64/libc.so.6 GNU C Library (GNU libc) stable release version 2.23, by Roland McGrath et al. Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 5.3.0. Available extensions:   crypt add-on version 2.1 by Michael Glad and others   GNU Libidn by Simon Josefsson   Native POSIX Threads Library by Ulrich Drepper et al   BIND-8.2.3-T5B libc ABIs: UNIQUE IFUNC For bug reporting instructions, please see: <http://www.gnu.org/software/libc/bugs.html&gt;\.

Cheers, Felix

Hi Felix,