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

Issue with dynamic linking on MacOS #45

Open
Tritlo opened this issue Jul 26, 2021 · 9 comments
Open

Issue with dynamic linking on MacOS #45

Tritlo opened this issue Jul 26, 2021 · 9 comments
Labels
Bug Something isn't working

Comments

@Tritlo
Copy link
Owner

Tritlo commented Jul 26, 2021

Issue when running cabal test

[...]
/Users/xxx/Endemic/dist-newstyle/build/x86_64-osx/ghc-8.10.1/Endemic-0.5.0/t/slow-test/test/Endemic-0.5.0-slow-test.log
0 of 1 test suites (0 of 1 test cases) passed.
Tests
  Utils
    dropPrefix:                               OK (0.03s)
      +++ OK, passed 100 tests.
    startsWith:                               OK
      +++ OK, passed 100 tests.
    boolToBitsInverse:                        OK
      +++ OK, passed 100 tests; 7 discarded.
    insertAt:                                 OK
      +++ OK, passed 100 tests; 138 discarded.
  Repair
    Repair `foldl (-) 0`:                     TIMEOUT (10.04s)
      Timed out after 10s
    GetExprCands finds important candidates:  OK (0.09s)
    Repair `gcd'` with gcd:                   OK (9.51s)
  Failing props
    Failing props for gcd:                    OK (3.60s)
    Only one failing prop:                    OK (1.58s)
    Two failing TastyProps:                   
tests/cases/TastyTwoFix.hs:3:1: error:
    Could not load module ‘Test.Tasty’
    It is a member of the hidden package ‘tasty-1.4.1’.
    You can run ‘:set -package tasty’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    It is a member of the hidden package ‘tasty-1.4.1’.
    You can run ‘:set -package tasty’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
3 | import Test.Tasty
  | ^^^^^^^^^^^^^^^^^

tests/cases/TastyTwoFix.hs:4:1: error:
    Could not load module ‘Test.Tasty.HUnit’
    It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
    You can run ‘:set -package tasty-hunit’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
    You can run ‘:set -package tasty-hunit’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
    You can run ‘:set -package tasty-hunit’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
4 | import Test.Tasty.HUnit (testCase, (@?=))
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FAIL
      Exception: Could not load module ‘Test.Tasty’
      It is a member of the hidden package ‘tasty-1.4.1’.
      You can run ‘:set -package tasty’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      It is a member of the hidden package ‘tasty-1.4.1’.
      You can run ‘:set -package tasty’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      Use -v (or `:set -v` in ghci) to see a list of the files searched for.
      Could not load module ‘Test.Tasty.HUnit’
      It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
      You can run ‘:set -package tasty-hunit’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
      You can run ‘:set -package tasty-hunit’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
      You can run ‘:set -package tasty-hunit’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  Counter Examples
    Only one counter example:                 TIMEOUT (10.04s)
      Timed out after 10s
    Multiple examples:                        TIMEOUT (10.03s)
      Timed out after 10s
    No args loop fail:                        OK (5.26s)
  Trace tests
    Trace foldl:                              TIMEOUT (25.15s)
      Timed out after 10s
    Trace finds loop:                         OK (8.99s)
  Module tests
    Repair BrokenModule With Diff:            FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
    Repair BrokenModule finds correct target: FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
    Repair BrokenGCD:                         FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
    Repair MagicConstant:                     FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
  Sanctify tests
    Sanctify foldl program:                   FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
    Fill foldl program:                       FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1

11 out of 21 tests failed (86.13s)

[...]

This is also the reason for the red CI

Originally posted by @lapplislazuli in #44 (comment)

@Tritlo
Copy link
Owner Author

Tritlo commented Jul 26, 2021

Seems to work in the CI @lapplislazuli, are you doing something different?

@Tritlo
Copy link
Owner Author

Tritlo commented Jul 26, 2021

@lapplislazuli note: the version of check-helpers was bumped, so you'll need to upgrade.

@lapplislazuli
Copy link
Collaborator

I deleted my .cabal, ran cabal update and re-installed the check-helpers. The issue above remains. Check-helpers is 0.0.4 and endemic is 0.5.0.
But it seems similar to the issues with local imports? Just looking at the error message.

It seems to be a different one to the one in the CI

@lapplislazuli lapplislazuli added the Bug Something isn't working label Jul 27, 2021
@Tritlo
Copy link
Owner Author

Tritlo commented Jul 27, 2021

That's weird, since the bug you show is exactly what would happen if check-helpers was outdated. Did you delete:

  • the cabal store ~/.cabal
  • the ghc env ~/.ghc
  • and dist-newstyle?

The bug in the CI seems to be a fluke.

Local imports are now on master, but it's a different issue: there we look for the source code of any imported modules and add them as a target if they exsist, while here the global package seems to not be working.

@Tritlo
Copy link
Owner Author

Tritlo commented Jul 27, 2021

@lapplislazuli could you pull master and see if you still get the issue?

@lapplislazuli
Copy link
Collaborator

On the current Master the issue is different for me.

I first deleted ~/.ghc and ~/.cabal, then ran cabal update, cabal install QuickCheck & cabal install --lib tasty tasty-hunit.
In the repository I cleaned up using cabal clean, and removed all .o and .hi files from the tests directory.

In our Repository I ran the cabal configure ... as per readme, cabal install --lib check-helpers and then cabal run test.
Most of the tests are green (including ones that need tasty imports, so the problem seems generally fixed), but one test fails:

    Two failing TastyProps:                   FAIL
      Exception: <interactive>: fatal:
          cannot find object file ‘tests/cases/TastyTwoFix.dyn_o’
          while linking an interpreted expression

This seems to be (somehow) a MacOS issue, as both Docker and the CI are fine.

@lapplislazuli lapplislazuli changed the title Issue when running cabal test Issue when running cabal test [MacOS] Jul 27, 2021
@lapplislazuli
Copy link
Collaborator

The issues with Dyn_o also made it into normal cabal run:

Linking /Users/xxx/Endemic/dist-newstyle/build/x86_64-osx/ghc-8.10.1/Endemic-0.6.0/x/endemic/build/endemic/endemic ...
endemic: <interactive>: fatal:
    cannot find object file ‘examples/BrokenModule.dyn_o’
    while linking an interpreted expression

@lapplislazuli lapplislazuli changed the title Issue when running cabal test [MacOS] Issue with dynamic linking on MacOS Jul 29, 2021
@lapplislazuli
Copy link
Collaborator

On deep contemplation, I think this is because my Mac needs dynamic compilation, but the fake targets are not compiled dynamicly.
For the files .o- and .hi-files are created while my Mac only wants .dyn_o. I think this is solvable with a compiler-config.

@Tritlo
Copy link
Owner Author

Tritlo commented Jul 29, 2021

Yes, that makes a lot of sense. However, we don't always link the new ones, esp. not with repInteractive. Have you tried with that on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants