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

Nix Pill 12 does not build (atexit) #171

Open
kirinnee opened this issue Jun 13, 2021 · 2 comments
Open

Nix Pill 12 does not build (atexit) #171

kirinnee opened this issue Jun 13, 2021 · 2 comments

Comments

@kirinnee
Copy link

Nix Pill 12 does not build

Stdout/stderr

  CC       parse.lo
  CC       queue.lo
  CCLD     libgvpr.la
/nix/store/7m6p435s1c9ysfs266n9ppfw9zkii697-binutils-2.35.1/bin/ld: ../../lib/expr/.libs/libexpr_C.a(sfexit.o): in function `atexit':
/tmp/nix-build-graphviz.drv-0/graphviz-2.38.0/lib/sfio/sfexit.c:54: multiple definition of `atexit'; ../../lib/expr/.libs/libexpr_C.a(vmexit.o):/tmp/nix-build-graphviz.drv-0/graphviz-2.38.0/lib/vmalloc/vmexit.c:50: first defined here
/nix/store/7m6p435s1c9ysfs266n9ppfw9zkii697-binutils-2.35.1/bin/ld: ../../lib/expr/.libs/libexpr_C.a(sfexit.o): in function `exit':
/tmp/nix-build-graphviz.drv-0/graphviz-2.38.0/lib/sfio/sfexit.c:98: multiple definition of `exit'; ../../lib/expr/.libs/libexpr_C.a(vmexit.o):/tmp/nix-build-graphviz.drv-0/graphviz-2.38.0/lib/vmalloc/vmexit.c:67: first defined here
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:656: libgvpr.la] Error 1
make[3]: Leaving directory '/tmp/nix-build-graphviz.drv-0/graphviz-2.38.0/lib/gvpr'
make[2]: *** [Makefile:536: all-recursive] Error 1
make[2]: Leaving directory '/tmp/nix-build-graphviz.drv-0/graphviz-2.38.0/lib'
make[1]: *** [Makefile:774: all-recursive] Error 1
make[1]: Leaving directory '/tmp/nix-build-graphviz.drv-0/graphviz-2.38.0'
make: *** [Makefile:583: all] Error 2
builder for '/nix/store/zsvx1fiwa97b22ai2srha1v61nvw76qk-graphviz.drv' failed with exit code 2
error: build of '/nix/store/zsvx1fiwa97b22ai2srha1v61nvw76qk-graphviz.drv' failed

Operating System: alpine (within docker image nixos/nix )
uname -a: Linux e8b6ac5b0786 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 Linux
Nix Version: nix (Nix) 2.3.11

# autotools.nix
pkgs: attrs:
  with pkgs;
  let defaultAttrs = {
    builder = "${bash}/bin/bash";
    args = [ ./builder.sh ];
    setup = ./setup.sh;
    baseInputs = [ gnutar gzip gnumake gcc binutils-unwrapped coreutils gawk gnused gnugrep patchelf findutils ];
    buildInputs = [];
    system = builtins.currentSystem;
  };
  in
derivation (defaultAttrs // attrs)
# graphviz.nix

let
  pkgs = import <nixpkgs> {};
  mkDerivation = import ./autotools.nix pkgs;
  in mkDerivation {
    name = "graphviz";
    src = ./graphviz-2.38.0.tar.gz;
    buildInputs = with pkgs; [ gd fontconfig libjpeg bzip2 ];
  }
# builder.sh
set -e
source $setup
genericBuild
# setup.sh
unset PATH
for p in $baseInputs $buildInputs; do
  if [ -d $p/bin ]; then
    export PATH=$p/bin${PATH:+:}$PATH
  fi
  if [ -d $p/include ]; then
    export NIX_CFLAGS_COMPILE="-I $p/include${NIX_CFLAGS_COMPILE:+ }$NIX_CFLAGS_COMPILE"
  fi
  if [ -d $p/lib ]; then
    export NIX_LDFLAGS="-rpath $p/lib -L $p/lib${NIX_LDFLAGS:+ }$NIX_LDFLAGS"
  fi
done

function unpackPhase() {
  tar -xzf $src

  for d in *; do
    if [ -d "$d" ]; then
      cd "$d"
      break
    fi
  done
}

function configurePhase() {
  ./configure --prefix=$out
}

function buildPhase() {
  make
}

function installPhase() {
  make install
}

function fixupPhase() {
  find $out -type f -exec patchelf --shrink-rpath '{}' \; -exec strip '{}' \; 2>/dev/null
}

function genericBuild() {
  unpackPhase
  configurePhase
  buildPhase
  installPhase
  fixupPhase
}

Steps to replicate

  1. run docker image (WIN 10 WSL2-enabled docker)
docker run -id nixos/nix
  1. Exec into docker image
docker exec -ti <container name> ash
  1. copy 4 files about into the container

  2. run nix-build ./graphviz.nix

@crinklywrappr
Copy link

I got a similar issue in this chapter as well. It looks resolvable by guessing the right hash to pin.

Community support record here: https://discourse.nixos.org/t/questions-about-nix-pills-pt-2/16294/2

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/questions-about-nix-pills-pt-2/16294/4

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

3 participants