Skip to content

Add single directory in store for .dylib:s - #4426

Closed
bugthunk wants to merge 1 commit into
haskell:masterfrom
bugthunk:bugthunk-fix-newstyle-dynlibdirs
Closed

bugthunk wants to merge 1 commit into
haskell:masterfrom
bugthunk:bugthunk-fix-newstyle-dynlibdirs

Conversation

@bugthunk

@bugthunk bugthunk commented Mar 28, 2017 •

Copy link
Copy Markdown

Fixes #4263 and is a direct implementation of the recommendations there.

* Fixes haskell#4263 and is a direct implementation of the recommendations there
@mention-bot

Copy link
Copy Markdown

@bugthunk, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dcoutts, @ezyang and @23Skidoo to be potential reviewers.

@23Skidoo

Copy link
Copy Markdown
Member

/cc @christiaanb

I think this can go in once the build bot is green.

@23Skidoo 23Skidoo added this to the 2.0 milestone Mar 28, 2017
@ezyang

ezyang commented Mar 28, 2017

Copy link
Copy Markdown
Contributor

This will probably conflict with #4400, but I'm OK with giving this patch priority. More discussion in #4400 (comment)

@christiaanb

Copy link
Copy Markdown
Collaborator

I'm pretty sure this mostly mitigates the problem. However:

  1. I have no idea as to whether we'll never have conflicting .dylibs in the store now. What naming scheme is picked for the .dylib names that go into the store? If it's just libname-abi-version.dylib there will be problems. new-build currently works because the directory get a unique hash. This should be verified!

  2. We should acknowledge this only mitigates the problem. Some day, someone will use many dependencies, with (stupidly-)long install_names, and we'll go over the 32K limit.

@bugthunk

Copy link
Copy Markdown
Author

@christiaanb Good feedback for what's IMHO a silly vendor induced problem in the first place. I'll look into it some more.

@dcoutts

dcoutts commented Mar 28, 2017 •

Copy link
Copy Markdown
Contributor

I'd really rather avoid shared locations like this. I was under the impression that we can make a scheme work with separate dirs by including the store entry dir name into the library names.

Certainly if we do have a shared dir, then we must include the store entry id into the .dynlib library names, otherwise we've broken the properties of the store.

@23Skidoo

Copy link
Copy Markdown
Member

@dcoutts Do you think you can come up with an alternate fix in time for 2.0?

@dcoutts

dcoutts commented Mar 28, 2017

Copy link
Copy Markdown
Contributor

@23Skidoo @bugthunk The scheme I think we ought to look at is:

rpath = /home/me/.cabal/store/ghc-x.y  (or OSX equiv loc)
libname = @rpath/pkgname-ver-hash/pkgname-ver.dylib

Note that we do not need the abi in the library file name. Indeed in principle we do not need the package name or version either, since the store dir entry name is included.

@bugthunk

bugthunk commented Mar 28, 2017 •

Copy link
Copy Markdown
Author

I second @dcoutts after having read up on the marvels of rpath - continuing investigation (tomorrow).

@christiaanb

Copy link
Copy Markdown
Collaborator

Ah yeah, forgot that @dcoutts and I actually discussed his proposed scheme on IRC; sorry about that. For his scheme to work, all you need to do is make sure the install_name is:

@rpath/pkgname-ver-hash/pkgname-ver.dylib@

Which is set in here:

ghcOptDylibName :: Flag String,

RPaths are calculated here:

getRPaths :: LocalBuildInfo

@bugthunk

bugthunk commented Apr 3, 2017 •

Copy link
Copy Markdown
Author

(Resolved) Blocker: don't know how to get hash in @rpath/pkgname-ver-hash/pkgname-ver.dylib. libAbiHash isn’t the correct one AFAICT

libAbiHash :: Verbosity -> PackageDescription -> LocalBuildInfo

Any pointers about how to go about this?

@bugthunk

bugthunk commented Apr 3, 2017 •

Copy link
Copy Markdown
Author

(Resolved) I realise my request lacks context. Here comes some. Do correct me if I'm wrong.

As indicated by @christiaanb, ghcOptDylibName needs setting; according to my eyes this should be done at Distribution.Simple.GHC L759. The mempty that's there now makes us rely on GHC to set it to something in the vicinity of

@rpath/libHS${pkgName}-${pkgVersion}-${abiHash}-${compilerId}.${extension}

Therefore, it would seem I need the ABI hash but I'm not sure as to how to go about it. Also, I'm not exactly sure that the ABI is at all available at the stage where the build process is at at that point.

@bugthunk bugthunk changed the title Add single directory in store for .dynlib:s Add single directory in store for .dylib:s Apr 18, 2017
@bugthunk

bugthunk commented Apr 19, 2017 •

Copy link
Copy Markdown
Author

The proof-of-concept I have 'implemented' uses the Cabal store (expanding to ~ /Users/me/.cabal/store/ghc-8.0.2 in my case) as RPATH and the .dylib's install_names are modeled after this - and it works fine. During the compilation phase there are multiple libghc_* files produced in some descendant of /var/folders, however, and some of these break the build because the ordinary libs need the same linking strategy, cf. this entry:

Load command 217
          cmd LC_RPATH
      cmdsize 160
         path /Users/me/.cabal/store/ghc-8.0.2/zip-archive-0.3.0.5-0de00b7c6712b21fe2a687735e575621960f7778c286b4ba08ae547e86db88a7/lib/x86_64-osx-ghc-8.0.2 (offset 12)

In this particular instance, there were ~ 450 of these. It adds up. It was way worse when the dylibs had longer RPATH names, of course.

I don't know how to tackle this libghc_${whatever} from the Cabal side since information about it is scarce. I'll continue trying, though (pointers welcome - I have probably overseen some).

I envision either of two approaches:

  1. we all agree to consider macOS Sierra a typewriter and get on with our lives
  2. we unify the approach for the store across all platforms and all lib types (shared objects, plain static libs etc).

I'm sincerely open to both.

@christiaanb

christiaanb commented Apr 19, 2017 •

Copy link
Copy Markdown
Collaborator

@bugthunk I don't get what's going on here. Are you saying that:

  1. All .dylib files have an LC_RPATH of /Users/me/.cabal/store/ghc-8.0.2
  2. Some (few) .dylib files have an additional LC_RPATH of /Users/me/.cabal/store/ghc-8.0.2/{libname}-{hash}/lib/{abi} ?

Or are you saying that:

  1. All .dylib files have an LC_RPATH of /Users/me/.cabal/store/ghc-8.0.2
  2. All .dylib files have an also have an additional LC_RPATH of /Users/me/.cabal/store/ghc-8.0.2/{libname}-{hash}/lib/{abi} ?

@bugthunk

bugthunk commented Apr 19, 2017 •

Copy link
Copy Markdown
Author

@christiaanb : "None of the above"...

I just realised it's probably my poor (albeit increasing!) knowledge of cabal itself that was the cause of this.

Sorry for the interrupt. 😞

goes back to hacking, enthusiastically

@bugthunk

Copy link
Copy Markdown
Author

Let me just add that the next time I'll think it through when I'm a little less emotional.

@bugthunk

Copy link
Copy Markdown
Author

Stubborn as I am, I'm still at it. I might not solve it in the end but I've learned a lot.

Current problem: I cannot find how to control LC_RPATH for temporary shared objects. There's a bunch of unnecessary ones in the libghc_{Int}.dylib objects:

ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.2 for x86_64-apple-darwin):
	Loading temp shared object failed: dlopen(/var/folders/5z/dhg7wngx7qq01rkngjwk56tc0000gn/T/ghc30759_0/libghc_1.dylib, 5): no suitable image found.  Did find:
	/var/folders/5z/dhg7wngx7qq01rkngjwk56tc0000gn/T/ghc30759_0/libghc_1.dylib: malformed mach-o: load commands size (69696) > 32768

Neither can I find any pointers about what this shared object is, which would really help in deciding if the approach will work at all.

@23Skidoo 23Skidoo modified the milestones: 2.0.1, 2.0 May 5, 2017
@23Skidoo

23Skidoo commented May 5, 2017

Copy link
Copy Markdown
Member

Remilestoned.

@23Skidoo

23Skidoo commented May 5, 2017

Copy link
Copy Markdown
Member

Since the rpath approach seems to be difficult to implement, perhaps we can go with "dump everything into a single dir" for now and implement the rpath idea later? new-build not working on macOS kinda sucks.

@jmgrosen

jmgrosen commented Jul 6, 2017

Copy link
Copy Markdown

Any progress on this? I'm running into this myself, and it's pretty annoying.

