hare-build - (unknown subject)



hare build - compile a Hare program or module


hare build [-hqv]

[-a arch]

[-D ident[:type]=value]


[-j jobs]

[-L libdir]

[-l libname]

[-N namespace]

[-o path]

[-T tagset]

[-t type]



hare build compiles a Hare program or module. The path argument is a path to a Hare source file or to a directory which contains a Hare module (see hare-module(5)). If no path is given, the Hare module contained in the current working directory is built.



Print the help text.


Outside of errors, don’t write anything to stdout while building.


Enable verbose logging. Specify twice to increase verbosity.

-a arch

Set the desired architecture for cross-compiling. See ARCHITECTURES for supported architecture names.

-D ident[:type]=value

Define a constant in the type system. ident is parsed as a Hare identifier (e.g. "foo::bar::baz"), type as a Hare type (e.g. "str" or "struct { x: int, y: int }"), and value as a Hare expression (e.g. "42"). Take care to address any necessary escaping to avoid conflicts between your shell syntax and Hare syntax.


Build for freestanding (non-hosted) environment. This allows a declaration whose symbol is main to take on any form.

-j jobs

Set the maximum number of jobs to execute in parallel. The default is the number of processors available on the host.

-L libdir

Add a directory to the linker library search path.

-l libname

Link with the named system library. The name is passed directly to the linker. Linking with any library will also link with libc(7) and add the +libc tag to the default build tags (see BUILD TAGS in hare-module(5)).

-N namespace

Override the namespace for the module.

-o path

Set the output file to the given path. Setting the path to - causes output to be written to stdout.

-T tagset

Set or unset build tags. See BUILD TAGS in hare-module(5).

-t type

Set the build type. type should be one of s, o, or bin, for assembly, compiled object, or compiled binary, respectively. The default build type is compiled binary.


The -a flag is used for cross-compilation to a target architecture different from the host architecture. The following architectures are currently supported:

• aarch64
• riscv64
• x86_64

The system usually provides reasonable defaults for the AR, AS, LD, and CC tools based on the desired target. However, you may wish to set these variables yourself to control the cross toolchain in use.


The following environment variables affect hare build’s execution:


hare-run(1), hare-test(1), hare-module(5), ar(1), as(1), cc(1), ld(1)

Updated 2024-01-29 - jenkler.se | uex.se