Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Build an initial `hab` binary for the `x86_64-linux-kernel2` package target
# Change directory to the root of your `habitat-sh/habitat` repo checkout
# cd /path/to/habiatat-sh/habitat
# Cleanup any existing Studio instances--keep it clean to be safe!
hab studio rm
# Enter the studio with the `core` key and prevent a Supervisor from starting
env HAB_ORIGIN=core HAB_STUDIO_SUP=false hab studio enter
# Build a static `hab` CLI for the `x86_64-linux-kernel2` target
env BUILD_PKG_TARGET=x86_64-linux-kernel2 \
/src/components/plan-build/bin/hab-plan-build.sh components/hab
# For convenience, copy the static `hab` binary into the results directory.
#
# Note that we don't use `hab pkg path` to get the path, as future releases of
# Habitat would filter this installed package out. Remember that we built this
# binary with an `x86_64-linux` toolchain. This is fine for initial
# bootstrapping however, and an important reason why the `hab` binary is
# statically compiled.
(source ./results/last_build.env \
&& cp "/hab/pkgs/$pkg_ident/bin/hab" ./results/hab-x86_64-linux-kernel2)
# All done, exit the Studio
exit
@fnichol

This comment has been minimized.

Copy link
Owner Author

commented Jul 19, 2018

At the moment, you can verify that the binary has the proper package target by trying to install a package with debug logging turned on:

env RUST_LOG=debug ./results/hab-x86_64-linux-kernel2 install core/jq-static`

You'll most likely see a bunch of "rejected PackageInstall candidate" messages which show active_target=x86_64-linux-kernel2 at the end of that line.

Clearly we'll want to have better user feedback with a few of these tools so it's easier to know what the underlying package target is for any binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.