You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting a Illegal instruction (core dumped) when trying to run #1422
Getting the Illegal instruction (core dumped) when I try to run llamasharp. Here is my process of trying to run this repo:
-dotnet new console -n LlamaSharpProject
-cd LLamaSharpProject
-dotnet add package LLamaSharp (I did not see the notice at the bottom of the readme at first, so i also went back and did the process over with --version 0.24.0 appended)
-dotnet add package LLamaSharp.Backend.Cpu (appended --version 0.24.0 on other attempt)
-dotnet build
-dotnet run (it fails silently, get no feedback from console.)
I then try dotnet bin/Debug/net10.0/LlamaSharpProject.dll and that is when i see the core dump message.
I am running this on an old laptop. These are its flags from lscpu command:
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pg
e mca cmov pat pse36 clflush dts acpi mmx fxsr sse
sse2 ht tm pbe syscall nx lm constant_tsc arch_perf
mon pebs bts rep_good nopl cpuid aperfmperf pni dte
s64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lah
f_lm pti dtherm ida
I am able to run models fine using ggml's llama.cpp. I am running the Qwen3-0_6B-Q4_0
Any help would be greatly appreciated.
Hi @blackdow1, your lscpu flags point directly to the root of the problem.
The Illegal instruction (core dumped) error is happening because your laptop's CPU is a bit older and doesn't support AVX or AVX2 instructions (looking at your flags, your CPU caps out at ssse3).
The native libraries bundled inside the LLamaSharp.Backend.Cpu NuGet package are pre-compiled with AVX support enabled to ensure fast performance for most modern hardware. When your CPU encounters one of those instructions, it crashes.
The reason standard llama.cpp works for you is likely because you built it from source on that machine, meaning your C++ compiler automatically turned off AVX instructions to match your hardware.
How to fix this:
To run LLamaSharp on this specific machine, you'll need to use a backend compiled without AVX.
Thanks very much for volunteering to look into this. I suspect you'll need to look into modifying the noavx build in this file to remove the unknown instructions.
Thanks for the guidance, @martindevans. I'll check out the noavx build in the compile.yml file and see what modifications are needed to remove the unsupported instructions. I'll update here once I make some progress.
The noavx job was already turning AVX off, but ggml still defaulted GGML_SSE42=ON and compiled with -msse4.2. That is an illegal instruction on a CPU that only has SSSE3.
The PR turns SSE4.2 off on every noavx / Rosetta build and pins gcc/clang to -march=x86-64. I configured current llama.cpp both ways: old flags print -msse4.2 GGML_SSE42, new flags do not, and objdump of the new libggml-cpu.so has no SSE4.1/4.2 ops.
This does not change the NuGet you have installed today. It takes effect after the next Update Binaries run and a new LLamaSharp.Backend.Cpu publish. Until then you can compile llama.cpp with those same flags and load it through NativeLibraryConfig.All.WithLibrary. I put that path in the FAQ on the PR.
Activity
zsogitbe commentedon Aug 22, 2026
Hi @blackdow1, your
lscpuflags point directly to the root of the problem.The
Illegal instruction (core dumped)error is happening because your laptop's CPU is a bit older and doesn't support AVX or AVX2 instructions (looking at your flags, your CPU caps out atssse3).The native libraries bundled inside the
LLamaSharp.Backend.CpuNuGet package are pre-compiled with AVX support enabled to ensure fast performance for most modern hardware. When your CPU encounters one of those instructions, it crashes.The reason standard
llama.cppworks for you is likely because you built it from source on that machine, meaning your C++ compiler automatically turned off AVX instructions to match your hardware.How to fix this:
To run LLamaSharp on this specific machine, you'll need to use a backend compiled without AVX.
modelpath-dev commentedon Sep 4, 2026
I'll work on this. Could you assign it to me?
I'll look at the current code, add a focused test, and send a small PR.
martindevans commentedon Sep 4, 2026
Thanks very much for volunteering to look into this. I suspect you'll need to look into modifying the
noavxbuild in this file to remove the unknown instructions.modelpath-dev commentedon Sep 5, 2026
Thanks for the guidance, @martindevans. I'll check out the
noavxbuild in thecompile.ymlfile and see what modifications are needed to remove the unsupported instructions. I'll update here once I make some progress.modelpath-dev commentedon Sep 6, 2026
PR is up: #1438
The noavx job was already turning AVX off, but ggml still defaulted GGML_SSE42=ON and compiled with -msse4.2. That is an illegal instruction on a CPU that only has SSSE3.
The PR turns SSE4.2 off on every noavx / Rosetta build and pins gcc/clang to -march=x86-64. I configured current llama.cpp both ways: old flags print
-msse4.2 GGML_SSE42, new flags do not, and objdump of the new libggml-cpu.so has no SSE4.1/4.2 ops.This does not change the NuGet you have installed today. It takes effect after the next Update Binaries run and a new LLamaSharp.Backend.Cpu publish. Until then you can compile llama.cpp with those same flags and load it through NativeLibraryConfig.All.WithLibrary. I put that path in the FAQ on the PR.