Skip to content

Do register monolithic packages if they contain a buildable pub-lib - #5604

Merged
hvr merged 1 commit into
haskell:masterfrom
hvr:pr/issue-5379
Oct 17, 2018
Merged

hvr merged 1 commit into
haskell:masterfrom
hvr:pr/issue-5379

Conversation

@hvr

@hvr hvr commented Oct 4, 2018

Copy link
Copy Markdown
Member

As the case of cpphs-1.20.8 has shown in #5379, in cases when a
monolithic package gets installed due to its executable components
(i.e. exe:cpphs) into the store we have to register if there's a
buildable public library (i.e. lib:cpphs) that was built and installed
into the same store folder as otherwise this will cause build failures
once a target actually depends on lib:cpphs

This ought to fix #5379

(TODO: changelog entry when cherry-picking to 2.4)

@hvr hvr added this to the 2.4.0.1 milestone Oct 4, 2018
@hvr
hvr requested a review from ezyang October 4, 2018 11:10
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 4, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "4cca74ec08213050e5ab03f07ef1a1248ba29007",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 4, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "4cca74ec08213050e5ab03f07ef1a1248ba29007",
"tag":"osx-7.8.4"
}
@ezyang

ezyang commented Oct 7, 2018

Copy link
Copy Markdown
Contributor

I was asked in private correspondence if the test any (depends_on_lib pkg) (elabBuildTargets elab) is redundant with the new public library check. The answer is no. Here's when it matters:

  1. You are building a package with a custom setup
  2. This package has an executable which depends on an internal library
  3. The package is from a sufficiently old version of Cabal, such that per-component builds are not in effect

We must register and install dynamic libraries of the internal (non-public library), and this will not trigger the Cabal.hasPublicLib (elabPkgDescription elab) condition.

After thinking about the proposed change a bit, I think it's OK.

I do think there's a more important, structural problem with the code we edited here. Basically, we shouldn't be making registration decisions based on selected build targets. A build target doesn't get fed into the Nix hash... so it shouldn't have an effect on how we install the package. I guess this is related to the strategy of pruning that local builds do.... but it seems very error prone.

@hvr

hvr commented Oct 7, 2018 •

Copy link
Copy Markdown
Member Author

@ezyang ok, but

Here's when it matters:

  1. You are building a package with a custom setup
  2. This package has an executable which depends on an internal library
  3. The package is from a sufficiently old version of Cabal, such that per-component builds are not in effect

But is this situation currently possible? It was my understanding that internal libraries are not supported unless per-component builds can be enabled. In other words, we don't support internal libraries when using custom setups, do we?

PS: Or are those disjunctive conditions you enumerated there?

In that case, wouldn't case 2. be handled by the per-component codepath (i.e. via the ElabComponent-branch)?

@ezyang

ezyang commented Oct 7, 2018

Copy link
Copy Markdown
Contributor

