Skip to content

nix-unit CLI fails on system with 16K page size #273

@montchr

Description

@montchr

I am running NixOS on an Apple M2 MacBook Air via nixos-apple-silicon. One of the issues that comes up sometimes is that programs sometimes assume 4K or 8K memory page size -- Apple Silicon systems use a 16K page size. This has become less common over time as projects updated for Apple Silicon compatibility, but unfortunately I ran into this issue when trying to run the nix-init command-line tool:

$ nix-unit --flake .#tests
warning: unknown setting 'allowed-users'
warning: unknown setting 'trusted-users'
warning: `--gc-roots-dir' not specified
warning: Git tree '/etc/nixos' is dirty
❌ lib.modules.testCollectTypedModules
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 128 bytes failed
☢️ lib.modules.testCollectTypedModules
error: program 'difft' failed due to signal 6 (Aborted)

❌ systems.aarch64-linux.system-agnostic.lib.modules.testCollectTypedModules
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 128 bytes failed
☢️ systems.aarch64-linux.system-agnostic.lib.modules.testCollectTypedModules
error: program 'difft' failed due to signal 6 (Aborted)

❌ systems.x86_64-linux.system-agnostic.lib.modules.testCollectTypedModules
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 128 bytes failed
☢️ systems.x86_64-linux.system-agnostic.lib.modules.testCollectTypedModules
error: program 'difft' failed due to signal 6 (Aborted)


😢 0/3 successful
error: Tests failed

Fortunately, this is probably an easy fix. I recall running into the issue early on with fd, and the solution was simply setting the environment variable export JEMALLOC_SYS_WITH_LG_PAGE=16 during builds. See sharkdp/fd#1085

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