DEV Community

BMJ
BMJ

Posted on

ForgeZero Now Supports musl Cross-Compilation and Objective-C on Linux

πŸš€ ForgeZero Now Supports musl Cross-Compilation and Objective-C on Linux

I've been spending the last few weeks improving ForgeZero, adding support for more toolchains and making cross-platform development a little easier.

The latest update introduces two features that I wanted for quite some time:

  • βœ… musl cross-compilation powered by the Zig toolchain
  • βœ… Objective-C support on Linux with automatic compiler and linker selection

The best part? No additional configuration is required.

Just write your code and let ForgeZero handle the rest.


Static musl Builds

ForgeZero can now generate fully static musl binaries, making cross-compilation almost effortless.

fz -cc main.c -musl=riscv64 -toolchain zig
Enter fullscreen mode Exit fullscreen mode

The resulting binary:

main: ELF 64-bit LSB executable, UCB RISC-V, RVC, double-float ABI, version 1 (SYSV), statically linked, with debug_info, not stripped
Enter fullscreen mode Exit fullscreen mode

Static binaries are incredibly useful when building:

  • 🐳 Minimal Docker images (scratch)
  • πŸ“¦ Portable standalone executables
  • πŸ”Œ Embedded & IoT applications
  • πŸ–₯️ Systems without glibc
  • 🌍 Cross-platform deployment pipelines

Using Zig as the backend compiler makes targeting different architectures surprisingly simple while keeping the ForgeZero interface exactly the same.


Objective-C on Linux

This is probably the feature I'm most excited about.

ForgeZero now automatically detects .m Objective-C source files and switches to the correct compilation pipeline without requiring any flags.

fz -cc main.m
Enter fullscreen mode Exit fullscreen mode

Verbose output:

Objective-C detected!
Bypassing Zig linker to use Clang with -lobjc

Running:
clang main.o -o main -lobjc -Wl,--build-id=none

Built: main
Enter fullscreen mode Exit fullscreen mode

No custom scripts.

No Makefiles.

No manually remembering linker flags.

ForgeZero simply detects the language and invokes the correct backend automatically.


Why Objective-C?

Most developers associate Objective-C exclusively with macOS and Apple's ecosystem.

However, GNU Objective-C works perfectly fine on Linux through Clang and libobjc.

Supporting it means ForgeZero can now build another systems programming language using exactly the same interface as C or Assembly:

fz -cc hello.c
fz -cc hello.m
fz -asm boot.asm
Enter fullscreen mode Exit fullscreen mode

The command stays the sameβ€”the build pipeline adapts automatically.


Where ForgeZero is Going

ForgeZero originally started as a tiny utility to avoid typing endless compiler and linker commands.

Over time, it has evolved into a unified build frontend capable of orchestrating multiple toolchains while automatically selecting the right backend for the current source language.

The philosophy remains simple:

Write code, run one command, and let the build system figure out the details.

There's still a lot of work ahead, but I'm happy with the direction the project is taking.


Links

⭐ GitHub & Documentation:
https://github.com/forgezero-cli/forgezero

πŸ‘€ Author:
https://github.com/alexvoste

Feedback, ideas, and contributions are always welcome.

Top comments (0)