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

Use of _FPU_EXTENDED/_FPU_DOUBLE is x86/x87-specific #33

Open
risicle opened this issue Nov 14, 2021 · 1 comment
Open

Use of _FPU_EXTENDED/_FPU_DOUBLE is x86/x87-specific #33

risicle opened this issue Nov 14, 2021 · 1 comment

Comments

@risicle
Copy link

risicle commented Nov 14, 2021

Hi,

Main.cc tries to disable the x87 extended precision mode @

newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE;

But this is platform-specific and compilation fails on aarch64 linux:

/build/source/src/monosat/Main.cc:550:27: error: '_FPU_EXTENDED' was not declared in this scope
  550 |         newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
      |                           ^~~~~~~~~~~~~
/build/source/src/monosat/Main.cc:550:44: error: '_FPU_DOUBLE' was not declared in this scope
  550 |         newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
      |                                            ^~~~~~~~~~~

Full build log: https://hydra.nixos.org/log/gdvq3inxzcyinf032y7vwrdm1lncnw4z-monosat-1.8.0.drv

I've worked around it by patching it out, but it would be better to detect this somehow. Platforms like aarch64 do seem to have an fpu_control.h, possibly for backward compatibility, but they don't seem to have _FPU_EXTENDED or _FPU_DOUBLE defined. So possibly you could actually check for those being defined to enable/disable this block.

Although documentation around this suggests that the C99 standard fenv.h should be used these days in preference to use of fpu_control.h at all, so.. 🤷

@sambayless
Copy link
Owner

I see that recent versions of minisat guard this setting the way you've suggested:

https://github.com/niklasso/minisat/blob/master/minisat/utils/System.cc#L100

#if defined(__linux__) && defined(_FPU_EXTENDED) && defined(_FPU_DOUBLE) && defined(_FPU_GETCW)

I should be able to update to use the same checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants