Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test build directory to LD_LIBRARY_PATH when -executable-dynamic #3527

Closed
wants to merge 2 commits into from

Conversation

thomie
Copy link
Contributor

@thomie thomie commented Jul 8, 2016

Since commit 18fcd9c, Cabal builds the stub executable and the test library for a LibV09 (detailed-0.9) test in different directories.

This is good, but when running the test with --enable-executable-dynamic, we now have to add the test build directory to (DY)LD_LIBRARY_PATH, so that the linker can find the test library when running the stub executable (see #2289 for details).

This fixes #2039 (read: no parse). The GHC panic mentioned in that ticket must have been resolved earlier already, perhaps also by commit 18fcd9c.

CC @ezyang, @christiaanb

thomie added 2 commits July 8, 2016 16:25
Refactoring only. This is necessary for the next commit.

To prevent import cycles, I moved `checkForeignDeps` from
`Cabal.Distribution.Simple.Configure` to `Cabal.Distribution.Simple`.
Since commit 18fcd9c, Cabal builds the stub
executable and the test library for a LibV09 (detailed-0.9) test in
different directories.

This is good, but when running the test with --enable-executable-dynamic, we
now have to add the test build directory to (DY)LD_LIBRARY_PATH, so that the
linker can find the test library when running the stub executable (see haskell#2289
for details).

This fixes haskell#2039 (read: no parse). The GHC panic mentioned in that
ticket must have been resolved earlier already, perhaps also by commit
18fcd9c.
paths <- LBI.depLibraryPaths
True False lbi clbi
True False lbi exeClbi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a comment explaining why it's exeClbi and not clbi.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the following comment already:

-- Get the dependencies of the stub
-- executable. They should include the test
-- library itself (#2039).

If you still think it isn't clear, could you suggest what the comment should be?

Copy link
Contributor

@ezyang ezyang Jul 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I investigated and here is what I discovered:

  1. Here is something confusing: the function is called depLibraryPaths (library?!), yet we are passing it the CLBI for the executable! I looked at the definition and the point is that depLibraryPaths doesn't have anything to do about libraries; it has to do with the DEPENDENT libraries, and whose dependencies do we care about? The executables. So I guess I'd personally be a fan of a -- NB: the library path is for the dependencies of the *executable*, not library (or if you want to shave yaks, renaming depLibraryPaths)
  2. I don't understand why this code has to go through all these gyrations to even get its hands on the executable CLBI. This seems wrong-headed. The real problem is that the CLBIs for this type of test is a massive hack, as explained in Build:
               clbi -- This ComponentLocalBuildInfo corresponds to a detailed
                    -- test suite and not a real component. It should not
                    -- be used, except to construct the CLBIs for the
                    -- library and stub executable that will actually be
                    -- built.

A variant of this comment seems apt here. If this were GHC I'd tell you to refer to the Note.
3. And here is another yak: there is probably no good reason why runTest shouldn't be taking in the ComponentLocalBuildInfo. build certainly does! (But this is a yak and you do not have to shave it.)

Does that help?

@23Skidoo
Copy link
Member

23Skidoo commented Jul 9, 2016

LGTM, I think this can go in once @ezyang's comments are addressed.

jtdaugherty added a commit to jtdaugherty/vty that referenced this pull request Mar 9, 2020
…g failures

This change is an attempt to address failures like the one at

https://travis-ci.org/jtdaugherty/vty/jobs/660259959

that give rise to the "Prelude.read: no parse" errors. Although that may
not seem like the error one would expect, see these resources for
details on why I think this is the "fix" for this problem:

* https://stackoverflow.com/questions/39310043/getting-prelude-read-no-parse-error-when-using-detailed-0-9-tests-with-cabal
* haskell/cabal#3527
@Mikolaj
Copy link
Member

Mikolaj commented May 22, 2021

@thomie: hi! it's been a while and the code must have bitrotted, but AFAICT it's still an important issue to solve, so would you like to work on it and merge it?

@thomie
Copy link
Contributor Author

thomie commented May 24, 2021

@Mikolaj: sorry, I will not work on this anymore.

@thomie thomie closed this May 24, 2021
@Mikolaj
Copy link
Member

Mikolaj commented May 24, 2021

@thomie: that's fine, thank you for your contributions and all the best!

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.

"ghc: panic! (the 'impossible' happened)" using "--enable-executable-dynamic"
4 participants