How to fix a broken package?

Hi Gang

I’m trying to install dpdk on an aarch64 host (Raspberry PI) and it fails to compile. Looking in Hydra, it seems that this package has been failing to build. (Hydra - Latest builds for job nixos:release-21.11:nixpkgs.dpdk.aarch64-linux)

Being new to NixOS I’m a bit stuck as to how I can temporarily fix it (i.e. how to access the build logs / artefacts, manually fix and compile it, and install it to the store). I have tried to work it out from the nix manuals but I may need someone to dumb it down for me a bit. Does anyone have some pointers for me?

Cheers
-Wynand

1 Like

Hey Wynand, welcome the the community. Thanks for posting your problem and documenting your attempts! Learning how to solve it in the open will help everyone in the future.

While I have no experience building for ARM, here is the relevant error line from the logs to reduce friction. Maybe someone who knows immediately a possible root cause can comment on it.

config/arm/meson.build:407:16: ERROR: Problem encountered: Error when getting Arm Implementer ID and part number.

As a few first steps, you can build the package with --keep-failed to preserve intermediate artifacts.

nix-shell -p dpdk --keep-failed

On failure the output will give you the working path to inspect.

The basic idea how to iteratively fix a compilation can be found in the NixOS Wiki.

Personally I don’t recommend manually installing to the store (that already sounds hard and unmaintainable), but instead writing an overlay to fix the package and then ideally submit a pull request to nixpkgs with the relevant changes. Please check the nixpkgs manual and search for overlays to get an idea how it would look like in general.

Hi @fricklerhandwerk

Awesome, that gave me access to the logs. The build systems tries to detect the ARM architecture which is looking at a hard coded path in /sys/devices/system/cpu/cpu0/regs/identification/midr_el1 which is not available in the sandbox compile. To get it building right now, I’ve just added the path to the sandbox:

nix.sandboxPaths = [ "/sys/devices/system/cpu/" ];

This works if you are building and deploying on the same host, but if you are cross compiling it’s obviously not the best.

I agree that an overlay (from what I’ve read and have been told) is the better way. Right now I’m just racing to get get a dev environment setup before the end of the week. Once I work out how to implement an overlay I will do as you suggest.

Thanks for welcoming me and taking the time to respond, I really appreciated it.

1 Like

You’re welcome. You will find more details on cross compilation here: Cross compilation — nix.dev documentation

1 Like