Compiling a program to run on zircon

45 views
Skip to first unread message

fctorial

unread,
Dec 22, 2020, 3:13:35 AM12/22/20
to zircon-dev
How do I compile and run a program that makes use of zircon syscalls? Does the fuchsia image contain a compiler(and editor) that could be used for this?

Sam Hansen

unread,
Dec 22, 2020, 1:21:10 PM12/22/20
to fctorial, zircon-dev
Someone can correct me, but I don't know that we have a target
toolchain available (e.g. gcc installed to the system).

Of course there is a target cross compiler set up on the build host.

You have a few options.

The first (and most principled approach) would be to author a
V2-component to be deployed to the target. Your code notwithstanding,
the docs for how to do that are here:
https://fuchsia.dev/fuchsia-src/development/components/build

Another option would be to define an executable() BUILD.gn target and
add it to your product's product_bootfs_labels list. This will
compile your executable and place it in the image (iirc in /boot/bin).
We use this as a quick hack to get testing binaries inside the image
that we're building/flashing to a board. If you already have a booted
system, and aren't reflashing or repaving, this is probably more
trouble than it's worth.


On Tue, Dec 22, 2020 at 12:13 AM fctorial <fcto...@gmail.com> wrote:
>
> How do I compile and run a program that makes use of zircon syscalls? Does the fuchsia image contain a compiler(and editor) that could be used for this?
>
> --
> All posts must follow the Fuchsia Code of Conduct https://fuchsia.dev/fuchsia-src/CODE_OF_CONDUCT or may be removed.
> ---
> To unsubscribe from this group and stop receiving emails from it, send an email to zircon-dev+...@fuchsia.dev.

Justin Mattson

unread,
Dec 22, 2020, 5:13:39 PM12/22/20
to Sam Hansen, fctorial, zircon-dev
Oh yeah, I misread the original message, I don't think we're self-hosting at this point.

Cheers,
Justin
Reply all
Reply to author
Forward
0 new messages