NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.33k stars 13.57k forks source link

cannot build inkscape on osx #15768

Closed mbucc closed 8 years ago

mbucc commented 8 years ago

Issue description

nix-env -i inkscape-0.91 failed on osx 10.9.5

Steps to reproduce

$ nix-env -i inkscape-0.91
...
In file included from context_surface_quartz.cc:21:
In file included from ../cairomm/quartz_surface.h:25:
/nix/store/v0l98kv189gk6c6d714rm0zc1gxgfhrm-cairo-1.14.6-dev/include/cairo/cairo-quartz.h:43:10: fatal error: 'ApplicationServices/ApplicationServices.h' file not found
#include <ApplicationServices/ApplicationServices.h>
         ^
1 error generated.
Makefile:561: recipe for target 'context_surface_quartz.lo' failed
make[2]: *** [context_surface_quartz.lo] Error 1
make[2]: Leaving directory '/private/var/folders/cy/4988f14n4r35fp39wrt1pfq80000gn/T/nix-build-cairomm-1.12.0.drv-0/cairomm-1.12.0/cairomm'
Makefile:622: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/private/var/folders/cy/4988f14n4r35fp39wrt1pfq80000gn/T/nix-build-cairomm-1.12.0.drv-0/cairomm-1.12.0'
Makefile:472: recipe for target 'all' failed
make: *** [all] Error 2
builder for ‘/nix/store/qc7v83m39siikalwwhip8z8s0yca6r2w-cairomm-1.12.0.drv’ failed with exit code 2
cannot build derivation ‘/nix/store/w23jjgbqa3f5nnik8m8322v5r575828y-gtkmm-2.24.4.drv’: 1 dependencies couldn't be built
building path(s) ‘/nix/store/gvcg3brsj9zxda6fjwnvdxzxjdaqjlrm-python-2.7.11-bootstrapped-pip-8.1.2’
killing process 71136
cannot build derivation ‘/nix/store/5zb2z0hgy71jvybbvadqx5rqcj4jbg17-inkscape-0.91.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/5zb2z0hgy71jvybbvadqx5rqcj4jbg17-inkscape-0.91.drv’ failed
$

Technical details

vcunat commented 8 years ago

That seems like cairo should propagate some of those dependencies. Perhaps this?

diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix
index f6f0a0d..978e6aa 100644
--- a/pkgs/development/libraries/cairo/default.nix
+++ b/pkgs/development/libraries/cairo/default.nix
@@ -25,17 +25,19 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     pkgconfig
     libiconv
-  ] ++ libintlOrEmpty ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
-    CoreGraphics
-    ApplicationServices
-    Carbon
-  ]);
+  ] ++ libintlOrEmpty;

   propagatedBuildInputs =
     with xorg; [ libXext fontconfig expat freetype pixman zlib libpng libXrender ]
     ++ optionals xcbSupport [ libxcb xcbutil ]
     ++ optional gobjectSupport glib
     ++ optional glSupport mesa_noglu
