-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fails to compile when including <math.h> of recent glibc #48
Comments
Hmm, I'm still running 2.24, so can't really test it. Can you also include your math.h, where the Also, in case I need to debug this myself by installing a VM, can you tell me which distro you are using? |
Here is a minimal example, together with all the header files needed to compile it:
Lines 308-309 in
I suspect that CIL doesn't recognize _Float128 as a type. When I try to compile
I get a similar error:
The same file compiles fine with GCC. So you may be right, it looks like the problem is a compiler intrinsic. |
It seems you are right, and CIL is not the only software having problems with this new GCC extension. See e.g haskell/c2hs#192. Looking through the math.h file, maybe we can solve this by adding |
Adding |
by ignoring unavoidable but unneeded _Complex and __float128 keywords. Upstream issue: samee/obliv-c#48
I just ran into this one while trying to build my library on an updated system for the first time. For now, what's the suggested mitigation? #undef __HAVE_DISTINCT_FLOAT128? If that's a reasonable course, I'm happy to modify my library, but I'm not 100% certain what the implications would be. |
I'm compiling everything that includes libACK with |
Another option is to not include math.h at all, but instead declare the functions you need yourself. At some point, I did that as well for ACK (see this commit), but again, I think this should be fixed in Obliv-C, not in libraries depending on it. |
The NixOS patch is definitely the cleanest of the ones we have discussed so far. The proper fix will be to find a way to disable these types from command line, or even submit a patch to gcc if such an option doesn't exist. Speaking of gcc extensions: does --std=c99 fix things? |
If not, we can use the patch above. |
I am already compiling with --std=c99, and it doesn't seem to help, unfortunately. |
@jackdoerner did you try the patch linked above? |
No, do you need someone to verify that it works? I've been using WRT the patch, it looks like the right idea, but it seems like 128 bit floats should map to double, rather than regular float, no? Also, I'm not sure what would happen if you tried to link against code that actually used GCC's 128-bit float capabilities. I'd rather get an compile failure than a mysterious runtime error. |
Um, in the patch 128-bit floats get mapped to FLOAT128, which seems like the right type. But yeah, I thought you didn't manage to get this working. If the patch works for you, I'll apply it here. |
Oh, hey, you're right. I misread that I guess. I'll give it a try sometime soon and report. As an additional thought: there is a similar-but-not-necessarily-identical problem with 128-bit integer support that maybe could be solved in a similar way. Some of my code actually uses 128 bit integers, and thus far my solution has been to hide them from obliv-c via indirection. |
Re 128-bit ints. Make a patch, don't break anything else, and I shall upload. Btw, obliv-versions of 128 bit integers, or just the native ones? |
Yes, but then |
Removed `math.h` since it causes issues when compiling. [Discussion online](samee#48) proposes some solutions, but none seemed to work (at least in a Docker container running Ubuntu 20.04).
Removed `math.h` since it causes issues when compiling. [Discussion online](samee#48) proposes some solutions, but none seemed to work (at least in a Docker container running Ubuntu 20.04).
Removed `math.h` since it causes issues when compiling. [Discussion online](samee#48) proposes some solutions, but none seemed to work (at least in a Docker container running Ubuntu 20.04).
With glibc 2.26-5, I get the following error when compiling any Obliv-C code that includes math.h:
Any idea where this error could come from? Downgrading glibc works as a workaround, and so does
declaring all math.h functions as
extern
when compiling with Obliv-C, but apart from that I haven't had any success debugging this issue.For reference, that's my mathcalls-helper-functions.h.
The text was updated successfully, but these errors were encountered: