vercel-labs / vercel-labs/native
Linux + Mobile: Allow Debug Builds, No LLVM
Nobody has claimed this yet.
- Dominant language
- Zig
- Stars
- 7.7k
- Forks
- 314
- Avg merge
- 5h
- Merged PRs (30d)
- 13
Description
Hey, I've been using the library for roughly a week now on Linux, and wanted to submit a few PRs to help ease the developer experience. This is 1/4 PRs going out.
I just want to say, thank you so much for developing this. This is exactly what I was looking for, for a long time, a lightweight tool that uses a high-level styling language.
Linux / Mobile LLVM is an upstream Zig bug, however the Zig team is unfortunately bogged down by lots of other more "Important" PRs. So, as a permenant fix / temporary, up to you, the maintainer. I suggest we replace:
Problem
Zig 0.16.0 self-hosted x86_64 backend mis-lowers SysV C ABI for wide mixed
signatures — interleaved f32/pointer args + long stack-spilled lists land a
slot off. Symptoms: corrupted safe-area insets, garbage view role pointer,
blank GPU present. Upstream Zig bug; team busy. Current workaround forces LLVM
on every x86_64 artifact → slow Debug rebuilds.
Fix
Don't fight the backend — stop crossing the bad shape. Pass one descriptor
pointer per seam; thin C wrapper unpacks into the existing wide fn (C→C,
correct). Then drop the force.
Non-working (current):
// build/app.zig — force LLVM everywhere on x86_64
.use_llvm = useLlvmWorkaround(target),
pub fn useLlvmWorkaround(t: std.Build.ResolvedTarget) ?bool {
return if (t.result.cpu.arch == .x86_64) true else null;
}
// seam that miscompiles — wide positional signature:
extern fn native_sdk_gtk_create_view(host, window_id, label, label_len,
x, y, width, height, /* +14 mixed args */) c_int;
Working:
const GtkViewDesc = extern struct { window_id: u64, label: [*]const u8,
label_len: usize, x: f64, y: f64, width: f64, height: f64, /* … */ };
extern fn native_sdk_gtk_create_view_desc(host: *GtkHost, desc: *const GtkViewDesc) c_int;
// build/app.zig — let Zig choose (self-hosted Debug, LLVM Release):
.use_llvm = app_options.use_llvm, // null default; consumer can still opt in
Same treatment: update_view, GPU-surface present, mobile native_sdk_app_viewport
(11-f32 inset ABI → native_sdk_viewport_t*).
Impact
- Debug defaults to self-hosted → ~5x faster rebuilds (logic changes, not markup reload).
- No
-fllvm/-flldneeded fornative dev=> HUGEEE - Backend now consumer-selectable via
AppOptions/MobileLibOptionsuse_llvm/use_lld; escape hatch kept for a future seam.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with build/app.zig and the listed native seams: create_view, update_view, GPU-surface present, and native_sdk_app_viewport. Trace how AppOptions and MobileLibOptions provide use_llvm/use_lld, then verify that descriptor-based calls avoid the problematic wide ABI while Debug can use the self-hosted backend and consumers can still opt into LLVM or LLD.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- zig
- Domain
- backend-api-design, build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100