NixOS / nix-pills

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After Pill Nr. 12.5 Completing graphviz with gd - still failing with: 'Format: "png" not recognized use one of canon [...]'

ThoenigAdrian opened this issue · comments

[jane@nixos:~/graphviz]$ nix-build graphviz.nix 
/nix/store/sz5apb4n1sgc6drm819hzwjn0wwqkkzd-graphviz

[jane@nixos:~/graphviz]$ echo 'graph test { a --b }' | ./result/bin/dot -Tpng -o test.png

Format: "png" not recognized. Use one of: canon cmap cmapx cmapx_np dot eps fig gv imap imap_np ismap pic plain plain-ext pov ps ps2 svg tk vml xdot xdot1.2 xdot1.4

If i open a nix-shell this is the output i get:

[jane@nixos:~/graphviz]$ nix-shell graphviz.nix 

[nix-shell:~/graphviz]$ echo $buildInputs
/nix/store/f6y1dzdl0n5rziyrf5859kvgzn2p8ryl-gd-2.2.5-bin /nix/store/7kgppvnhlh66avxl3q4h51qvl0v1970y-fontconfig-2.12.6-bin /nix/store/y0ppnpv6f3cranc4cj4v3hhsy6dj9lfk-libjpeg-turbo-2.0.3-bin /nix/store/iws7dm1jij4lv09mbpwf9i8lc1d4b798-bzip2-1.0.6.0.1-bin

[nix-shell:~/graphviz]$ echo $NIX_LDFLAGS


[nix-shell:~/graphviz]$ source setup.sh 

[nix-shell:~/graphviz]$ echo $NIX_LDFLAGS
-rpath /nix/store/84yafwjc6sga23vwsbahhymikjhfbnw4-gawk-5.0.1/lib -L /nix/store/84yafwjc6sga23vwsbahhymikjhfbnw4-gawk-5.0.1/lib -rpath /nix/store/ajrrkivdfvp8dp4vdg5hp1h5hblmanc9-binutils-2.31.1/lib -L /nix/store/ajrrkivdfvp8dp4vdg5hp1h5hblmanc9-binutils-2.31.1/lib

[nix-shell:~/graphviz]$ echo $NIX_CFLAGS_COMPILE
-I /nix/store/84yafwjc6sga23vwsbahhymikjhfbnw4-gawk-5.0.1/include -I /nix/store/ajrrkivdfvp8dp4vdg5hp1h5hblmanc9-binutils-2.31.1/include -I /nix/store/j8fq1ksp37w88rx80blzazldi17f3x7s-gnumake-4.2.1/include

It seems fine though I would've expected some paths refering to gd in NIX_LDFLAGS .

Debug output (Feel free to skip if you already know the issue)

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

[nix-shell:~/graphviz]$ cat 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 ];
}

[nix-shell:~/graphviz]$ cat builder.sh 
set -e
source $setup
genericBuild

[nix-shell:~/graphviz]$ ls
autotools.nix  builder.sh  graphviz-2.38.0.tar.gz  graphviz.nix  result  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
}

Does anyone what's the issue here ? I suspect it might be a problem on my end but i can't find it.

Oh just saw there is already an issue for that: #107