@23Skidoo

23Skidoo commented Jul 7, 2017

Copy link
Copy Markdown
Member

@bugthunk is on holiday, I think no-one else is looking into this.

@bugthunk

bugthunk commented Jul 28, 2017 •

Copy link
Copy Markdown
Author

Since new-build uses hashes of 64 chars to id the libs and the path contains at least an additional 40-50 chars, getting under 100 is impossible and actually the system counts about 20-30 more than there is in each individual path for some unfathomable reason so that takes us to > 120 chars per dynlinked lib. Thus, deps can't ever be more than about 270 - and in reality rather less. GHC creates an intermediate large .dylib (libghc_*.dylib in temp dir) with seemingly all deps hitherto encountered multiple times during the compilation process and size of load commands for these is often measured way above the limit. I've found little information about this intermediate file, but it's the most difficult bit to fix yet. There was some redundancy in the load commands, but during my trials I never found that there was enough to make a sizeable contribution. More eyes are welcome, though.

@angerman

angerman commented Aug 1, 2017

Copy link
Copy Markdown
Collaborator

I've just run into this with yesod-persistent. I'm currently trying to figure out if we can just do static linking on macOS. However I don't think this is the ultimate solution.

How about we symlink all libraries to <hash>.dylib, and put just those into the library? Our libs would still be 64char each, but at least the limit would go up?

@angerman

angerman commented Aug 1, 2017

Copy link
Copy Markdown
Collaborator

Alright, building static only trips ghc up if it thinks it is capable of loading dynamic libs. It doesn't gracefully degrade to archives, but goes straight belly up with missing dynamic libraries. Not sure
if there's anything in GHC that would prevent falling through to archives though.

@angerman

angerman commented Aug 1, 2017

Copy link
Copy Markdown
Collaborator

For the record, here's what I get for yesod-persistent-1.4.2:

malformed mach-o: load commands size (33584) > 32768

otool -L reveals:

libHSyesod-persistent-1.4.2-b7ced08bd577069eb88d61bdacb15fed7858abedcaf5c96bfb11caeac25756ff-ghc8.2.1.dylib:
	@rpath/libHSyesod-persistent-1.4.2-b7ced08bd577069eb88d61bdacb15fed7858abedcaf5c96bfb11caeac25756ff-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSyesod-core-1.4.35.1-1dd3e9bc8766843ad4e65de8cf813004978e4c22295fa2c36ea4b62c4005b16f-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSwarp-3.2.13-6aa6dc7d50a8344b720c22a8c6c9a4d2b0aced34d8365e1d0862e515486bc650-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSsimple-sendfile-0.2.25-0aa2e29acfd255271012e2a185d4a6240a9f35bdfff1f56f4089bcab72d3cb08-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHShttp2-1.6.3-577b7139fb1afb108b092a46c0182c59690a1e94b6605f16429da4db75884d11-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSpsqueues-0.2.3.0-3b95e244fd6a6ea4aabe580d2e85caa6689d1d24f6a693b9e6c17aef7f74547d-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHShttp-date-0.0.6.1-a6aaad76e80f273ba88ac13e181a9f96772b77ec9bff679b3d35f766db8b7644-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSwai-extra-3.0.20.0-bc9de2c852758902fec14a2d5f5bd557edf09dac569b1269c03d935283cca8b6-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSword8-0.1.3-76b71c80168810a30301816031f40a1654846eab3e5edc2f68616a000b3a77ac-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSwai-logger-2.3.0-5fe80b6f659cce9206447aa861cfdbeeefff1af05946a2d853c2b817b9587c8e-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSvoid-0.7.2-66cdb5ff54a2db5185db81fc7fefd5c35ff8294793d37c3e313e40eb0bb755e5-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSstringsearch-0.3.6.6-cfb3a7de36c879eb020d7c99619218dc2edf36cdc670cb6a2fde4ab02d560636-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSiproute-1.7.1-1528f4140ee940453dd7cd014c46b14dc29df1e55645dfbeed365063cda2e3b0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSbyteorder-1.0.4-71767369266b364fc7c9d3bc730b75edc51ae319bd064d02b1fd85113fb34a49-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSappar-0.1.4-9beb556f99f924ba3d33925b287910ef27c95fb8a9ac11a92ed3b1c56b06c5fd-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSansi-terminal-0.6.3.1-253ac3cf42e7952d6664bf706843ba47498e7a2194fb5fa6c63dd564d20ce768-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSwai-3.2.1.1-79576637cf5910729067687dc710d830041da453d1e46db1d58fdc2f6306e6c0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSvault-0.3.0.7-09f6f475938158b37848f533a3caf2b50b9847292becc005476b282b7b7e16a1-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSunix-compat-0.4.3.1-38eaa16244e84de53b83df8b34f1c66a9de910f2805c4bf7b839c9c1a10cf33b-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSshakespeare-2.0.13-6e8db7b8b3dc4ecf764013b1ce2c04c1fb84cca0dc06e17759a2c48025652a29-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSsemigroups-0.18.3-14a28063fe5970ec0579e1a6c88bcd00e1a33202454c7824b03f65497211f90b-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSsafe-0.3.15-b7d79c8616079fff25c72e4071d0bf0caf4b0f75193f28a3d70628d2ad8bd382-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSparsec-3.1.11-509381e3d5a6128196af529e214c7058ea78da3def8ac8f86f262ea8f8f445fd-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSmwc-random-0.13.6.0-3342302b2a9da88cc83ee5d5b440bebeb84183c7d86eb4a949771886731d9f5a-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSmath-functions-0.2.1.0-5525689cb78f88bf4c23b9f6899b5440684b7bb5546a885a529202dfff3b572b-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSvector-th-unbox-0.2.1.6-b30a657cfdcbd1e842087c1dd2b9d4de2787862f5e16982fd47f8658453596b6-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSdeepseq-generics-0.2.0.0-c30b657a9a65195191346e3117f83a68a6b92cc91181105dcbe4c9eb8a974295-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSdata-default-0.7.1.1-3d9240b01a5022973da65788dc8b83d72002317c76425b603dd24b43abb6474f-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSdata-default-instances-old-locale-0.0.1-ee1883b19062af1276b767e4ff0e66b1309a3f8b43aaaea8e4533d06fe59bc8f-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSdata-default-instances-dlist-0.0.1-d17983fc7cc4b648eca058cfa254a8e36ac91e702db0aa78502627fe0d627345-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSdata-default-instances-containers-0.0.1-b640f22e2cb37e5cffc734d9a6786266b6351866ef27da39b4df96a35f4100e5-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHScookie-0.4.2.1-789eb0bcabd5d2a5dd64254124afe16084603243551302b9f32fdba0a033be1a-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSdata-default-class-0.1.2.0-9b8fc7783f8bd70969d17faab4c59e2c2a212fb4e46e647c92e7fb48f1a764bb-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSclientsession-0.9.1.2-cd3a5cda179a29713abc2106a5eb72cb282086eb93142574db1ecfc391260f20-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSskein-1.0.9.4-f6c0ccc4472a319e58ea6b3cf20121146e5425b0475043b0b5e6dac46535f0b3-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSsetenv-0.1.1.3-5ce4bd3589214501d21f3b5d8d4e28ba5c982559a2102f9225a13699a95dece4-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHScrypto-api-0.13.2-9502b8d08bb2d91939a02d419f98452f0b569cdf0cc4511aace654a729373891-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSentropy-0.3.8-73f5fd5cb8bbb8249684a812d17e43ed07060ac1fe8ea8ff87e1c799bc418a9d-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHScprng-aes-0.6.1-4d0974ec849e8f330dc6bc0b22b87447df56c1bc9aec532f00e1dfa82a5f4470-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHScrypto-random-0.0.9-4d86318416ac7e4b038391ed16119862d16d9a6624f6dccece1dd3e6944ed4ff-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHScipher-aes-0.2.11-00dbc4e898216c567e7344210d52a5740cb84309ea16f7c30ce8c83c231b8755-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHScrypto-cipher-types-0.0.9-b416e848e066e0d6f9c0a56b67c3f22c660a95073f009aa414ba2914b0457056-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSsecuremem-0.1.9-0d94caad8595b675144a3384d6d72c445da5264a2f64a52a25e7589de729a434-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSmemory-0.14.6-18268787107b79e89ae9f721a64b36510dcd1f5d44113fd11b792f3bac4a881c-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSfoundation-0.0.13-30cc64ac85c1145caa0d1be93034b5e7974b7fcaa10858db0ad9e0d89089e62b-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHScereal-0.5.4.0-f91883e3c8ec97f4d594176016810cc117afaf99fd85e43d6cf51917edf3136d-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSbyteable-0.1.1-7efc4035bafc0f5e8ec858aa14e2b1fa6dabcd0d0fc62221c9ec207813c40bd1-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSpersistent-template-2.5.2-ecd7414aae551badcd51f46f63a86ae84127a0fab8ffa0b1827dd91fa8c1919f-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSaeson-compat-0.3.7.1-73d9f7aa4785bac4370e705f6fcf6157980fd86eb8986ab809eddc28b98d2b09-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSpersistent-2.7.0-d2b69c72c4f1b9ad18cbf3a4a51dd37504cab909f58ab42eac2a417fcd610351-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSsilently-1.2.5-6abb7fc64380962a2bfee88e77090aa9f61f4c20d4c2bf2c97405c03680990c6-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSresource-pool-0.2.3.2-a2eeaa438d45dae62267cdf1858ea51706971263171bf89b69729e9f670db8bf-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSpath-pieces-0.2.1-6a36851e36c98fb0a0e94f67ada343b925a3a5b76b6e156513ab11180f0ae1b5-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSmonad-logger-0.3.25-d33901c61682d578bb60c0144a9f1e536c6e938fa932dd4ac818b610f4f7607a-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSstm-chans-3.0.0.4-708ddc83c0059392d07e5c751accc1fd18f58392a153d7404c13203f58502c02-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSmonad-loops-0.4.3-528d5216456c414743e21f7ffbe47003735a8d2f5e8c426bccef8c776da852d5-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSconduit-extra-1.1.16-a78b8623d64b6048967348691809755d57615c36d8c628d64aef185752703d83-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSstreaming-commons-0.1.18-6854bf6f438ac008b3cee55a51cca2fc2ab8a31d7823d52e7dd29d8c7f0516c8-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSzlib-0.6.1.2-6e00ff7de149ee2e12d2bff6d37d1fcec71a0348783cbc227ccddcab931abe2e-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/process-1.6.1.0/libHSprocess-1.6.1.0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSnetwork-2.6.3.2-35b940821d7fc4d3e47bf510fee03c369cd02d21eb910c6f9167c487f1cedc73-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSasync-2.1.1.1-8fa14f7e6e3cd50d19324e42722cb9631d22d0ec41197730c7261e10087cbe9f-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHShttp-api-data-0.3.7.1-101925ad64615f34811bf2cdef7aff66411eebbe38865f9610c95c3b7a795b37-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSuri-bytestring-0.2.3.3-8440b0d433480b8da92256bd156cd5dcc0b1ed9ec686378f582d5a5d348aa64b-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSth-lift-instances-0.1.11-ccfe4127a23dc8735115b0f34b8583ef9bc43d999759c3eac6ac2d4fbe33164e-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSth-lift-0.7.7-dc5937fb1229526d1ab29da13bc1b5c9efeedd7ad007a2064266453127c5592f-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHShttp-types-0.9.1-4f3bde152bd875da2eb64a3821a1ff316318c63be3eaa27273de54b7e76b1306-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHScase-insensitive-1.2.0.10-f14adc5c3c043c6900fc1deb16b0ab59525d7e61c32ff8c1e6a744005efc0094-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSattoparsec-iso8601-1.0.0.0-38ade712ba16ea091eeebb52044b269cbc5f46b3d83d4fc2d8c2cb7368e5f155-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSfast-logger-2.4.10-44f996d7d59e555c8ff1b824f62b4832bbf04d5d4d9b08686306f35e94c268f1-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSunix-time-0.3.7-e9349fb58e9e0cc9b6c5b45a0ad6319afc46fca965a1bef057e12cead8d8e44e-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSold-time-1.1.0.3-ff734001a028af4a1b956ee7da07dc409e12ffb5552901e532a69efa0f372cf4-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSold-locale-1.0.0.7-a53205adfd592f6356d45750d71af75abf9161d9ab9e8612ed967d724942b6b5-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSeasy-file-0.2.1-88472ef13e432b7c0bd22b56f27bb131c520b1e0960486a49cdb19824f28d900-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/directory-1.3.0.2/libHSdirectory-1.3.0.2-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/filepath-1.4.1.2/libHSfilepath-1.4.1.2-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSauto-update-0.1.4-9be67636dd9bee4c2f330b7f5233f52ead00ff9e6ef646dc51b4ac3f28a6b412-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSblaze-html-0.9.0.1-c0c144b41bcd75c880bf1c056e4a9cc2c150f113acd5d67cd141801bec021cdf-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSblaze-markup-0.8.0.0-97b34dc4118a62af312ac2fbf9099f56aad84cc4400e846437f081f25efcaab8-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSbase64-bytestring-1.0.0.1-f080e45eea3c5782f993eb5dcb59430199070be86cfb7dca1dabb4cd07916d67-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSaeson-1.2.1.0-7c12eb308aed776c49151fd8027f350dfc9b27faa316045a8cec6fd4b1b1065b-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSvector-0.12.0.1-5846eec6c9b4d437748aa7900ebcaad48ad884838698e7df43f5b7c8ca2d4993-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSuuid-types-1.0.3-ace0b8f624a24e6b650b474f63242f313e14ed11d3907181353e04c12067ff2d-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSrandom-1.1-dd7fb619fd8d5e385a990ee129dfbdd482271b4cbc7ec2c8fd21ca50b3e28437-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSunordered-containers-0.2.8.0-ec5f95f92ddb4a8599f6f49a4204a6cb883083564b1d2f072d5051c20acb9ec4-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHStime-locale-compat-0.1.1.3-594b5a4bba2358b0834952472a701343181d224d1d0990265fe1211b90381429-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHStagged-0.8.5-8e8540e806d27169772776084634f44dbc931475734b5a42a518d56edfaf7a37-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSdlist-0.8.0.3-63b0054e4477f6b5aa0b5b36dbfd311c67355977fca018e69031a9a23930c8b4-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSbase-compat-0.9.3-078dc31415b40ceeaa3e56f5da9ebe9a17b354f62f2e5411c07733768561dc52-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/unix-2.7.2.2/libHSunix-2.7.2.2-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/time-1.8.0.2/libHStime-1.8.0.2-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSattoparsec-0.13.1.0-24977f15d51491f09749046310864b811a7f3c7866bfbf2d9d6b298cc2ccd710-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSscientific-0.3.5.1-ac6cfa98402ae4846c8da64d313ffb6ff3ad405d20f384efe67a630bedc9adb4-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSinteger-logarithms-1.0.2-bd635cd2c5c419b99b27d1a71558d15ae681e0b01c6e9d28a448bf9dceb1a388-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHShashable-1.2.6.1-325c5ae1987afaf034420acae49af6117198f62370376b2dcd16e42247735207-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSconduit-1.2.11-ce265c02a4a3602a13a0468074d6cbed7aa99436b23f90be06b2053e42983c71-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSresourcet-1.1.9-b49aff5e261a54d471073e16b4005c6e1691ccc068d8ed3673cfa1896d82c64e-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSprimitive-0.6.2.0-f21f1b946aecbe0974ffaf8378eea363503784801fdb31abd9491fec5b47f328-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSmmorph-1.1.0-7374e9f6c2f617cc56739645bae041d745c7f56d8ef1fa01a3ef7016ca88d7e4-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSlifted-base-0.2.3.11-6a632a00f555b56fe09c730c877e0dd05df1f5ec1b149d71cfeb9964d115c803-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSmonad-control-1.0.2.1-0d7a38b1ee2ad7d0ae38f43166e449a4f84f6912fa8b89e1caa1f940f5fab1b6-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHStransformers-base-0.4.4-9df57a4583bb7e87c6e6b765a3721c7fd586c3430c7b028fe6f7a0b5b2a67a78-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSexceptions-0.8.3-90ee4b365bb4379e6604ba809ceff88952273b1c85625bbaab9bc24fbdcb50cb-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHStransformers-compat-0.5.1.4-8c69413a39fcee5ed05acedcc4acd673cb8a8c681208ccc3ee6fe65923367056-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/template-haskell-2.12.0.0/libHStemplate-haskell-2.12.0.0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/pretty-1.1.3.3/libHSpretty-1.1.3.3-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/ghc-boot-th-8.2.1/libHSghc-boot-th-8.2.1-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSstm-2.4.4.1-41da68a621b901931fc2c84039a248e7e9882d2e29f472f3c284c117e1419b28-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSmtl-2.2.1-dab5ae612df1d3d106ce681f004dfb6dfc2622390a41ca493385bf1dce2b4394-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/transformers-0.5.2.0/libHStransformers-0.5.2.0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSblaze-builder-0.4.0.2-f963bc2d4b5c55d2afdb2017912c6967e1f8aca524174134e3171e1066ff30e3-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHStext-1.2.2.2-e0cc6ee22e894abba2677ade640660705e2b9f64c19db649fd49badb5a258d1b-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/binary-0.8.5.1/libHSbinary-0.8.5.1-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/containers-0.5.10.2/libHScontainers-0.5.10.2-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/bytestring-0.10.8.2/libHSbytestring-0.10.8.2-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/deepseq-1.4.3.0/libHSdeepseq-1.4.3.0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/array-0.5.2.0/libHSarray-0.5.2.0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/base-4.10.0.0/libHSbase-4.10.0.0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/integer-gmp-1.0.1.0/libHSinteger-gmp-1.0.1.0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/ghc/lib/ghc-8.2.1/ghc-prim-0.5.1.0/libHSghc-prim-0.5.1.0-ghc8.2.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)

