Troubleshooting Guide
Common problems and solutions when working with Neuro.
Installation Issues
"No suitable version of LLVM was found"
Symptoms:
error: No suitable version of LLVM was found system-wide or pointed
to by LLVM_SYS_201_PREFIX.
Cause: LLVM_SYS_201_PREFIX not set or points to wrong location. Neuro requires LLVM 20.
Solution:
Windows:
# Set environment variable (adjust path to your LLVM 20 install)[System.Environment]::SetEnvironmentVariable('LLVM_SYS_201_PREFIX', 'C:\LLVM-20', 'Machine') # Restart terminal and verify$env:LLVM_SYS_201_PREFIXUnix:
# Add to ~/.bashrc or ~/.zshrc (path varies by distro)
export LLVM_SYS_201_PREFIX=/usr/lib/llvm-20 # Ubuntu/Debian
# export LLVM_SYS_201_PREFIX=/usr/lib/llvm20 # Arch/CachyOS
# Reload shell config
source ~/.bashrc
# Verify
echo $LLVM_SYS_201_PREFIX"LLVMConfig.cmake not found"
Symptoms:
Could not find LLVMConfig.cmake
Cause: Installed .exe installer instead of full development package.
Solution:
Download and extract the full development package:
- Windows: the LLVM 20
clang+llvm-20.*-x86_64-pc-windows-msvc.tar.xzarchive - URL: https://github.com/llvm/llvm-project/releases
DO NOT use the .exe installer - it lacks required development files.
"cannot open input file 'libxml2s.lib'" (Windows)
Symptoms:
LINK : fatal error LNK1181: cannot open input file 'libxml2s.lib'
Cause: libxml2 not installed via vcpkg.
Solution:
cd C:\vcpkg.\vcpkg install libxml2:x64-windows-static.\vcpkg integrate install # Verify installation.\vcpkg list | findstr libxml2Build fails with linker errors (Unix)
Symptoms:
error: linker `cc` not found
Cause: Missing C/C++ compiler toolchain.
Solution:
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install build-essentialArch:
sudo pacman -S base-develmacOS:
xcode-select --installcargo build --features mlir fails
The mlir-backend slice's mlir feature is opt-in and needs more than stock LLVM 20.
Default builds compile a placeholder and need none of this.
Symptoms:
mlir-sys: MLIR_SYS_200_PREFIX not set
# or
error: evaluation of constant value failed: attempt to compute `0_usize - 8_usize`
Cause: two separate gaps.
- Most distro LLVM 20 packages (Arch/CachyOS
llvm20included) ship no MLIR — nomlir-cheaders, nolibMLIR*. Check withls $LLVM_SYS_201_PREFIX/include/mlir-c. mlir-sysruns bindgen over the MLIR-C headers. A newer libclang than 20 misparses LLVM 20'sDEFINE_C_API_STRUCTmacro, yielding opaque 1-byte structs and the0_usize - 8_usizeconst-eval underflow above. Rolling distros ship libclang 22.
Solution: build LLVM 20 with MLIR enabled, and point bindgen at a libclang 20.
# 1. LLVM 20 + MLIR, installed to a prefix of your choosing
cmake -S llvm -B build -DLLVM_ENABLE_PROJECTS=mlir -DCMAKE_INSTALL_PREFIX=<mlir-prefix> ...
# 2. libclang 20, unpacked anywhere (no system downgrade needed)
# needs libclang.so* plus the clang/20/include resource headers
# 3. Point every binding at them
export LLVM_SYS_201_PREFIX=<mlir-prefix> # inkwell
export MLIR_SYS_200_PREFIX=<mlir-prefix> # melior
export TABLEGEN_200_PREFIX=<mlir-prefix> # mlir-tblgen
export LIBCLANG_PATH=<libclang-20-dir>
export BINDGEN_EXTRA_CLANG_ARGS="-resource-dir=<libclang-20-dir>/clang/20"
cargo test -p mlir-backend --features mlirIf the distro libclang 20 is linked against the distro's own versioned libLLVM.so.20.1,
put that package's lib/ first on LD_LIBRARY_PATH so bindgen can load it, and the
MLIR prefix's lib/ second for the runtime libMLIR.
Compilation Errors
Type Mismatch Errors
Symptoms:
Type errors found in "program.nr":
1. type mismatch at Span { start: 25, end: 42 }: expected i32, found f64
Error: 1 type error(s) found
Causes:
- Incorrect type in assignment or return
- Mixing integer and float types
- Using wrong type for function argument
Solutions:
Check variable types:
// Error: mixing typesval x: i32 = 10val y: f64 = 3.14// val z = x + y // Type mismatch // Fix: use same typesval x: f64 = 10.0val y: f64 = 3.14val z: f64 = x + y // OKCheck function signatures:
func takes_i32(x: i32) -> i32 { return x} // Error: passing wrong typeval y: f64 = 3.14// takes_i32(y) // Type mismatch // Fix: use correct typeval x: i32 = 42takes_i32(x) // OKUndefined Variable Errors
Symptoms:
Type errors found in "program.nr":
1. undefined variable 'z' at Span { start: 32, end: 33 }
Error: 1 type error(s) found
Causes:
- Variable not declared before use
- Typo in variable name
- Variable out of scope
Solutions:
Declare before use:
// Error: undefined// return x // Fix: declare firstval x: i32 = 42return xCheck scope:
func scoped() -> i32 { if true { val x: i32 = 10 } // return x // Error: x out of scope // Fix: declare in correct scope val x: i32 = 10 if true { // x is accessible here } return x // OK}Cannot Assign to Immutable Variable
Symptoms:
Type errors found in "program.nr":
1. cannot assign to immutable variable 'x' at Span { start: 55, end: 61 }
Error: 1 type error(s) found
Cause: Trying to reassign val variable.
Solution:
Use mut for variables that need to change:
// Error: immutableval x: i32 = 10// x = 20 // Error // Fix: use mutmut y: i32 = 10y = 20 // OKMissing Return Statement
Symptoms:
Type errors found in "program.nr":
1. missing return statement in function returning i32 at Span { start: 0, end: 120 }
Error: 1 type error(s) found
Cause: Function doesn't return a value on all code paths.
Solutions:
Add missing return:
// Error: missing return for x <= 0func bad(x: i32) -> i32 { if x > 0 { return x } // Missing return for else case} // Fix: add else branchfunc good(x: i32) -> i32 { if x > 0 { return x } else { return 0 }}Use implicit return:
func good_implicit(x: i32) -> i32 { if x > 0 { x } else { 0 }}Parse Errors
Symptoms:
Error: Module error: failed to parse module `program.nr`: unexpected token RightBrace, expected expression
Parse errors stop the run at the first one; only the type checker reports a list.
Common causes:
- A stray semicolon (Neuro has none, see below)
- Unbalanced brackets/braces
- Syntax errors
Solutions:
Remove semicolons: Neuro statements are terminated by a newline, not ;.
A trailing semicolon is an unexpected token Semicolon parse error:
// Error: semicolons are not valid tokensval x: i32 = 10;val y: i32 = 20; // Fix: one statement per line, no `;`val x: i32 = 10val y: i32 = 20Check brackets:
// Error: unbalanced bracesfunc bad() -> i32 { if true { return 1 // Missing closing brace} // Fix: add missing bracefunc good() -> i32 { if true { return 1 } // Closing brace added}Runtime Issues
Executable Doesn't Run (Windows)
Symptoms:
- Executable created but won't run
- "Cannot find DLL" errors
Causes:
- Missing MSVC runtime
- Antivirus blocking execution
Solutions:
Install Visual C++ Redistributable:
- Download from: https://aka.ms/vs/17/release/vc_redist.x64.exe
- Install and restart
Check antivirus:
- Add exception for Neuro executables
- Temporarily disable to test
Permission Denied (Unix)
Symptoms:
bash: ./program: Permission denied
Cause: Executable permission not set.
Solution:
chmod +x ./program
./programRuntime Crash (signal)
Symptoms: The compiled program dies on an OS signal instead of exiting normally.
Causes (rare):
- Division by zero raises a hardware exception (
SIGFPE); there is no checked division yet - Integer overflow with
-O0traps deliberately (the overflow check aborts the process); release builds wrap silently - A compiler bug (codegen producing invalid memory accesses)
Solutions:
Check for division by zero:
// Potential crashval x: i32 = 10 / 0 // Division by zero // Fix: check denominatorfunc safe_divide(a: i32, b: i32) -> i32 { if b == 0 { return 0 // Or handle error } else { return a / b }}Report compiler bugs:
- GitHub Issues: https://github.com/PanzerPeter/Neuro/issues
- Include minimal reproduction case
Performance Issues
Slow Compilation
Symptoms: Compilation takes longer than expected.
Causes:
- Debug build of compiler
- Large program
- System resource constraints
Solutions:
Use release build:
# Build compiler in release mode
cargo build --release -p neurc
# Use release build
cargo run --release -p neurc -- compile program.nrCheck system resources:
- Close unnecessary applications
- Ensure sufficient RAM (minimum 4GB recommended)
- Check disk space
Large Executable Size
Symptoms: Executable is larger than expected.
Causes:
- Debug information included
- Lower optimization level selected for faster compile time
Solutions:
Current:
- Use
-O2or-O3duringneurc compileto reduce binary size and improve runtime performance - Typical size: 1-5 MB for simple programs
Further optimization options:
- Strip debug info with linker options
Development Environment Issues
VSCode Syntax Highlighting Not Working
Symptoms:
.nr files show no syntax highlighting.
Solution:
Install Neuro VSCode extension:
cd neuro-language-support
npm install -g @vscode/vsce
vsce package
code --install-extension neuro-language-support-*.vsix --forceThen reload the window (Developer: Reload Window). Highlighting in an editor that was
already open does not refresh on its own.
Git Line Ending Issues (Windows)
Symptoms: Git shows all files as modified.
Solution:
# Configure Git for cross-platform development
git config --global core.autocrlf trueDebugging Techniques
Enable Debug Logging
Get detailed compilation information:
# Windows (PowerShell)
$env:RUST_LOG="debug"
neurc compile program.nr 2> debug.log
# Unix
RUST_LOG=debug neurc compile program.nr 2> debug.log
# Review log
cat debug.logIsolate the Problem
Create minimal reproduction:
// Start with simplest programfunc main() -> i32 { return 0} // Gradually add code until error appearsCheck Each Stage
Test compilation stages separately:
# 1. Check syntax only
neurc check program.nr
# 2. If check passes, try compile
neurc compile program.nr
# 3. If compile passes, try run
./programGetting Help
Before Asking for Help
- Check this troubleshooting guide
- Search GitHub issues
- Enable debug logging
- Create minimal reproduction
- Review CONTRIBUTING.md for development and reporting guidelines
Reporting Issues
Include in bug reports:
- Neuro compiler version
- Operating system and version
- LLVM version
- Rust version
- Complete error message
- Minimal reproduction case
- Steps to reproduce
Template:
## Environment- OS: Windows 11 / Ubuntu 22.04 / macOS 13- Neuro: version from `neurc --version` (and commit hash)- LLVM: 20.x- Rust: 1.85+ ## Issue[Description] ## Reproduction[Minimal .nr file that reproduces the issue] ## Expected[What should happen] ## Actual[What actually happens] ## Error Output[Complete error message with debug logging]
Resources
- GitHub Issues: https://github.com/PanzerPeter/Neuro/issues
- Documentation: README.md
- Development Guidelines: CONTRIBUTING.md
Known Limitations (current)
These are not bugs, but current limitations. See the Quick Roadmap for what is landed and what is planned.
- Type inference: bare numeric literals default to
i32/f64unless a type is in scope - Generic type arguments: restricted to
Copytypes, and a generic may not be instantiated with an enclosing type parameter (noOption<T>inside afunc f<T>) - Strings are immutable:
+,.len(),.clone(),.slice(a..b),.char_slice(a..b),.chars(),.char_indices(). Build text that grows with theStringbuffer (String::new/.push_str/.clear/.to_string) instead of chaining+ - String interpolation holes: a hole may not contain a
"string literal, and an interpolated literal is not a constant pattern. Triple-quoted"""blocks and nesting block comments carry no such restriction - Ranges:
a..banda..=bdriveforloops and.slice();.rev()and.step(n)are not implemented yet - Optimization:
-O0through-O3supported (higher levels may increase compile time)
Planned features are tracked through project issues and changelog updates.
Common Warnings
The compiler currently emits one lint:
prefer-loop-over-while-true
Message:
warning[prefer-loop-over-while-true] at 24..28: `while true { ... }` should be written as `loop { ... }`; silence with `@allow(prefer_loop_over_while_true)` on the enclosing function
Cause: A while loop whose condition is the literal true. loop { ... } says the same
thing and is the idiomatic form.
Solution:
// Triggers the lintwhile true { break} // Preferredloop { break}Silence it with @allow(prefer_loop_over_while_true) on the enclosing function when the literal
form reads better. Warnings never block compilation.
FAQ
Why does my program compile but do nothing?
Check that main returns the expected exit code and performs desired operations.
Why can't I mix i32 and i64?
Neuro uses strict typing with no implicit conversions. Convert explicitly with an as
cast: val wide: i64 = narrow as i64.
Why is compilation slow?
Use -O0 for fastest compile/debug loops and -O2/-O3 for faster runtime binaries.
How do I speed up development?
Use neurc check for rapid feedback without code generation.
Can I use Neuro for production?
Not yet — the language is alpha. The core language (Phase 1) is complete and tensor values can be built, but tensor arithmetic, autodiff, and the GPU path are still ahead; see the Quick Roadmap.
Still Stuck?
If this guide doesn't solve your problem:
- Check CLI Usage Guide
- Review Language Reference
- Search or create GitHub Issue
- Include all requested information in bug reports