2.4 KiB
2.4 KiB
Critical Blocker: ARM64 NIP Static Build
Status: LINK PHASE FAILING
Root Cause Analysis
The nim c command compiles all source files to ARM64 object files successfully, but the final link step is silently failing.
Evidence:
- All
.c→.ocompilation succeeds (ARM64 object files created in/tmp/nip-arm64-cache/) - Linker command executes but lacks
-oflag specifying output path - Build returns exit code 0 (success) but no binary produced
-o:build/arm64/nipargument tonim cis being ignored or not passed to linker
Linker Command (from diagnostic output):
aarch64-linux-gnu-gcc [hundreds of .o files] \
-pthread -lm -lrt \
-L/path/to/zstd-1.5.5/lib \
-L/path/to/libressl-3.8.2/ssl/.libs \
-L/path/to/libressl-3.8.2/crypto/.libs \
-L/path/to/libressl-3.8.2/tls/.libs \
-static -lssl -lcrypto -ltls -lzstd -lpthread -ldl -lm -lresolv \
-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs
MISSING: -o /path/to/output/binary
Attempted Solutions
- ✅ Built LibreSSL 3.8.2 static (16MB crypto + 3.5MB ssl + 550KB tls) for ARM64
- ✅ Built Zstd 1.5.5 static (1.2MB) for ARM64
- ✅ Created GCC wrapper to filter x86 flags (
-mpclmul, etc.) - ✅ Used
--dynlibOverride:ssl --dynlibOverride:cryptoto prevent dlopen() - ❌ Multiple output path specifications (
-o:,--out:) all ignored - ❌ Force rebuild with
-f- still no output - ❌ Absolute paths - still no output
Hypothesis
Nim's ARM64 cross-compilation may have a bug where the -o flag isn't being passed through to the final linker invocation when using --gcc.linkerexe:aarch64-linux-gnu-gcc.
Recommended Next Steps
Option A: Manual Link (Immediate)
- Use the object files already compiled in
/tmp/nip-arm64-cache/ - Manually invoke
aarch64-linux-gnu-gccwith proper-oflag - Create binary directly
Option B: Different Nim Output Strategy
- Try
--compileOnlyto generate C code - Use custom Makefile for linking phase
- Bypass Nim's linker invocation entirely
Option C: Investigate Nim Bug
- Check if this is a known Nim cross-compilation issue
- Try older/newer Nim version
- Report bug to Nim if not known
Current Time Impact: ~3 hours spent debugging LibreSSL/Zstd static linking - successfully resolved. ~1 hour on output path issue - unresolved.