@christiaanb

Copy link
Copy Markdown
Collaborator

@angerman It's not just the commands that the output of -L gives, but also the ones given by -l, i.e. the rpath locations.

@angerman

angerman commented Aug 1, 2017

Copy link
Copy Markdown
Collaborator

Do we know if symlinks work? Maybe I take another stab tomorrow at it, and symlink all libraries into store/ghc-8.2/lib

@angerman

angerman commented Aug 2, 2017 •

Copy link
Copy Markdown
Collaborator

Looking at the absolute file name of the dylib:

/Users/angerman/.cabal/store/ghc-8.2.1/
  network-2.6.3.2-35b940821d7fc4d3e47bf510fee03c369cd02d21eb910c6f9167c487f1cedc73/
    lib/
      libHSnetwork-2.6.3.2-35b940821d7fc4d3e47bf510fee03c369cd02d21eb910c6f9167c487f1cedc73-ghc8.2.1.dylib

Why can't this simply be:

/Users/angerman/.cabal/store/ghc-8.2.1/
  lib/
    libHSnetwork-2.6.3.2-35b940821d7fc4d3e47bf510fee03c369cd02d21eb910c6f9167c487f1cedc73.dylib

what information do we loose?

@angerman angerman mentioned this pull request Aug 2, 2017
3 tasks done
@christiaanb

Copy link
Copy Markdown
Collaborator

@angerman Just symlinking won't work, you also need to update the package database entries so that Cabal and GHC know that the .dylibs are in ~/.cabal/store/lib.

Anyhow, as discussed earlier in this thread, putting .dylibs in a shared location is not what is supposed to happen to fix this. Instead, we should change the install_name of the .dylib files, see #4426 (comment) and #4426 (comment).

@angerman

angerman commented Aug 2, 2017

Copy link
Copy Markdown
Collaborator

@christiaanb what is implement in #4656 doesn't use symlinks. I figured that that was too hard to get right, and left it at changing the dynlib path. It needed some additional plumbing due to the relocatable prefix install assumption.

I actually tried to get the install_name solution working first, but gave up after it grow out of proportion. And even that solution would also suffer from the naming limit, and some name
mutilation would still be needed :/ (I've tried to outline the alternative strategy you mentioned
in #4656 as well).

Just to be clear, I'm not happy with #4656, but it allows me to work with new-build on macOS
now.

@bugthunk

Copy link
Copy Markdown
Author

The install_name solution requires solving the GHC intermediate .dylib issue referenced above. I'm unable to.

@23Skidoo 23Skidoo modified the milestones: 2.0.1, 2.0.2 Sep 19, 2017
@angerman

Copy link
Copy Markdown
Collaborator

Just to add this here for reference. The optimal solution might actually be teaching ghc about recursive dylibs (https://github.com/angerman/dylib-linking) and only linking the top level dependencies instead of flattening out the dependency graph.

I'd like to implement this eventually. With that in ghc, and cabal using ghc to link anyway, this issue might go away on it's own (even though it's a less prominent issue due to #4656 being merged).

@23Skidoo

23Skidoo commented Sep 28, 2017 •

Copy link
Copy Markdown
Member

Closing in favour of #4656.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants