Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,407
    • Issues 5,407
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 600
    • Merge requests 600
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14444
Closed
Open
Issue created Nov 09, 2017 by dredozubov@trac-dredozubov

Linker limit on OS X Sierra breaks builds for big projects

I'm opening a fresh ticket as @bgamari suggested in #12479 (closed). There are few more related closed tickets as well: #12198 (closed) and #12588 (closed). The issue occurs on projects with a lot of dependencies. There are reports of that happening across various projects:

https://github.com/NixOS/nixpkgs/issues/22810 https://github.com/commercialhaskell/stack/issues/2577

I'm still able to reproduce it with 8.2.1 and git HEAD with a work project:

    ghc: panic! (the 'impossible' happened)
      (GHC version 8.2.1 for x86_64-apple-darwin):
    	Loading temp shared object failed: dlopen(/var/folders/f8/2_rc4tgd1gj9vbgv7q9gbk4c0000gn/T/ghc94377_0/libghc_325.dylib, 5): no suitable image found.  Did find:
    	/var/folders/f8/2_rc4tgd1gj9vbgv7q9gbk4c0000gn/T/ghc94377_0/libghc_325.dylib: malformed mach-o: load commands size (34592) > 32768

    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

I can't share the sources, but this is a command(generated by stack) that results in this error:

/Users/dr/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.0.0.2_ghc-8.2.1 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.0.0.2 build lib:projectname exe:projectname --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"

We're having a chat about this issue with @bgamari and I'll post some of his input:

 bgamari: dredozubov, unfortunately this is pretty much a limitation of OS X's linker
 bgamari: there's no great solution other than petitioning Apple to lift their arbitrary size limit
 bgamari: I've been asking people to open tickets with Apple
 bgamari: As they are really the only ones that can really fix this issue
 dredozubov: bgamari, do you know if someone did this already?
 bgamari: dredozubov, No one has said they have
 dredozubov: the other issue with it, I don't how to do a repro case
 dredozubov: I can reproduce it on a project with a closed sources and that's it
 bgamari: essentially you just need to build a project with enough dependencies
 bgamari: the problem is that Apple's linker sets an artificial cap on the number of shared libraries that an object file can load
Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Linking)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking