Skip to content

build: Switch to static linking and adopt CROSS_COMPILE for toolchain selection #58

@agicy

Description

@agicy

Problem Description

Currently, hvisor-tool defaults to dynamic linking. This causes issues when the build host's environment differs from the target machine's root-linux environment, leading to runtime errors such as missing shared libraries or version mismatches (e.g., glibc).

I encountered this issue when cross-compiling on an Ubuntu 22.04 (x86-64) host. The resulting binary failed to run on a Sysoul X3300 (Debian 11 aarch64) target.

Proposed Changes

The tool should be compiled statically to ensure portability across different rootfs versions and distributions.

The current build system relies on complex conditional logic to select the compiler. I suggest simplifying this by adopting the standard `CROSS_COMPILE` variable approach (similar to the Linux kernel build system). This would allow users to explicitly define their toolchain prefix easily.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions