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
Libraries that use Template Haskell cannot use atomic-primops (cas symbol problem) #10
Comments
Yes, I got the same error with your reproducer. Aha, it looks like GHCI provides a third scenario beyond "ghc" and "ghc -threaded". In fixing Issue #8, I made sure that duplicate versions of the relevant functions were there to support normal compilation/linking with or without -threaded. Actually, in both of THOSE cases "cas" is available, but the other barrier functions are not. Yet it looks like in the GHCI case "cas" is not available. I think the fix can simply be extended to cover this. |
Ugh, working on it. Past the 'cas' error and now getting this:
Also, I'd welcome a pull request with a simplified version of the reproducer in it. Or any other tests you have that are giving problems. |
Using GHCi via TemplateHaskell bytecode interpretation with Data.Atomics. Related to rrnewton#10 . Note: hello-word-atomic-primops.hs missing.
Using GHCi via TemplateHaskell bytecode interpretation with Data.Atomics. Related to rrnewton#10 . Note: hello-word-atomic-primops.hs missing.
I'm afraid I'm stumped on this until I dig a bit more into how GHCI works. The library has a bunch of undefined symbols which need to be satisfied by the RTS.
Maybe there's some library or object that atomic-primops can explicitly depend on to make sure this stuff gets linked? |
Update: Simon Marlow said this is a GHC bug and that he'll fix it: http://www.haskell.org/pipermail/ghc-devs/2013-July/001714.html |
By the way, I don't run into this bug on Mac. This is a Linux-specific bug it seems. |
This bug remains for 7.6 but it's fixed in 7.8 so I'm closing this now. |
This change automatically turns on the template-haskell-atomic-primops test when GHC >7.8 is used. This is a test case for issue rrnewton#8 . The test case remains disabled for <=7.6.3 due to a bug in GHC 7.6 described in issue rrnewton#10 .
I'm running into this bug with ghc-7.8.3 on linux. We're using ghc with the following
but otherwise it's a standard build. I've hacked around it by enabling RtsDup for now, but I think it may be a remaining bug in ghc. Just wanted to point it out in case other users run into the same problem. Also I wonder if it works on Windows at all (which AFAIK is also not dynamic by default). |
Libraries or programs that use Template Haskell will not be able to use the atomic-primops library. The root cause is a combination of two things. First, need to use
-threaded
for code that ultimately uses atomic-primops, as described in this issue. Second, Template Haskell runs at compile time, via a bytecode interpreter, GHCi. This does not invoke-threaded
, so the error is thrown, once GHCI attempts to load packages:As a simply example, try compiling this demo library I put together: chaselev-user-libX-0.0.1.tar.gz. The case is straight forward: if you comment out
remotable
on line 17 ofFoo.Bar
, the library compiles. If you leave it in, the library does not compile.The text was updated successfully, but these errors were encountered: