Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to write in the store when building #8

Open
symphorien opened this issue Jan 31, 2021 · 9 comments
Open

attempt to write in the store when building #8

symphorien opened this issue Jan 31, 2021 · 9 comments
Assignees

Comments

@symphorien
Copy link

I'm trying to use dub2nix on CyberShadow/btdu@9bbab62

I'm invoking it with

let pkgs = import <nixpkgs> { }; in
let mkDub = (import ./mkDub.nix {
  inherit pkgs;
});
in
mkDub.mkDubDerivation {
  version = "0.1.0"; # optional
  src = ./.;
  package = {
    name = "btdu";
    description = "sampling disk usage profiler for btrfs";
    outPath = "foo";
  };
}

when building dub attempts to write to the store:

$  nix-build --show-trace
these derivations will be built:
  /nix/store/jxq676a3bgp8zb8iq2cslzw3qzrq312x-btdu-0.1.0.drv
building '/nix/store/jxq676a3bgp8zb8iq2cslzw3qzrq312x-btdu-0.1.0.drv'...
unpacking sources
unpacking source archive /nix/store/0lvppfcimz2p21f6146ncxfwj48waip2-source
source root is source
patching sources
configuring
no configure script, doing nothing
building
Registered package: ncurses (version: 0.0.149)
Registered package: ae (version: 0.0.2833)
Registered package: btrfs (version: 0.0.11)
Performing "release" build using dmd for x86_64.
/nix/store/a8rk8i1b2597ihlqxr6m7vy3plfc3d0d-ncurses/.dub: Permission denied
builder for '/nix/store/jxq676a3bgp8zb8iq2cslzw3qzrq312x-btdu-0.1.0.drv' failed with exit code 2
error: build of '/nix/store/jxq676a3bgp8zb8iq2cslzw3qzrq312x-btdu-0.1.0.drv' failed
@lionello lionello self-assigned this Jan 31, 2021
@lionello
Copy link
Owner

Thanks. I'll look into this.

@symphorien
Copy link
Author

still the case with current master of btdu and dub2nix (I had to run dub convert to obtain a dub.json)

@lionello
Copy link
Owner

@symphorien I started looking into this, but btdu doesn't build for me, making it hard to debug. Have you tried building with ldc?

ldc2 failed with exit code 1.
error: builder for '/nix/store/qnyhx2vid7dkfnq8syvp75y92h8qfli0-btdu.drv' failed with exit code 2;
       last 10 log lines:
       > building
       > Registered package: ncurses (version: 0.0.149)
       > Registered package: ae (version: 0.0.2833)
       > Registered package: btrfs (version: 0.0.11)
       > Performing "release" build using ldc2 for aarch64, arm_hardfloat.
       > btdu ~master: building configuration "application"...
       > source/btdu/browser.d(44,8): Error: module `time` is in file 'ae/utils/time.d' which cannot be read
       > import path[0] = source/
       > import path[1] = /nix/store/p30ic724rgi9gg0w61bab2hmivqdrh5g-ldc-1.27.1/include/d
       > ldc2 failed with exit code 1.
       For full logs, run 'nix log /nix/store/qnyhx2vid7dkfnq8syvp75y92h8qfli0-btdu.drv'.

@symphorien
Copy link
Author

symphorien commented Dec 13, 2021

It builds succesfully with dmd inside nix-shell -I nixpkgs=../nixpkgs -p dub dmd zlib ncurses where nixpkgs points to current nixos-unstable: b0bf5f888d377dd2f36d90340df6dc9f035aaada

I don't know how to test with ldc:

$ dub
Failed to invoke the compiler dmd to determine the build platform: /bin/sh: ligne 1: dmd : commande introuvable

if I replace dmd with ldc in the nix-shell command above.

@lionello
Copy link
Owner

lionello commented Dec 14, 2021

@symphorien Can you try nix-shell -I nixpkgs=../nixpkgs -p dub ldc zlib ncurses with dub --compiler=ldc? Looks like it doesn't build with ldc. I'm on an ARM machine, so got no dmd here. Think I found it.

@symphorien
Copy link
Author

I made a mistake and actually dub works with ldc without a flag. and I confirm that btdu compiles with ldc.

@lionello
Copy link
Owner

@symphorien Found it: current dub2nix does not attempt to build library projects and only supports projects that have targetType set to sourceLibrary. Two of the dependencies from btdu are staticLibrary projects. While attempting to add support for these, I'm running into several dub issues.

The more serious issue is that dub tries to iterate over all files in the Nix store, because ae has .. as one of its import paths: https://github.com/CyberShadow/ae/blob/master/dub.sdl#L13

@CyberShadow
Copy link

It might be worth pointing out that Dub itself has implemented a workaround for this exact issue when it stores copies of its packages (in ~/.dub/packages):

This fix was also (graciously) done to fix ae. :)

Hope this helps.

@nekowinston
Copy link

nekowinston commented Sep 23, 2023

I get this error when trying to build packages that have emsi_containers-0.9.0 as a dependency (e.g. dcd).

I think the root cause is the "targetPath": "build", in the dub.json there, and I'm unsure how I can patch a dependency:

dub-add-local = dubDep: "dub add-local ${(fromDub dubDep).src.outPath} ${rev-to-version dubDep.fetch.rev}";

An idea here would be to change the way the dub.selections.nix is structured, e.g. in a way where we have

{
  emsi_containers.fetch = {
      # ...
    }
}

so that we can pass in per-dependency overrides (mostly patches) in mkDubDerivation. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants