{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/22810","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/22810/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/22810/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/22810/events","html_url":"https://github.com/NixOS/nixpkgs/issues/22810","id":207670723,"number":22810,"title":"macOS Sierra and Haskell \"malformed mach-o: load commands size\"","user":{"login":"Dridus","id":67568,"avatar_url":"https://avatars1.githubusercontent.com/u/67568?v=3","gravatar_id":"","url":"https://api.github.com/users/Dridus","html_url":"https://github.com/Dridus","followers_url":"https://api.github.com/users/Dridus/followers","following_url":"https://api.github.com/users/Dridus/following{/other_user}","gists_url":"https://api.github.com/users/Dridus/gists{/gist_id}","starred_url":"https://api.github.com/users/Dridus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dridus/subscriptions","organizations_url":"https://api.github.com/users/Dridus/orgs","repos_url":"https://api.github.com/users/Dridus/repos","events_url":"https://api.github.com/users/Dridus/events{/privacy}","received_events_url":"https://api.github.com/users/Dridus/received_events","type":"User","site_admin":false},"labels":[{"id":6314750,"url":"https://api.github.com/repos/NixOS/nixpkgs/labels/0.kind:%20bug","name":"0.kind: bug","color":"84b6eb","default":false},{"id":90308187,"url":"https://api.github.com/repos/NixOS/nixpkgs/labels/6.topic:%20darwin","name":"6.topic: darwin","color":"fef2c0","default":false},{"id":99513706,"url":"https://api.github.com/repos/NixOS/nixpkgs/labels/6.topic:%20haskell","name":"6.topic: haskell","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":{"login":"cstrahan","id":143982,"avatar_url":"https://avatars3.githubusercontent.com/u/143982?v=3","gravatar_id":"","url":"https://api.github.com/users/cstrahan","html_url":"https://github.com/cstrahan","followers_url":"https://api.github.com/users/cstrahan/followers","following_url":"https://api.github.com/users/cstrahan/following{/other_user}","gists_url":"https://api.github.com/users/cstrahan/gists{/gist_id}","starred_url":"https://api.github.com/users/cstrahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cstrahan/subscriptions","organizations_url":"https://api.github.com/users/cstrahan/orgs","repos_url":"https://api.github.com/users/cstrahan/repos","events_url":"https://api.github.com/users/cstrahan/events{/privacy}","received_events_url":"https://api.github.com/users/cstrahan/received_events","type":"User","site_admin":false},"assignees":[{"login":"cstrahan","id":143982,"avatar_url":"https://avatars3.githubusercontent.com/u/143982?v=3","gravatar_id":"","url":"https://api.github.com/users/cstrahan","html_url":"https://github.com/cstrahan","followers_url":"https://api.github.com/users/cstrahan/followers","following_url":"https://api.github.com/users/cstrahan/following{/other_user}","gists_url":"https://api.github.com/users/cstrahan/gists{/gist_id}","starred_url":"https://api.github.com/users/cstrahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cstrahan/subscriptions","organizations_url":"https://api.github.com/users/cstrahan/orgs","repos_url":"https://api.github.com/users/cstrahan/repos","events_url":"https://api.github.com/users/cstrahan/events{/privacy}","received_events_url":"https://api.github.com/users/cstrahan/received_events","type":"User","site_admin":false}],"milestone":null,"comments":18,"created_at":"2017-02-14T23:48:15Z","updated_at":"2017-07-12T15:22:12Z","closed_at":null,"body":"## Issue description\r\n\r\nThe (at this point infamous) load commands size problem still occurs on nixpkgs even after the GHC 8.0.2 / LTS 8.0 update.\r\n\r\nI'll try to summarize the underlying issue, but please be aware I'm not an expert and am just stitching together things from other issues. Please correct me if the details are wrong.\r\n\r\nThis issue is due to a change in macOS's linker in Sierra which limits the mach-O linker load commands to 32768 bytes. Those load commands are dominated by RPATH entries and nix exacerbates the issue greatly by having a ton of long named directories, around one per dependency.\r\n\r\nIn GHC (https://ghc.haskell.org/trac/ghc/ticket/12479), Stack (https://github.com/commercialhaskell/stack/issues/2577), and Cabal (https://github.com/haskell/cabal/pull/3955, https://github.com/haskell/cabal/pull/3982, et al) it looks like it was resolved by carefully managing the location of dylibs to all be located in the same place so that only one RPATH needed emitting (https://ghc.haskell.org/trac/ghc/ticket/12479#comment:42, probably others).\r\n\r\nI could imagine a similar solution could be cooked up by generic-builder and with-package-wrapper to create a lib directory for each haskell derivation to build that has symlinks for each transient dependency, but I'm really quite new to all this so I haven't attempted it yet.\r\n\r\n### Steps to reproduce\r\n\r\n`nix-build stack-a5b8d468.nix` with `stack-a5b8d468.nix`:\r\n\r\n```nix\r\nlet\r\n  bootstrap = import <nixpkgs> {};\r\n  pkgsSrc = bootstrap.fetchFromGitHub {\r\n    owner = \"NixOS\";\r\n    repo = \"nixpkgs\";\r\n    rev = \"a5b8d468a504e0eedcda71de1694201806fb921d\";\r\n    sha256 = \"0alh9v12nyxsdlssg72k892zdzzc15wr8fqy8qpq9rc282bpx7xm\";\r\n  };\r\n  pkgs = import pkgsSrc {};\r\nin\r\n  pkgs.stack\r\n```\r\n\r\nOn my system yields:\r\n```\r\n…\r\n[ 10 of 121] Compiling System.Process.Read ( src/System/Process/Read.hs, dist/build/System/Process/Read.o )\r\n\r\n<no location info>: error:\r\n    ghc: panic! (the 'impossible' happened)\r\n  (GHC version 8.0.2 for x86_64-apple-darwin):\r\n\tLoading temp shared object failed: dlopen(/private/var/folders/4b/7smbp2kj7m770r24jxxfwr700000gn/T/nix-build-stack-1.3.2.drv-0/ghc46406_0/libghc_135.dylib, 5): no suitable image found.  Did find:\r\n\t/private/var/folders/4b/7smbp2kj7m770r24jxxfwr700000gn/T/nix-build-stack-1.3.2.drv-0/ghc46406_0/libghc_135.dylib: malformed mach-o: load commands size (41792) > 32768\r\n\r\nPlease report this as a GHC bug:  http://www.haskell.org/ghc/reportabug\r\n…\r\n```\r\n[stack-a5b8d468.txt](https://github.com/NixOS/nixpkgs/files/777431/stack-a5b8d468.txt)\r\n\r\n## Technical details\r\n\r\n* System: macOS Sierra 10.12.3\r\n* Nix version: nix-env (Nix) 1.11.4\r\n* Nixpkgs version: a5b8d468a504e0eedcda71de1694201806fb921d\r\n"},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/314803875","html_url":"https://github.com/NixOS/nixpkgs/issues/22810#issuecomment-314803875","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/22810","id":314803875,"user":{"login":"shlevy","id":487050,"avatar_url":"https://avatars0.githubusercontent.com/u/487050?v=3","gravatar_id":"","url":"https://api.github.com/users/shlevy","html_url":"https://github.com/shlevy","followers_url":"https://api.github.com/users/shlevy/followers","following_url":"https://api.github.com/users/shlevy/following{/other_user}","gists_url":"https://api.github.com/users/shlevy/gists{/gist_id}","starred_url":"https://api.github.com/users/shlevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shlevy/subscriptions","organizations_url":"https://api.github.com/users/shlevy/orgs","repos_url":"https://api.github.com/users/shlevy/repos","events_url":"https://api.github.com/users/shlevy/events{/privacy}","received_events_url":"https://api.github.com/users/shlevy/received_events","type":"User","site_admin":false},"created_at":"2017-07-12T15:22:12Z","updated_at":"2017-07-12T15:22:12Z","body":"@copumpkin I'm looking into possible solutions this week, reexport is not a bad idea sadly"}}
{"actor":{"display_login":"shlevy"}}