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

fails to build on on ppc64el #279

Closed
spaetz opened this issue Nov 15, 2022 · 13 comments
Closed

fails to build on on ppc64el #279

spaetz opened this issue Nov 15, 2022 · 13 comments

Comments

@spaetz
Copy link

spaetz commented Nov 15, 2022

Hi,
s2geometry is in Debian, great. However, it fails to build on 2 architectures, and I have no clue what could be wrong, or how to fix it. (This is tag/v0.10.0, BTW)

The Debian issue is at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023961 pointing to the build protocol at:
https://buildd.debian.org/status/fetch.php?pkg=s2geometry&arch=ppc64el&ver=0.10.0-2&stamp=1667081576&raw=0

The relevant bit seems to be:

/<<PKGBUILDDIR>>/src/s2/s2edge_crossings.cc: In instantiation of ‘bool S2::internal::GetStableCrossProd(const Vector3<T>&, const Vector3<T>&, Vector3<T>*) [with T = long double]’:
/<<PKGBUILDDIR>>/src/s2/s2edge_crossings.cc:127:54:   required from here
/<<PKGBUILDDIR>>/src/s2/s2edge_crossings.cc:115:31: error: ‘(6.15348059642740421245081038903225e-15l / 5.40431955284459475358983848622456e+16l)’ is not a constant expression
  115 |       (32 * kSqrt3 * DBL_ERR) /
      |       ~~~~~~~~~~~~~~~~~~~~~~~~^
  116 |       (kRobustCrossProdError.radians() / T_ERR - (1 + 2 * kSqrt3));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/<<PKGBUILDDIR>>/src/s2/s2edge_crossings.cc: In instantiation of ‘bool S2::GetIntersectionSimple(const Vector3<T>&, const Vector3<T>&, const Vector3<T>&, const Vector3<T>&, Vector3<T>*) [with T = long double]’:
/<<PKGBUILDDIR>>/src/s2/s2edge_crossings.cc:485:28:   required from here
/<<PKGBUILDDIR>>/src/s2/s2edge_crossings.cc:458:10: error: ‘(1.2e+1l / 7.20575940379279305358983848622456e+16l)’ is not a constant expression
  458 |       12 / (kIntersectionError.radians() / T_ERR - (2 + 2 * kSqrt3));
      |       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [CMakeFiles/s2.dir/build.make:653: CMakeFiles/s2.dir/src/s2/s2edge_crossings.cc.o] Error 1

@spaetz
Copy link
Author

spaetz commented Nov 15, 2022

‘(6.15348059642740421245081038903225e-15l / 5.40431955284459475358983848622456e+16l)’ is not a constant expression

?

@spaetz
Copy link
Author

spaetz commented Nov 15, 2022

Second issue on s390x is a build failure that was fixed 6 months ago in s2geometry by: 7a40135
so that one is fine and fixed.

@spaetz spaetz changed the title fails to build on on ppc64el and s390x fails to build on on ppc64el Nov 15, 2022
@jmr
Copy link
Member

jmr commented Nov 16, 2022

This looks like a compiler bug or quality-of-implementation issue. From a bit of playing with godbolt, long double constexprs don't work with * or /, but work with + and -.

https://godbolt.org/z/WYz5fY538

This works fine on everything but PPC that I tried. It also works with PPC clang, but not PPC gcc. Could you report this to gcc and see what they say?

For reference, here's the real code:

constexpr T kMinNorm =

@spaetz
Copy link
Author

spaetz commented Nov 16, 2022 via email

@spaetz
Copy link
Author

spaetz commented Nov 18, 2022

Just for completeness' sake: Upstream bug filed at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107745

Let's see what gcc makes of it.
(and sorry, I left your "I" in there, making it seem as if I did all the analysis, I don't intent to take your credit)

UPDATE: and has been resolved duplicate of a 17 year old bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19779

@jmr
Copy link
Member

jmr commented May 18, 2023

Just wondering, does clang support this architecture, and does the code compile without workarounds with it? @spaetz

@spaetz
Copy link
Author

spaetz commented May 18, 2023

Sorry, I don't even own that architecture, just reporting on what the Debian build system does which attempts to build on basically all arches. I know next to nothing about clang, I am embarrassed to admit.

@barracuda156
Copy link

@jmr Until/unless GCC addresses that, maybe we could make a fix in the master?

@jmr
Copy link
Member

jmr commented Feb 19, 2024

Yes, we can do that since it's an easy work-around. Could you file another bug with gcc and make it clear that this is fails-to-compile-valid, not missed-optimization.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107745#c4 mentions "powerpc64le-linux is phasing that out and switching to IEEE quad instead". Are you seeing this on Linux, OS X Snow Leopard (~10 years past EOL), or something else?

@barracuda156
Copy link

@jmr

Yes, we can do that since it's an easy work-around. Could you file another bug with gcc and make it clear that this is fails-to-compile-valid, not missed-optimization.

The original ticket tracks the matter, and had some responses today: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19779

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107745#c4 mentions "powerpc64le-linux is phasing that out and switching to IEEE quad instead". Are you seeing this on Linux, OS X Snow Leopard (~10 years past EOL), or something else?

I get this on OS X, yeah. But the same gonna be the case on OpenBSD, for example, etc.

@jmr
Copy link
Member

jmr commented Apr 13, 2024

Worked around the gcc bug in 84bfd2c.

@jmr jmr closed this as completed Apr 13, 2024
@barracuda156
Copy link

Worked around the gcc bug in 84bfd2c.

@jmr Wow, that’s a massive commit! Thank you, I will try it.

BTW, are we to expect any changes for Big-endian (for better or worse)?

@jmr
Copy link
Member

jmr commented Apr 16, 2024

See #316 (comment) for BE status. No change expected.

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

3 participants