+    ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+        CoreGraphics
+        ApplicationServices
+        Carbon
+      ])
+
     ; # TODO: maybe liblzo but what would it be for here?

   configureFlags = if stdenv.isDarwin then [
mbucc commented 8 years ago

How do I test this patch?

Patch /nix/store/phqb57liyaqm9jxlawk47y3d97whq2bv-nixpkgs-16.09pre83147.df89584/nixpkgs/pkgs/development/libraries/cairo/default.nix and then retry install?

Or Fork and modify NixPkgs per https://nixos.org/wiki/Nix_Modifying_Packages?

vcunat commented 8 years ago

You can't/shouldn't modify /nix/store/**. You can copy that or use git to get a nixpkgs tree, and then apply the patch. Some steps from http://nixos.org/nixpkgs/manual/#chap-quick-start might be useful if you don't know about them. (It's better to use the manuals than the wiki.)

matthewbauer commented 8 years ago

I can confirm this gets inkscape farther with this patch and it looks like a good change. Still issues building inkscape though.

mbucc commented 8 years ago

Progress, but libman.la won't link.

  CCLD     libman.la
Undefined symbols for architecture x86_64:
  "_program_name", referenced from:
      _error in libgnu.a(error.o)
      _error_at_line in libgnu.a(error.o)
ld: symbol(s) not found for architecture x86_64
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:1526: recipe for target 'libman.la' failed
make[2]: *** [libman.la] Error 1
make[2]: Leaving directory '/private/var/folders/cy/4988f14n4r35fp39wrt1pfq80000gn/T/nix-build-man-db-2.7.5.drv-0/man-db-2.7.5/lib'
Makefile:1521: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/private/var/folders/cy/4988f14n4r35fp39wrt1pfq80000gn/T/nix-build-man-db-2.7.5.drv-0/man-db-2.7.5'
Makefile:1449: recipe for target 'all' failed
make: *** [all] Error 2
builder for ‘/nix/store/i5xrpqpvc71w5cj1nazi20clv78wv5qr-man-db-2.7.5.drv’ failed with exit code 2
building path(s) ‘/nix/store/8mk7wpiis4y9dicxdcgd0dcl1iihj7ma-openexr-2.2.0’, ‘/nix/store/plnhv7n1qv10qc49nyn3j5kf6caxhp05-openexr-2.2.0-doc’
cannot build derivation ‘/nix/store/4zf5amwgg7ajplicbihmsr89s99hblip-w3m-0.5.3-2015-12-20.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/bipny8ii8i8yd8qap5013nzj406mf579-xmlto-0.0.26.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/9q0922rh6w2l8s86af5przsy9mpwd2w3-giflib-5.1.0.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/5krnvl1ksrn17ccv6vq0kzg8ma657dz3-libwebp-0.4.3.drv’: 1 dependencies couldn't be built
killing process 82305
cannot build derivation ‘/nix/store/7yaih8szq9j7ylm3ngj6nc4dbdhsfksf-imagemagick-6.9.3-9.drv’: 1 dependencies couldn't be built
building path(s) ‘/nix/store/lqr1gpmr31gq52nrd0f89f7d8h3aciwz-openjpeg-2.1.0-dev’, ‘/nix/store/xkqqp8sp3s8pa5xm291jka6sjb0bda5h-openjpeg-2.1.0’
killing process 82307
cannot build derivation ‘/nix/store/4gffvfamx95rdb1cn001rx4ry75ksplr-inkscape-0.91.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/4gffvfamx95rdb1cn001rx4ry75ksplr-inkscape-0.91.drv’ failed
domenkozar commented 8 years ago

Looking at Hydra man-db never compiled on darwin: http://hydra.nixos.org/job/nixpkgs/trunk/man-db.x86_64-darwin/all

cc @copumpkin (this is blocking channel update)

vcunat commented 8 years ago

We could switch back to man-old as the default on Darwin. BTW, the build-time dependency chain here is rather bloated...

vcunat commented 8 years ago

And it used to build before an update not too long ago: http://hydra.nixos.org/build/21587832

matthewbauer commented 8 years ago

Does anyone know why this is here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/browsers/w3m/default.nix#L31 ?

I can't figure out what's using it.

vcunat commented 8 years ago

The comment documents the intention, I assume.

matthewbauer commented 8 years ago

But, is it actually still used? I can take out that line without having any issues, I think.

vcunat commented 8 years ago

I've got no idea about that. It's common that such settings persist longer than needed. We can drop it, if you're confident it's not needed.

copumpkin commented 8 years ago

@mbucc see #15849

mbucc commented 8 years ago

@copumpkin so this is fixed? (I am new to nix and still learning.)

I tried:

$ nix-channel --update
...
$ nix-env -u
...
$ nix-env -i inkscape
...

and still get the same error.

vcunat commented 8 years ago

@mbucc: the channels lag behind master.

matthewbauer commented 8 years ago

Even with the latest patches there's some unrelated Inkscape build issue.

michaelmesser commented 8 years ago
$ nix-env -i --show-trace inkscape
installing ‘inkscape-0.91’
error: while evaluating the attribute ‘nativeBuildInputs’ of the derivation ‘inkscape-0.91’ at /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/pkgs/applications/graphics/inkscape/default.nix:20:3:
while evaluating the attribute ‘propagatedNativeBuildInputs’ of the derivation ‘gtkmm-2.24.4’ at /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/pkgs/development/libraries/gtkmm/2.x.nix:4:3:
while evaluating ‘callPackageWith’ at /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/lib/customisation.nix:93:35, called from /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/pkgs/top-level/all-packages.nix:7570:13:
while evaluating ‘makeOverridable’ at /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/lib/customisation.nix:54:24, called from /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/lib/customisation.nix:97:8:
while evaluating anonymous function at /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/pkgs/development/libraries/cairomm/default.nix:1:1, called from /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/lib/customisation.nix:56:12:
while evaluating ‘mkDerivation’ at /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/pkgs/stdenv/generic/default.nix:95:5, called from /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/pkgs/development/libraries/cairomm/default.nix:6:1:
while evaluating ‘throwEvalHelp’ at /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/pkgs/stdenv/generic/default.nix:120:23, called from /nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/pkgs/stdenv/generic/default.nix:169:21:
Package ‘cairomm-1.12.0’ in ‘/nix/store/qkzk4iy15jhms2w2ln9gqiff0bgafbmv-nixpkgs-16.09pre88706.b8e215f/nixpkgs/pkgs/development/libraries/cairomm/default.nix:21’ is not supported on ‘x86_64-darwin’, refusing to evaluate.
a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build` or any other Nix command you can add
  { allowBroken = true; }
to ~/.nixpkgs/config.nix.

OS X El Capitan

mbucc commented 8 years ago

Same on Mavericks.

vcunat commented 8 years ago

@2426021684: inkscape doesn't build so it's better to fail during evaluation time already with a hint of being broken.

copumpkin commented 8 years ago

@2426021684 @mbucc to be clear, the message you're both reporting is saying "hey, the package you requested is known not to work on your platform, so we're not going to bother trying to build it. If you'd like to try anyway, follow the instructions".

So basically, we left it as "this is known to be broken and an enterprising user who needs it can submit a fix if they know how to fix it".