You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cabal-install 3.14 linking fails with "shared object file not found" #10759
In my project, if I use the latest version of cabal-install in CI (3.14), I get a failure, but CI passes when pinning cabal-install to 3.12. PR: brandonchinn178/aeson-schemas#99. My project seems like a pretty normal library+executable+benchmark project, without anything special like compiler plugins. I'm running a simple cabal build && cabal exec -- cabal test. I can't repro locally.
One difference in 3.14 is it says "cabal_macros.h changed", presumably why it's rebuilding. Printing out cabal_macros.h before and after, I think the change is happy is not included after cabal build, but is included in the subsequent cabal exec -- cabal test. I don't use or declare happy anywhere in my cabal file, but it looks like a dependency, haskell-src-exts, uses it.
I do see this error message reported in other issues, including #8580 which I reported, but I'm reporting this separately because it looks like a possible regression between 3.12 and 3.14, instead of something I'm doing wrong.
To Reproduce
Steps to reproduce the behavior:
$ cabal build && cabal exec -- cabal test
Expected behavior
Should succeed
System information
Operating system
cabal, ghc versions
Additional context
Add any other context about the problem here.
The issue appears to be that when cabal exec -- cabal test is run, there is an environment file in scope, this causes the .so to have more dependencies than it did initially (since more -package args are passed). cabal then sets the rpath, but only to actual dependencies (not everything in the environment file).
Then the .so is attempted to be loaded, the shared library fails to be found because it is not on the rpath.
The cabal_macros.h file changes for the same reason, the ghc invocation picks up the environment file and hence there are extra -package arguments to ghc.
@brandonchinn178 I can't reproduce with cabal-install at commit - 5a21af6 .. possibly already fixed. With 3.14.1.0 I see "configuration changed" as the reason it has decided to rebuild.
Perhaps another way to implement this would be cabal exec -- $(cabal list-bin aeson-schemas-test)
The configuration changed message is just a generic message which says that ElaboratedConfiguredPackage is different somehow.
Therefore I think this is the same issue as #10692 which was fixed by #10731.
However, the real issue is arguably that GHC called by cabal-install is getting affected by the existence of environment files. cabal-install already has logic to avoid getting affected by GHC_PACKAGE_PATH, so it should also be isolated by environment files existing.
Is this bug considered fixed by #10731? In that case, I suggest closing this regression issue for PR (as in "public relations") reasons. The "proper" fix has already been submitted in #10828 and will hopefully make it into 3.16 regardless of the status of this issue (closed or open), so I don't see a reason to keep it open.
Also, it'd be good if someone double-checked that cabal-head no longer exhibits this issue (after #10731 was merged). @brandonchinn178, maybe?
@brandonchinn178 awesome, thank you! (That "Build cabal-head" in the CI hit me in the gut as the person who spearheaded the distribution of cabal-head binaries, but then I saw that it does download the binaries, not "build" them 😅)
Activity
mpickering commentedon Mar 10, 2025
I can reproduce this locally.
mpickering commentedon Mar 10, 2025
Is there a reason in particular you are running
cabal exec -- cabal testrather than justcabal test?mpickering commentedon Mar 10, 2025
The issue appears to be that when
cabal exec -- cabal testis run, there is an environment file in scope, this causes the.soto have more dependencies than it did initially (since more -package args are passed). cabal then sets the rpath, but only to actual dependencies (not everything in the environment file).Then the
.sois attempted to be loaded, the shared library fails to be found because it is not on the rpath.brandonchinn178 commentedon Mar 10, 2025
Yes, I believe this test needs cabal exec because it shells out to ghc:
https://github.com/brandonchinn178/aeson-schemas/blob/main/test%2FTests%2FGetQQ.hs#L414
There might be other tests too. Removing cabal exec should see failures
mpickering commentedon Mar 10, 2025
The
cabal_macros.hfile changes for the same reason, theghcinvocation picks up the environment file and hence there are extra -package arguments toghc.mpickering commentedon Mar 10, 2025
@brandonchinn178 I can't reproduce with cabal-install at commit - 5a21af6 .. possibly already fixed. With 3.14.1.0 I see "configuration changed" as the reason it has decided to rebuild.
Perhaps another way to implement this would be
cabal exec -- $(cabal list-bin aeson-schemas-test)The
configuration changedmessage is just a generic message which says thatElaboratedConfiguredPackageis different somehow.mpickering commentedon Mar 10, 2025
Good news is I can reproduce with a locally built 3.14.1.1 cabal-install.
mpickering commentedon Mar 10, 2025
The reason why it thinks that the configuration has changed is because when
cabal testruns insidecabal execthe PATH tohappyis configured.mpickering commentedon Mar 10, 2025
Therefore I think this is the same issue as #10692 which was fixed by #10731.
However, the real issue is arguably that GHC called by
cabal-installis getting affected by the existence of environment files.cabal-installalready has logic to avoid getting affected by GHC_PACKAGE_PATH, so it should also be isolated by environment files existing.brandonchinn178 commentedon Mar 10, 2025
I think that makes sense, thanks for investigating! Are there any plans for 3.14.1.2?
Cabal: Always pass `-package-env=-` to supported GHC versions
8 remaining items
Add test for #10759
mpickering commentedon Mar 14, 2025
I have put a "proper fix", which I would not advise backporting, in #10828
Cabal: Always pass `-package-env=-` to supported GHC versions
Add test for #10759
Add test for #10759
Mikolaj commentedon Mar 17, 2025
How about the non-proper fix? Is it a good idea to backport it for a bufix 3.14 release? @mpickering @brandonchinn178
mpickering commentedon Mar 17, 2025
Yes it is very important to backport #10731 as that fixes another reported regression.
Mikolaj commentedon Mar 17, 2025
Got it. PR marked. I will leave the actual backporting to @Kleidukos, because order of backports matters.
ulysses4ever commentedon Mar 19, 2025
Is this bug considered fixed by #10731? In that case, I suggest closing this regression issue for PR (as in "public relations") reasons. The "proper" fix has already been submitted in #10828 and will hopefully make it into 3.16 regardless of the status of this issue (closed or open), so I don't see a reason to keep it open.
Also, it'd be good if someone double-checked that
cabal-headno longer exhibits this issue (after #10731 was merged). @brandonchinn178, maybe?brandonchinn178 commentedon Mar 20, 2025
@ulysses4ever It looks like d4d92e9 works: https://github.com/brandonchinn178/aeson-schemas/actions/runs/13963124650/job/39087995984
ulysses4ever commentedon Mar 20, 2025
@brandonchinn178 awesome, thank you! (That "Build cabal-head" in the CI hit me in the gut as the person who spear
headed the distribution of cabal-head binaries, but then I saw that it does download the binaries, not "build" them 😅)Cabal: Always pass `-package-env=-` to supported GHC versions
Add test for #10759