Installing Xen · Coding Class
This topic is not available in the selected language or version. Showing the start of this section.
Apply the chapter in three steps: an exercise, a program project, and a debugging task. Implement first, then consult the hints and completion criteria. Use a separate file or working directory for each task.
1. Exercise · Check the environment
Section titled “1. Exercise · Check the environment”Run xen version and uname -m; record the compiler version and host CPU. Choose the matching package from the installation table.
Completion: The version is xen 0.1.0-demo.2, and the download matches the host CPU.
Hint: x86_64 maps to Debian amd64; aarch64 maps to arm64.
2. Build a program · Prepare a workspace
Section titled “2. Build a program · Prepare a workspace”Create hello.xen in a new exercise directory using the preparation code below. Run xen check hello.xen and xen run hello.xen, then change directory and run it using an absolute path.
Completion: Both locations print one line, ready. Checking succeeds without output.
Hint: Relative file paths are resolved from the current shell directory.
3. Debug · Fix a missing command
Section titled “3. Debug · Fix a missing command”Assume ./bin/xen version works in the archive directory but xen version fails elsewhere. Explain the cause and fix PATH for the current shell without removing an existing installation.
Completion: From another directory, command -v xen identifies the intended executable and the version command works.
Hint: Prepend the installed bin directory to PATH. Keep the distribution’s bin and stdlib together.
Preparation code
Section titled “Preparation code”fn main() { println("ready"); }readyVerify and record
Section titled “Verify and record”Use xen check file.xen followed by xen run file.xen for ordinary programs; use xen test file.xen for test-only files. Record the original error, its cause, and the corrected result, then rerun every input in the completion criteria.