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

Pill 12: graphviz 2.38.0 does not build #40

Open
willprice opened this issue Dec 28, 2017 · 5 comments
Open

Pill 12: graphviz 2.38.0 does not build #40

willprice opened this issue Dec 28, 2017 · 5 comments

Comments

@willprice
Copy link

Here's the error I get:

$ nix-build graphviz.nix

...

make[4]: Leaving directory '/run/user/1000/nix-build-graphviz.drv-0/graphviz-2.38.0/lib/sfio'
make[3]: Leaving directory '/run/user/1000/nix-build-graphviz.drv-0/graphviz-2.38.0/lib/sfio'
Making all in vmalloc
make[3]: Entering directory '/run/user/1000/nix-build-graphviz.drv-0/graphviz-2.38.0/lib/vmalloc'
mkdir -p ../../FEATURE
../../iffe - set cc gcc   : run ../../lib/vmalloc/features/vmalloc > ../../FEATURE/vmalloc
  CC       malloc.lo
malloc.c:404:15: error: return type is an incomplete type
 struct mstats mstats(void)
               ^~~~~~
malloc.c: In function 'mstats':
malloc.c:410:19: error: storage size of 'ms' isn't known
     struct mstats ms;
                   ^~
malloc.c:421:12: warning: 'return' with a value, in function returning void
     return ms;
            ^~
malloc.c:404:15: note: declared here
 struct mstats mstats(void)
               ^~~~~~
malloc.c:410:19: warning: unused variable 'ms' [-Wunused-variable]
     struct mstats ms;
                   ^~
make[3]: *** [Makefile:581: malloc.lo] Error 1
make[3]: Leaving directory '/run/user/1000/nix-build-graphviz.drv-0/graphviz-2.38.0/lib/vmalloc'
make[2]: *** [Makefile:536: all-recursive] Error 1
make[2]: Leaving directory '/run/user/1000/nix-build-graphviz.drv-0/graphviz-2.38.0/lib'
make[1]: *** [Makefile:774: all-recursive] Error 1
make[1]: Leaving directory '/run/user/1000/nix-build-graphviz.drv-0/graphviz-2.38.0'
make: *** [Makefile:583: all] Error 2
builder for ‘/nix/store/b40npfiysihsgz8cmrqwdpnddfg93g5v-graphviz.drv’ failed with exit code 2
error: build of ‘/nix/store/b40npfiysihsgz8cmrqwdpnddfg93g5v-graphviz.drv’ failed

A similar issue has come up at spack/spack#6274 although its not clear there was a resolution.

# graphviz.nix
let
  pkgs = import <nixpkgs> {};
  mkDerivation = import ./autotools.nix pkgs;
in mkDerivation {
  name = "graphviz";
  src = ./graphviz-2.38.0.tar.gz;
}
# builder.sh
set -e
unset PATH
for p in $baseInputs $buildInputs; do
    export PATH="$p/bin${PATH:+:}$PATH"
done

tar xf "$src"

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


./configure --prefix="$out"
make
make install

find "$out" \
    -type f \
    -exec patchelf --shrink-rpath '{}' \; \
    -exec strip '{}' \; \
    2>/dev/null
# autotools.nix
pkgs: attrs:
  with pkgs;
  let
    defaultAttrs = {
      builder = "${bash}/bin/bash";
      args = [ ./builder.sh ];
      baseInputs = [
        gnutar gzip gnumake gcc binutils-unwrapped binutils
        coreutils gawk gnused gnugrep findutils patchelf
      ];
      buildInputs = [];
      system = builtins.currentSystem;
    };
  in
    derivation (defaultAttrs // attrs)
willprice added a commit to willprice/nix-pills that referenced this issue Dec 28, 2017
@typetetris
Copy link

I erased the line lib mstats from lib/vmalloc/features/vmalloc and the lines lib qfrexp and lib qldexp from the file lib/sfio/features/sfio in the graphviz source tree and now I am stuck with a linker error:

make[5]: Entering directory '/tmp/nix-build-graphviz.drv-0/graphviz-2.40.1/cmd/dot'
(cd /nix/store/q1j5wy9lylqs7ny17aknw41iiin1s98w-graphviz/bin; if test -x dot; then for i in neato twopi fdp circo osage patchwork sfdp; do rm -f $i; ln -s dot $i; done; fi;)
if test "x" = "x"; then if test -x /nix/store/q1j5wy9lylqs7ny17aknw41iiin1s98w-graphviz/bin/dot; then if test -x /sbin/ldconfig; then /sbin/ldconfig 2>/dev/null; fi; /nix/store/q1j5wy9lylqs7ny17aknw41iiin1s98w-graphviz/bin/dot -c; else /nix/store/q1j5wy9lylqs7ny17aknw41iiin1s98w-graphviz/bin/dot_static -c; fi; fi
/nix/store/q1j5wy9lylqs7ny17aknw41iiin1s98w-graphviz/bin/dot: error while loading shared libraries: libexpat.so.1: cannot open shared object file: No such file or directory
make[5]: *** [Makefile:1200: install-exec-hook] Error 127
make[5]: Leaving directory '/tmp/nix-build-graphviz.drv-0/graphviz-2.40.1/cmd/dot'
make[4]: *** [Makefile:1128: install-exec-am] Error 2
make[4]: Leaving directory '/tmp/nix-build-graphviz.drv-0/graphviz-2.40.1/cmd/dot'
make[3]: *** [Makefile:1072: install-am] Error 2
make[3]: Leaving directory '/tmp/nix-build-graphviz.drv-0/graphviz-2.40.1/cmd/dot'
make[2]: *** [Makefile:575: install-recursive] Error 1
make[2]: Leaving directory '/tmp/nix-build-graphviz.drv-0/graphviz-2.40.1/cmd'
make[1]: *** [Makefile:822: install-recursive] Error 1
make[1]: Leaving directory '/tmp/nix-build-graphviz.drv-0/graphviz-2.40.1'
make: *** [Makefile:1115: install] Error 2
builder for ‘/nix/store/krsna8baxybb1q7pwdi83sqgzs0ab258-graphviz.drv’ failed with exit code 2
error: build of ‘/nix/store/krsna8baxybb1q7pwdi83sqgzs0ab258-graphviz.drv’ failed

Adding pkgs.expat to buildInputs in graphviz.nix with the modified setup.sh (containung the include dirs and lib dirs stuff) didn't help, the error stays the same.

So it uses expat but configure doesn't test for it or looked in a hardcoded path which was available on my nix on Arch machine.

@typetetris
Copy link

I still have lots of these in my build output

cc1: warning: /nix/store/175a2fgxir82dbdrn3a7xr7aji3136p9-graphviz/include: No such file or directory [-Wmissing-include-dirs]

don't know, why some package would expect an include dir in its output path?

@typetetris
Copy link

Here is my diff for graphviz-2.38.0.tar.gz that made the builder succeed:

diff --git a/cmd/dot/Makefile.in b/cmd/dot/Makefile.in
index 0c508e9..7656908 100644
--- a/cmd/dot/Makefile.in
+++ b/cmd/dot/Makefile.in
@@ -1177,7 +1177,6 @@ install-data-hook:
 # run "dot -c", if possible, to create plugin config
 install-exec-hook:
 	(cd $(DESTDIR)$(bindir); if test -x dot$(EXEEXT); then for i in $(linkedprogram); do rm -f $$i; $(LN_S) dot$(EXEEXT) $$i; done; fi;)
-	if test "x$(DESTDIR)" = "x"; then if test -x $(bindir)/dot$(EXEEXT); then if test -x /sbin/ldconfig; then /sbin/ldconfig 2>/dev/null; fi; $(bindir)/dot$(EXEEXT) -c; else $(bindir)/dot_static$(EXEEXT) -c; fi; fi
 
 uninstall-hook:
 	(cd $(DESTDIR)$(man1dir); for i in $(linkedman); do rm -f $$i; done;)
diff --git a/lib/sfio/features/sfio b/lib/sfio/features/sfio
index 0f672b1..7564e30 100644
--- a/lib/sfio/features/sfio
+++ b/lib/sfio/features/sfio
@@ -11,8 +11,6 @@ sys time
 
 hdr string
 hdr math
-lib qfrexp
-lib qldexp
 
 hdr unistd
 hdr values
diff --git a/lib/vmalloc/features/vmalloc b/lib/vmalloc/features/vmalloc
index 6300ca6..3013fbf 100644
--- a/lib/vmalloc/features/vmalloc
+++ b/lib/vmalloc/features/vmalloc
@@ -15,7 +15,6 @@ typ ssize_t
 hdr malloc
 lib mallopt
 lib mallinfo
-lib mstats
 hdr alloca
 hdr dlfcn
 

but now I am stuck with a dependency outside of /nix:

$ ldd result/bin/dot
	linux-vdso.so.1 (0x00007ffec9de5000)
	libgvc.so.6 => /nix/store/kd8qrvws3fi8mb1k7090gd63ax84v6qn-graphviz/lib/libgvc.so.6 (0x00007f8ce3f2b000)
	libdl.so.2 => /nix/store/1zv5dwifxg5fh08gif8ld3h9f40y8czh-glibc-2.26-115/lib/libdl.so.2 (0x00007f8ce3d27000)
	libxdot.so.4 => /nix/store/kd8qrvws3fi8mb1k7090gd63ax84v6qn-graphviz/lib/libxdot.so.4 (0x00007f8ce3b21000)
	libcgraph.so.6 => /nix/store/kd8qrvws3fi8mb1k7090gd63ax84v6qn-graphviz/lib/libcgraph.so.6 (0x00007f8ce390a000)
	libpathplan.so.4 => /nix/store/kd8qrvws3fi8mb1k7090gd63ax84v6qn-graphviz/lib/libpathplan.so.4 (0x00007f8ce3701000)
	libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f8ce34cf000)
	libm.so.6 => /nix/store/1zv5dwifxg5fh08gif8ld3h9f40y8czh-glibc-2.26-115/lib/libm.so.6 (0x00007f8ce3183000)
	libcdt.so.5 => /nix/store/kd8qrvws3fi8mb1k7090gd63ax84v6qn-graphviz/lib/libcdt.so.5 (0x00007f8ce2f7c000)
	libc.so.6 => /nix/store/1zv5dwifxg5fh08gif8ld3h9f40y8czh-glibc-2.26-115/lib/libc.so.6 (0x00007f8ce2bca000)
	/nix/store/1zv5dwifxg5fh08gif8ld3h9f40y8czh-glibc-2.26-115/lib/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f8ce41cc000)

@typetetris
Copy link

Even adding expat to buildInputs doesn't change that.

ivanbrennan added a commit to ivanbrennan/nix-pills that referenced this issue Jan 29, 2018
This one fails to build.
See NixOS/nix-pills#40
ivanbrennan added a commit to ivanbrennan/nix-pills that referenced this issue Jan 29, 2018
This one fails to build, as there's no config file provided in the
source code (autogen.sh generates the config file).
See NixOS/nix-pills#40
sanjay-boddu pushed a commit to Ensembl/homebrew-web that referenced this issue Aug 7, 2018
sanjay-boddu added a commit to Ensembl/homebrew-web that referenced this issue Aug 7, 2018
sjackman added a commit to sjackman/linuxbrew-core that referenced this issue Oct 31, 2018
LinuxbrewTestBot pushed a commit to LinuxbrewTestBot/homebrew-core that referenced this issue Oct 31, 2018
@jheidbrink
Copy link

@typetetris Do you have sanboxed builds enabled? What does nix show-config | grep sandbox say? If you built graphviz without sandbox, I guess it detected the expat library from your OS, and configured graphviz to use it. I do not know why Nix left the library path of the expat library unmodified in the remaining ELF though.

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