You're right, I had forgotten about this. So yes, I guess if that case is impossible, the test their is redundant. But it's a sort of accidental redundancy which would go away if you ever made internal libraries work with non-per-component build (though we probably won't ever do that.)

1 similar comment
@ezyang

ezyang commented Oct 7, 2018

Copy link
Copy Markdown
Contributor

You're right, I had forgotten about this. So yes, I guess if that case is impossible, the test their is redundant. But it's a sort of accidental redundancy which would go away if you ever made internal libraries work with non-per-component build (though we probably won't ever do that.)

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 13, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "509b6d492beaf09a0a6a3abad4d74bc09cce2dff",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 13, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "509b6d492beaf09a0a6a3abad4d74bc09cce2dff",
"tag":"osx-7.8.4"
}
@hvr

hvr commented Oct 14, 2018 •

Copy link
Copy Markdown
Member Author

@ezyang btw, a test-case fails legitimately; specifically the cabal-testsuite/PackageTests/Exec one which has a cabal file which forces legacy mode w/ build-type simple:

name:           my
version:        0.1
license:        BSD3
cabal-version:  >= 1.2
build-type:     Simple

library
    exposed-modules:    Foo
    build-depends:      base


executable my-executable
    main-is:            My.hs
    build-depends:      base

And the problem is specifically because in this situation (i.e. for local packages) despite being in legacy non-component mode we can still build single components:

$ cabal new-build my-executable -vnormal+nowrap
Resolving dependencies...
Build profile: -w ghc-8.2.2 -O1
In order, the following will be built (use -v for more details):
 - my-0.1 (exe:my-executable) (first run)
Configuring my-0.1...
Preprocessing executable 'my-executable' for my-0.1..
Building executable 'my-executable' for my-0.1..
[1 of 1] Compiling Main             ( My.hs, .../cabal-testsuite/PackageTests/Exec/dist-newstyle/build/x86_64-linux/ghc-8.2.2/my-0.1/build/my-executable/my-executable-tmp/Main.o )
Linking .../cabal-testsuite/PackageTests/Exec/dist-newstyle/build/x86_64-linux/ghc-8.2.2/my-0.1/build/my-executable/my-executable ...
cabal: Failed to build my-0.1. The failure occurred during the final install step. The exception was:
  dieVerbatim: user error (cabal: '/opt/ghc/bin/ghc-pkg' exited with an error:
my-0.1: Warning: haddock-interfaces: .../cabal-testsuite/PackageTests/Exec/dist-newstyle/build/x86_64-linux/ghc-8.2.2/my-0.1/doc/html/my/my.haddock doesn't exist or isn't a file
my-0.1: Warning: haddock-html: .../cabal-testsuite/PackageTests/Exec/dist-newstyle/build/x86_64-linux/ghc-8.2.2/my-0.1/doc/html/my doesn't exist or isn't a directory
my-0.1: cannot find any of ["Foo.hi","Foo.p_hi","Foo.dyn_hi"] (use --force to override)
my-0.1: cannot find any of ["libHSmy-0.1-inplace.a","libHSmy-0.1-inplace.p_a","libHSmy-0.1-inplace-ghc8.2.2.so","libHSmy-0.1-inplace-ghc8.2.2.dylib","HSmy-0.1-inplace-ghc8.2.2.dll"] on library path (use --force to override)
)

Any suggestion/idea?

@ezyang

ezyang commented Oct 15, 2018

Copy link
Copy Markdown
Contributor

Don't drop the condition I wrote? :) But yes, I think this is exactly the case (which I had forgotten about) which required the more subtle check I added.

@hvr

hvr commented Oct 15, 2018

Copy link
Copy Markdown
Member Author

@ezyang if you look at the patch, I did not drop the condition! :-)

As the case of `cpphs-1.20.8` has shown in haskell#5379, in cases when a
monolithic package gets installed due to its executable components
(i.e. `exe:cpphs`) into the store we *have* to register if there's a
buildable public library (i.e. `lib:cpphs`) that was built and installed
into the same store folder as otherwise this will cause build failures
once a target actually depends on `lib:cpphs`

This ought to fix haskell#5379
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 17, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "957bbc7e88a11869fe95bb13778f7296faa95957",
"tag":"linux-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 17, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "957bbc7e88a11869fe95bb13778f7296faa95957",
"tag":"linux-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 17, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "957bbc7e88a11869fe95bb13778f7296faa95957",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 17, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "957bbc7e88a11869fe95bb13778f7296faa95957",
"tag":"linux-8.2.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 17, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "957bbc7e88a11869fe95bb13778f7296faa95957",
"tag":"linux-8.4.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 17, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "957bbc7e88a11869fe95bb13778f7296faa95957",
"tag":"linux-8.6.1"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 17, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "957bbc7e88a11869fe95bb13778f7296faa95957",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 17, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "957bbc7e88a11869fe95bb13778f7296faa95957",
"tag":"osx-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 17, 2018
"url":"pull/5604",
"account":"haskell",
"repo":"cabal",
"commit": "957bbc7e88a11869fe95bb13778f7296faa95957",
"tag":"osx-8.0.2"
}
@hvr
hvr merged commit a4578fc into haskell:master Oct 17, 2018
hvr added a commit that referenced this pull request Oct 17, 2018
…5604)

As the case of `cpphs-1.20.8` has shown in #5379, in cases when a
monolithic package gets installed due to its executable components
(i.e. `exe:cpphs`) into the store we *have* to register if there's a
buildable public library (i.e. `lib:cpphs`) that was built and installed
into the same store folder as otherwise this will cause build failures
once a target actually depends on `lib:cpphs`

This ought to fix #5379
(cherry picked from commit a4578fc)
hvr added a commit that referenced this pull request Oct 17, 2018
@hvr

hvr commented Oct 17, 2018

Copy link
Copy Markdown
Member Author

merged to 2.4 via 517b49d

I figured it out at last how to distinguish the inplace from the store-install case; the test-suite passes

@hvr
hvr deleted the pr/issue-5379 branch October 17, 2018 15:52
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.

Builds depending on cpphs fail occasionally.

2 participants