Search code examples
.net-coreraspbian

.NET Core runtime environment on Raspberry Pi throws segmentation fault


I have tried to install the .NET Core runtime environment following one of the answers from here: Is it possible to run .NET Core on Raspberry PI?

I have checked that I have all the needed packages installed but when I run "dotnet --info" I just get segmentation fault. Strace does not give good ideas on what might be missing: https://pastebin.com/rBUbiYkV

mmap2(NULL, 180536, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)  = 0xb6c9f000
mprotect(0xb6cbb000, 61440, PROT_NONE)  = 0
mmap2(0xb6cca000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b000) = 0xb6cca000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0@h\1\0004\0\0\0"..., 512) = 512
lseek(3, 1231820, SEEK_SET)             = 1231820
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2880) = 2880
lseek(3, 1228284, SEEK_SET)             = 1228284
read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
fstat64(3, {st_mode=S_IFREG|0755, st_size=1234700, ...}) = 0
mmap2(NULL, 1303888, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6b60000
mprotect(0xb6c8a000, 61440, PROT_NONE)  = 0
mmap2(0xb6c99000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x129000) = 0xb6c99000
mmap2(0xb6c9c000, 9552, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6c9c000
close(3)                                = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f25000
set_tls(0xb6f256d0, 0xb6f25dc8, 0xb6f2b050, 0xb6f256d0, 0xb6f2b050) = 0
mprotect(0xb6c99000, 8192, PROT_READ)   = 0
mprotect(0xb6cca000, 4096, PROT_READ)   = 0
mprotect(0xb6d49000, 4096, PROT_READ)   = 0
mprotect(0xb6e8a000, 20480, PROT_READ)  = 0
mprotect(0xb6eb8000, 4096, PROT_READ)   = 0
mprotect(0xb6ecd000, 4096, PROT_READ)   = 0
mprotect(0xb6ee4000, 20480, PROT_READ|PROT_WRITE) = 0
mprotect(0xb6ee4000, 20480, PROT_READ|PROT_EXEC) = 0
cacheflush(0xb6ee4000, 0xb6ee9000, 0, 0x15, 0) = 0
mprotect(0xb6ef8000, 4096, PROT_READ)   = 0
mprotect(0x21000, 4096, PROT_READ)      = 0
mprotect(0xb6f2a000, 4096, PROT_READ)   = 0
munmap(0xb6ecf000, 83008)               = 0
set_tid_address(0xb6f25278)             = 24092
set_robust_list(0xb6f25280, 12)         = 0
rt_sigaction(SIGRTMIN, {sa_handler=0xb6e972b0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0xb6b8c6c0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0xb6e97390, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0xb6b8c6c0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
brk(NULL)                               = 0x100b000
brk(0x1030000)                          = 0x1030000
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x6011e} ---
+++ killed by SIGSEGV +++
Segmentation fault

What should I try next?


Solution

  • Raspberry Pi 1 contains an ARMv6 processor.

    .NET Core requires a processor that can execute the ARMv7 instruction set since that is what the JIT emits:

    Note: Pi Zero is not supported because the .NET Core JIT depends on armv7 instructions not available on Pi Zero.

    So this is just not going to work. Sorry. Try with a Raspberry Pi 2 or 3 instead.

    (If you are crazy adventurous, you can try porting the JIT yourself. I wouldn't try this unless you are very very comfortable writing ARM assembly, C, C++, C# and understand compilers deeply)