-
Notifications
You must be signed in to change notification settings - Fork 50
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
c2hs-2.28.2 (and master) is not able to parse glibc-2.26 <math.h> #192
Comments
The minimal header contains extern int __fpclassifyf128 (_Float128 __value) __attribute__ ((__nothrow__ , __leaf__))
__attribute__ ((__const__)); Look similar to #191 |
Same error here. GCC version: 7.2.0
Build c2hs against lang-c-0.7.0 with following patch can not fix this bug. --- c2hs/src/C2HS/CHS/Lexer.hs 2017-09-26 14:46:32.883631956 +0800
+++ c2hs-patched/src/C2HS/CHS/Lexer.hs 2017-09-26 14:21:20.337931237 +0800
@@ -712,7 +712,7 @@
s, Nothing)
adjustPosByCLinePragma :: String -> Position -> Position
-adjustPosByCLinePragma str pos = adjustPos fname' row' pos
+adjustPosByCLinePragma str pos = position (posOffset pos) fname' row' 1 (Just pos)
where
fname = posFile pos
str' = dropWhite str
|
After some trial and error, I found an ugly workaround: Modify Not fond of modifying system include files, but better than being forced to downgrade my system.. |
Of course that would be too easy and breaks, because at some point |
I upgraded |
@deech I tried using the following in a test stack.yaml file:
I have to take a little care that I'm using the correct |
I also, unfortunately, had issues setting the location by commit hash. I ended up doing:
|
I got this working, from your (@deech) branch of c2hs do a stack init and try the following snippet
Then |
Once your |
So in an effort to get Unfortunately, when the test suite for
Where the particular line in question is:
Dunno if this is an issue of my environment or what. I'll try to find time to continue to poke at it. |
Would you mind posting your Nix recipe? I don't run NixOS but I can try replicating with plain Nix. |
Happy to! mdorman/nixpkgs@0a74880 is the change I made that pulls in the patches. And then something like The branch is https://github.com/mdorman/nixpkgs/tree/haskell-updates, and though it shouldn't matter much, it is based on top of https://github.com/peti/nixpkgs/tree/haskell-updates. |
That error makes sense... With the |
…at128 bug Works around haskell/c2hs#192. Closes NixOS#31411. Closes NixOS#31498.
@deech visq/language-c#41 has been merged. |
I've just uploaded c2hs 0.28.3. It uses language-c-0.7.1 which has a fix for the _Float128 bug. There's a test case in place but if someone could try it and let me know I'll close the issue. |
The
|
I am able to reproduce but I haven't had time to investigate why it's happening.
but not in this one:
I'll look at it later on this evening. Sorry for the trouble. |
@peti Which version of gcc are you using? Are you using a version older than 7? In such cases, the
I think this is problematic for pre-7 gcc and C++ mode. visq/language-c#43 |
@jchia, NixOS compiles this code with GHC 6.4.0. |
@peti I suspect that under GCC 7 the problem goes away, as elucidated in visq/language-c#43. Would it be easy for you to try GCC 7 and test my theory? |
Unfortunately, it's not easy test these builds with GCC 7.x. It can be
done, but it's very build intensive and I don't think I'll have a chance
to do it. :-(
|
@jchia I got the |
For what it's worth, the test suite still fails in c2hs-2.8.3:
EDIT: It turned out that this failure is unrelated to this issue, so I moved the (large) build log into a new ticket at #204. |
@peti I think this issue depends on this language-c issue. If that issue is solved, this issue is solved. |
@peti yeah, but I think for different reasons. It's hard to pick the signal out of your log posting, but I think you have a failure in test case #7. Your error log:
My log:
We need a different issue for your error as it is seemingly unrelated to this issue. Please correct me if I'm misunderstanding your problem @peti. |
The test Issue-83 fails as:
It seems to be related to macro expansion. I'll try to build minimal reproducible example
out of glibc headers.
The text was updated successfully, but these errors were encountered: