hare-build(1)
π NAME π
hare build β compile a Hare program or module. And yes, bestie, the manual page you're reading is hare-build(1) β welcome to the build chat. π«Ά
β¨ SYNOPSIS β¨
hare build [-hFqv]
[-a arch]
[-D ident[:type]=value]
[-j jobs]
[-L libdir]
[-l libname]
[-N namespace]
[-o path]
[-R]
[-T tagset]
[-t type]
[path]
πΈ DESCRIPTION πΈ
Okay so 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. No cap, that's the whole vibe.
π OPTIONS π
-hβ Print the help text.-Fβ Build for freestanding (non-hosted) environment. See FREESTANDING ENVIRONMENT.-qβ Outside of errors, don't write anything to stdout while building.-vβ 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.identis parsed as a Hare identifier (e.g."foo::bar::baz"),typeas a Hare type (e.g."str"or"struct { x: int, y: int }"), andvalueas a Hare expression (e.g."42"). Take care to address any necessary escaping to avoid conflicts between your shell syntax and Hare syntax. Shell quoting vs Hare syntax is a whole boss fight, iykyk.-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 withlibc(7)and add the+libctag to the default build tags (see BUILD TAGS inhare-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.-Rβ Build in release mode. In debug mode (the default), thedebug::module is imported as a dependency, which automatically installs a number of runtime debugging features in your executable. See this module's documentation for details on these features.-T tagsetβ Set or unset build tags. See BUILD TAGS inhare-module(5).-t typeβ Set the build type.typeshould be one ofs,o, orbin, for assembly, compiled object, or compiled binary, respectively. The default build type is compiled binary.
π¦ ARCHITECTURES π¦
The -a flag is used for cross-compilation to a target architecture different from the host architecture. The following architectures are currently supported:
aarch64riscv64x86_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. Highkey useful when you're building for a whole other architecture, bestie.
π FREESTANDING ENVIRONMENT π
If run with -F, hare build will target a freestanding environment. This has the following effects:
- No constraints are imposed on the signature of
"main" - Specifying external libraries with
-lwill not automatically:- Link with
libc(add-lcmanually if required) - Add the
+libcflag (add-T+libcmanually if required) - Use the C compiler for linking (use
LD=ccif required)
- Link with
π§ ENVIRONMENT π§
The following environment variables affect hare build's execution:
HARECACHEβ The path to the build cache. Defaults to$XDG_CACHE_HOME/hare, or~/.cache/hareif$XDG_CACHE_HOMEisn't set.HAREPATHβ The list of directories to search for module dependencies in. Seehare-module(5).NO_COLORβ Disables all color output when set to a non-empty string.HAREC_COLORβ Disables color output for harec when set to0, enables it when set to any other value. This overridesNO_COLOR.HARECβ Name of the harec command to use.HARECFLAGSβ Additional flags to pass to harec.QBEβ Name of the qbe command to use.QBEFLAGSβ Additional flags to pass to qbe.ARβ Name of thear(1)command to use.ARFLAGSβ Additional flags to pass toar(1).ASβ Name of theas(1)command to use.ASFLAGSβ Additional flags to pass toas(1).LDβ Name of theld(1)command to use.LDLINKFLAGSβ Additional flags to pass told(1).CCβ Name of thecc(1)command to use when linking external libraries.LDFLAGSβ Additional linker flags to pass tocc(1).
π₯ SEE ALSO π₯
Go give these manual pages some main character energy too: hare-run(1), hare-test(1), hare-module(5), ar(1), as(1), cc(1), ld(1).
Signed, sealed, and delivered by hare-build(1) from the General Commands Manual, dated 2026-05-05 πβ¨π
π¦ where this page comes from
- alpine 3.24: hare-doc 0.26.0.1-r0 Β· MPL-2.0 AND GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms