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

Build fails on PowerPC (ppc32) almost immediately on encoded_s2shape_index.cc #315

Closed
barracuda156 opened this issue Apr 27, 2023 · 34 comments

Comments

@barracuda156
Copy link

Unfortunately, there is no meaningful error output, it just fails:

[  3%] Building CXX object CMakeFiles/s2.dir/src/s2/encoded_s2shape_index.cc.o
/opt/local/bin/g++-mp-12 -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/opt/local/libexec/openssl11/include -I/opt/local/var/macports/build/_opt_PPCRosettaPorts_math_s2/s2/work/s2geometry-0.10.0/src -isystem /opt/local/include -pipe -I/opt/local/libexec/openssl11/include -Os -mone-byte-bool -DNDEBUG -I/opt/local/libexec/openssl11/include -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14 -arch ppc -mmacosx-version-min=10.6 -fPIC   -Wno-attributes -Wno-deprecated-declarations -MD -MT CMakeFiles/s2.dir/src/s2/encoded_s2shape_index.cc.o -MF CMakeFiles/s2.dir/src/s2/encoded_s2shape_index.cc.o.d -o CMakeFiles/s2.dir/src/s2/encoded_s2shape_index.cc.o -c /opt/local/var/macports/build/_opt_PPCRosettaPorts_math_s2/s2/work/s2geometry-0.10.0/src/s2/encoded_s2shape_index.cc
make[2]: *** [CMakeFiles/s2.dir/src/s2/encoded_s2shape_index.cc.o] Error 1

Here I use external abseil, but same story when I tried to build R-s2 (with bundled abseil), build immediately fails when begins compiling s2: r-spatial/s2#235

Something is very wrong in some basic settings or assumptions. It should not fail this way, even if Big endian is not propertly supported down the road.

@jmr Any thoughts what may be failing?

P. S. -mone-byte-bool is passed to bypass broken static asserts in endian.h – they assume 1 byte bool, yet on Darwin ppc32 bool is 4 bytes.

@jmr
Copy link
Member

jmr commented Apr 27, 2023

This is a gcc bug, right? Does it work with gcc 13 or clang?

Also try make -k to see which targets fail. (Probably most, since it only got 3% of the way through.)

Pick a small target and start commenting parts out until you have a minimal example. Then you can file a gcc bug report.

@barracuda156
Copy link
Author

@jmr I will try. Clang is not an option, it is broken for Darwin ppc (never worked), but I can try an array of GCC versions.

At the moment I suspect it is rather either some wrong assumptions made implicitly which are wrong for the given arch, or wrong assembler insns creeping in from abseil. If only I could get exact output on failure, it will probably be fixable.
But it is not impossible for GCC to have a bug either, of course.

@jmr
Copy link
Member

jmr commented Apr 27, 2023

Is the CMake-generated Makefile suppressing some output? Do you see more if you just run the gcc command yourself?

@barracuda156
Copy link
Author

Is the CMake-generated Makefile suppressing some output? Do you see more if you just run the gcc command yourself?

GCC on its own literally gives zero output – as if command completes, but nothing is generated. Tried also gcc11, same result.

I can get a pre-processed source though, if that is helpful (with -v -save-temps):
encoded_s2shape_index.cc.ii.zip

@jmr
Copy link
Member

jmr commented Apr 28, 2023

gcc should either produce the .o file and return 0, or give a useful failure message and return non-0. Silently returning non-zero with no output and no diagnostic messages sounds like a gcc bug to me.

Here's what I would suggest:

  1. Use make -k to see which files fail and which succeed. Try to find a find a short failure, like maybe s2debug.cc or s1angle.cc or something like that.
  2. Compile with g++ --verbose to see if you can get more info about what step is failing. Compare a working target to a broken one.
  3. Start deleting parts of the input file to narrow down the cause.
  4. When you have a minimal reproduction of the bug, report to gcc: https://gcc.gnu.org/bugs/

I can get a pre-processed source though, if that is helpful (with -v -save-temps):
encoded_s2shape_index.cc.ii.zip

@barracuda156
Copy link
Author

@jmr Oh well, I should have tried running it on PPC natively. I got meaningful output there:

/opt/local/bin/g++-mp-12 -std=gnu++11 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../src -DSTRICT_R_HEADERS -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/wk/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include   -DOPENSSL_SUPPRESS_DEPRECATED -DIS_BIG_ENDIAN -pthread -fPIC  -pipe -Os -arch ppc  -c s2-accessors.cpp -o s2-accessors.o
In file included from ../src/s2/s2cell_id.h:36,
                 from ../src/s2/mutable_s2shape_index.h:34,
                 from ../src/s2/s2loop.h:31,
                 from ../src/s2/s2convex_hull_query.h:27,
                 from s2geography/accessors-geog.h:4,
                 from s2geography.h:4,
                 from geography.h:7,
                 from geography-operator.h:7,
                 from s2-accessors.cpp:2:
../src/s2/util/bits/bits.h: In static member function 'static uint8 Bits::ReverseBits8(unsigned char)':
../src/s2/util/bits/bits.h:510:36: warning: overflow in conversion from 'long long int' to 'long int' changes value from '4557147201846524216' to '993671480' [-Woverflow]
  510 |   uint64 result = __builtin_bpermd(0x3f3e3d3c3b3a3938, temp);
      |                                    ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h: In static member function 'static uint32 Bits::ReverseBits32(uint32)':
../src/s2/util/bits/bits.h:527:38: warning: overflow in conversion from 'long long int' to 'long int' changes value from '4557147201846524216' to '993671480' [-Woverflow]
  527 |   uint64 result_0 = __builtin_bpermd(0x3f3e3d3c3b3a3938, temp) << 24;
      |                                      ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:528:38: warning: overflow in conversion from 'long long int' to 'long int' changes value from '3978425819141910832' to '858927408' [-Woverflow]
  528 |   uint64 result_1 = __builtin_bpermd(0x3736353433323130, temp) << 16;
      |                                      ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:529:38: warning: overflow in conversion from 'long long int' to 'long int' changes value from '3399704436437297448' to '724183336' [-Woverflow]
  529 |   uint64 result_2 = __builtin_bpermd(0x2f2e2d2c2b2a2928, temp) << 8;
      |                                      ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:530:38: warning: overflow in conversion from 'long long int' to 'long int' changes value from '2820983053732684064' to '589439264' [-Woverflow]
  530 |   uint64 result_3 = __builtin_bpermd(0x2726252423222120, temp);
      |                                      ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h: In static member function 'static uint64 Bits::ReverseBits64(uint64)':
../src/s2/util/bits/bits.h:546:40: warning: overflow in conversion from 'long long int' to 'long int' changes value from '4557147201846524216' to '993671480' [-Woverflow]
  546 |   uint64 result_lo0 = __builtin_bpermd(0x3f3e3d3c3b3a3938, n) << 56;
      |                                        ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:546:63: warning: left shift count >= width of type [-Wshift-count-overflow]
  546 |   uint64 result_lo0 = __builtin_bpermd(0x3f3e3d3c3b3a3938, n) << 56;
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
../src/s2/util/bits/bits.h:547:40: warning: overflow in conversion from 'long long int' to 'long int' changes value from '3978425819141910832' to '858927408' [-Woverflow]
  547 |   uint64 result_lo1 = __builtin_bpermd(0x3736353433323130, n) << 48;
      |                                        ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:547:63: warning: left shift count >= width of type [-Wshift-count-overflow]
  547 |   uint64 result_lo1 = __builtin_bpermd(0x3736353433323130, n) << 48;
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
../src/s2/util/bits/bits.h:548:40: warning: overflow in conversion from 'long long int' to 'long int' changes value from '3399704436437297448' to '724183336' [-Woverflow]
  548 |   uint64 result_lo2 = __builtin_bpermd(0x2f2e2d2c2b2a2928, n) << 40;
      |                                        ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:548:63: warning: left shift count >= width of type [-Wshift-count-overflow]
  548 |   uint64 result_lo2 = __builtin_bpermd(0x2f2e2d2c2b2a2928, n) << 40;
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
../src/s2/util/bits/bits.h:549:40: warning: overflow in conversion from 'long long int' to 'long int' changes value from '2820983053732684064' to '589439264' [-Woverflow]
  549 |   uint64 result_lo3 = __builtin_bpermd(0x2726252423222120, n) << 32;
      |                                        ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:549:63: warning: left shift count >= width of type [-Wshift-count-overflow]
  549 |   uint64 result_lo3 = __builtin_bpermd(0x2726252423222120, n) << 32;
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
../src/s2/util/bits/bits.h:550:40: warning: overflow in conversion from 'long long int' to 'long int' changes value from '2242261671028070680' to '454695192' [-Woverflow]
  550 |   uint64 result_hi0 = __builtin_bpermd(0x1f1e1d1c1b1a1918, n) << 24;
      |                                        ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:551:40: warning: overflow in conversion from 'long long int' to 'long int' changes value from '1663540288323457296' to '319951120' [-Woverflow]
  551 |   uint64 result_hi1 = __builtin_bpermd(0x1716151413121110, n) << 16;
      |                                        ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:552:40: warning: overflow in conversion from 'long long int' to 'long int' changes value from '1084818905618843912' to '185207048' [-Woverflow]
  552 |   uint64 result_hi2 = __builtin_bpermd(0x0f0e0d0c0b0a0908, n) << 8;
      |                                        ^~~~~~~~~~~~~~~~~~
../src/s2/util/bits/bits.h:553:40: warning: overflow in conversion from 'long long int' to 'long int' changes value from '506097522914230528' to '50462976' [-Woverflow]
  553 |   uint64 result_hi3 = __builtin_bpermd(0x0706050403020100, n);
      |                                        ^~~~~~~~~~~~~~~~~~
In file included from ../src/s2/util/coding/coder.h:33,
                 from ../src/s2/s2cell_id.h:37:
../src/s2/util/endian/endian.h: In static member function 'static T LittleEndian::Load(const char*) [with T = bool]':
../src/s2/util/endian/endian.h:773:30: error: static assertion failed: Unexpected sizeof(bool)
  773 |   static_assert(sizeof(bool) == 1, "Unexpected sizeof(bool)");
      |                 ~~~~~~~~~~~~~^~~~
../src/s2/util/endian/endian.h:773:30: note: the comparison reduces to '(4 == 1)'
../src/s2/util/endian/endian.h: In static member function 'static void LittleEndian::Store(T, char*) [with T = bool]':
../src/s2/util/endian/endian.h:779:30: error: static assertion failed: Unexpected sizeof(bool)
  779 |   static_assert(sizeof(bool) == 1, "Unexpected sizeof(bool)");
      |                 ~~~~~~~~~~~~~^~~~
../src/s2/util/endian/endian.h:779:30: note: the comparison reduces to '(4 == 1)'
../src/s2/util/endian/endian.h: In static member function 'static T BigEndian::Load(const char*) [with T = bool]':
../src/s2/util/endian/endian.h:785:30: error: static assertion failed: Unexpected sizeof(bool)
  785 |   static_assert(sizeof(bool) == 1, "Unexpected sizeof(bool)");
      |                 ~~~~~~~~~~~~~^~~~
../src/s2/util/endian/endian.h:785:30: note: the comparison reduces to '(4 == 1)'
../src/s2/util/endian/endian.h: In static member function 'static void BigEndian::Store(T, char*) [with T = bool]':
../src/s2/util/endian/endian.h:791:30: error: static assertion failed: Unexpected sizeof(bool)
  791 |   static_assert(sizeof(bool) == 1, "Unexpected sizeof(bool)");
      |                 ~~~~~~~~~~~~~^~~~
../src/s2/util/endian/endian.h:791:30: note: the comparison reduces to '(4 == 1)'
make: *** [s2-accessors.o] Error 1
ERROR: compilation failed for package ‘s2’

So to begin with, wrong assumption about size of bool – this is where is fails.

@barracuda156
Copy link
Author

barracuda156 commented May 18, 2023

@jmr UPD. Ah, this is my mistake with __builtin_bpermd in fact, I accidentally added __ppc__ there without checking for ISA support.

@jmr
Copy link
Member

jmr commented May 18, 2023

../src/s2/util/bits/bits.h: In static member function 'static uint8 Bits::ReverseBits8(unsigned char)':
../src/s2/util/bits/bits.h:510:36: warning: overflow in conversion from 'long long int' to 'long int' changes value from '4557147201846524216' to '993671480' [-Woverflow]
  510 |   uint64 result = __builtin_bpermd(0x3f3e3d3c3b3a3938, temp);
      |                                    ^~~~~~~~~~~~~~~~~~

What version of s2geometry are you using? This code was deleted last year. Try HEAD.

https://github.com/google/s2geometry/blob/master/src/s2/util/bits/bits.h

It looks like it's been a while since 0.10.0, so I should do another release soon.

Anyway, that's just a warning.

In file included from ../src/s2/util/coding/coder.h:33,
                 from ../src/s2/s2cell_id.h:37:
../src/s2/util/endian/endian.h: In static member function 'static T LittleEndian::Load(const char*) [with T = bool]':
../src/s2/util/endian/endian.h:773:30: error: static assertion failed: Unexpected sizeof(bool)
  773 |   static_assert(sizeof(bool) == 1, "Unexpected sizeof(bool)");
      |                 ~~~~~~~~~~~~~^~~~

I thought you were compiling with -mone-byte-bool. Can you try again using that?

@barracuda156
Copy link
Author

@jmr I am building now the version which is used with R – yes, I have seen it is quite outdated. I am not sure if API changed, so swapping a newer version into the R package may not work correctly, I am afraid.

I can do a standalone build later on. After all, why not add s2geometry port to Macports :)

P. S. Overflow warning are gone, that builtin was an unintended result of my own patch. I dropped it now and rebuilding. So far looks good, though it takes forever to build.

@barracuda156
Copy link
Author

For -mone-byte-bool, is it safe to use? GCC documentation has a warning that resulting code may not be compatible. We can just as well disable static asserts for Darwin PPC, I guess.

@barracuda156
Copy link
Author

@jmr A quick update – the build just completed, linking failed, because -latomic is not passed. I will add it now manually and run tests. Let’s see if it actually works and not just builds.

@jmr
Copy link
Member

jmr commented May 18, 2023

For -mone-byte-bool, is it safe to use? GCC documentation has a warning that resulting code may not be compatible.

It definitely is risky. If you call any other code with a bool argument that's compiled without the option, it won't work.

We can just as well disable static asserts for Darwin PPC, I guess.

Try wrapping all the functions with the static assert in #ifndef __PPC__ or whatever the right thing is. I don't think the bool versions are needed.

@jmr
Copy link
Member

jmr commented May 18, 2023

Oh well, I should have tried running it on PPC natively.

You were cross-compiling before? Please report this (no output, no useful error) upstream as a bug. It certainly wasted a bit of everyone's time.

@barracuda156
Copy link
Author

Oh well, I should have tried running it on PPC natively.

You were cross-compiling before? Please report this (no output, no useful error) upstream as a bug. It certainly wasted a bit of everyone's time.

Not cross-, but in Rosetta (so OS emulates the arch, binaries run natively). But super-weird how it behaved there. I test numerous ports in Rosetta (because no G5 laptop, I cannot carry a PowerMac around, heh), GCC is normally sane there.

@barracuda156
Copy link
Author

For -mone-byte-bool, is it safe to use? GCC documentation has a warning that resulting code may not be compatible.

It definitely is risky. If you call any other code with a bool argument that's compiled without the option, it won't work.

We can just as well disable static asserts for Darwin PPC, I guess.

Try wrapping all the functions with the static assert in #ifndef __PPC__ or whatever the right thing is. I don't think the bool versions are needed.

Yes, I already did that. Perhaps we can add a fix to the master? Correct macro with be:

#if !(defined(__MACH__) && defined(__ppc__))

Or __APPLE__ instead of __MACH__.

4-byte bool is a specificity of Darwin 32-bit ABI, not PowerPC as such. So we do not need to disable it for Linux, for example.

@barracuda156
Copy link
Author

@jmr Ran the tests (it is still an older version from R package), result are decent:

  Running ‘testthat.R’
 ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
   1. └─s2:::expect_wkt_equal(...) at test-s2-transformers.R:180:2
   2.   └─testthat::expect_equal(...)
  ── Failure ('test-s2-transformers.R:476:3'): s2_buffer() works ─────────────────
  abs(y - x) < epsilon is not TRUE
  
  `actual`:   FALSE
  `expected`: TRUE 
  Backtrace:
      ▆
   1. └─s2:::expect_near(s2_area(ply, radius = 1), 4 * pi/2, epsilon = 0.1) at test-s2-transformers.R:476:2
   2.   └─testthat::expect_true(abs(y - x) < epsilon)
  
  [ FAIL 3 | WARN 0 | SKIP 0 | PASS 1072 ]

Perhaps precision threshold are too strict somewhere.

@jmr
Copy link
Member

jmr commented May 18, 2023

I don't know anything about the R package, so I can't help you there.

Does the s2geometry test suite pass?

@barracuda156
Copy link
Author

I don't know anything about the R package, so I can't help you there.

Does the s2geometry test suite pass?

Let try building it.

(By the way, looking now at my portfile for s2geometry which I used, seems that I tried passing -mone-byte-bool and it did not help. Maybe something else also failed in Rosetta. Anyway, I will try building it on a PowerMac now.)

@barracuda156
Copy link
Author

@jmr Could you advise me how to fix this?

[ 46%] Building CXX object CMakeFiles/s2.dir/src/s2/s2latlng.cc.o
/opt/local/bin/g++-mp-12 -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/opt/local/libexec/openssl11/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-0.10.0/src -isystem /opt/local/include -pipe -I/opt/local/libexec/openssl11/include -Os -DNDEBUG -I/opt/local/libexec/openssl11/include -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14 -arch ppc -mmacosx-version-min=10.6 -fPIC   -Wno-attributes -Wno-deprecated-declarations -MD -MT CMakeFiles/s2.dir/src/s2/s2latlng.cc.o -MF CMakeFiles/s2.dir/src/s2/s2latlng.cc.o.d -o CMakeFiles/s2.dir/src/s2/s2latlng.cc.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-0.10.0/src/s2/s2latlng.cc
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-0.10.0/src/s2/s2edge_crossings.cc: In instantiation of 'bool S2::internal::GetStableCrossProd(const Vector3<T>&, const Vector3<T>&, Vector3<T>*) [with T = long double]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-0.10.0/src/s2/s2edge_crossings.cc:127:54:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-0.10.0/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));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-0.10.0/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]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-0.10.0/src/s2/s2edge_crossings.cc:485:28:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-0.10.0/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[2]: *** [CMakeFiles/s2.dir/src/s2/s2edge_crossings.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/build'
make[1]: *** [CMakeFiles/s2.dir/all] Error 2

@jmr
Copy link
Member

jmr commented May 18, 2023

Change constexpr to const. #279

@barracuda156
Copy link
Author

barracuda156 commented May 18, 2023

@jmr Thank you.

UPD. Gtest error fixed, unrelated of course to s2, running the build with tests enabled now.

@barracuda156
Copy link
Author

Change constexpr to const. #279

P. S. Only lines with square root? There are 3–4 instances. I need to make a correct patch for this.

@jmr
Copy link
Member

jmr commented May 18, 2023

Wherever you're getting an error. You may be able to look at what the Debian patches did.

@barracuda156
Copy link
Author

@jmr Almost built, but failing on this:

[ 98%] Built target s2text_format_test
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/s2point.h: At global scope:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/s2point.h:155:27: error: 'Hash' in namespace 'absl' does not name a template type
  155 | using S2PointHash = absl::Hash<S2Point>;
      |                           ^~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/value_lexicon_test.cc: In member function 'virtual void ValueLexicon_FloatEquality_Test::TestBody()':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/value_lexicon_test.cc:65:25: error: 'S2PointHash' was not declared in this scope; did you mean 'S2Point'?
   65 |   ValueLexicon<S2Point, S2PointHash> lex;
      |                         ^~~~~~~~~~~
      |                         S2Point
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/value_lexicon_test.cc:65:36: error: template argument 2 is invalid
   65 |   ValueLexicon<S2Point, S2PointHash> lex;
      |                                    ^
In file included from /opt/local/src/googletest/include/gtest/gtest.h:67,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/value_lexicon_test.cc:27:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/value_lexicon_test.cc:72:20: error: request for member 'Add' in 'lex', which is of non-class type 'int'
   72 |   EXPECT_EQ(0, lex.Add(a));
      |                    ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/value_lexicon_test.cc:73:20: error: request for member 'Add' in 'lex', which is of non-class type 'int'
   73 |   EXPECT_EQ(0, lex.Add(b));
      |                    ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/value_lexicon_test.cc:74:20: error: request for member 'Add' in 'lex', which is of non-class type 'int'
   74 |   EXPECT_EQ(0, lex.Add(c));
      |                    ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/value_lexicon_test.cc:75:20: error: request for member 'size' in 'lex', which is of non-class type 'int'
   75 |   EXPECT_EQ(1, lex.size());
      |                    ^~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/s2geometry-7773d518b1f29caa1c2045eb66ec519e025be108/src/s2/value_lexicon_test.cc:76:32: error: request for member 'value' in 'lex', which is of non-class type 'int'
   76 |   EXPECT_EQ(0, memcmp(&a, &lex.value(0), sizeof(a)));
      |                                ^~~~~
make[2]: *** [CMakeFiles/value_lexicon_test.dir/src/s2/value_lexicon_test.cc.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_s2geometry/s2geometry/work/build'
make[1]: *** [CMakeFiles/value_lexicon_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 98%] Linking CXX executable s2wrapped_shape_test

@jmr
Copy link
Member

jmr commented May 18, 2023

What version of abseil-cpp are you using and what's in your absl/hash/hash.h? There should be an absl::Hash definition like https://github.com/abseil/abseil-cpp/blob/07e8b2a14d340984ff72fbea1181cc1469a4277a/absl/hash/hash.h#L250, but from the error message, it seems there's not.

@barracuda156
Copy link
Author

barracuda156 commented May 18, 2023

@jmr
Copy link
Member

jmr commented May 18, 2023

Can you link the output of gcc -E?

@barracuda156
Copy link
Author

Sorry, do you mean just like this? It wants inputs:

36-220% /opt/local/bin/gcc-mp-12 -E
gcc-mp-12: fatal error: no input files
compilation terminated.

@jmr
Copy link
Member

jmr commented May 18, 2023

Sorry, I meant find the full gcc command that failed, and run it with -E so I can look at the preprocessed output.

@barracuda156
Copy link
Author

@jmr It seemed that -E did nothing or I could not find a result, but I got preprocessed source with -v --save-temps:
value_lexicon_test.cc.ii.zip

@jmr
Copy link
Member

jmr commented May 18, 2023

g++ -std=c++14 value_lexicon_test.cc.ii gave me some more errors with a clue to what the real problem is. (Maybe the error is better since my g++ is actually clang++.)

Try deleting the absl::hash_internal::Hash declaration from value_lexicon.h. That looks like it shouldn't be there.

namespace absl {
namespace hash_internal {
template <typename T>
struct Hash;
} // namespace hash_internal
} // namespace absl

jmr added a commit to jmr/s2geometry that referenced this issue May 18, 2023
This looks like it was added by include-what-you-use and may be causing a Darwin PPC compilation error.

google#315 (comment)
@barracuda156
Copy link
Author

@jmr So the build with test is fine now. Running tests still needs to be fixed on my end, since dylibs are not picked by tests’ binaries. Setting DYLD_LIBRARY_PATH path worked for s2 lib, but Gmock is a bit of a mess. Will return to this in a day. (We need either to fix tests with Macports Gtest/Gmock, or otherwise make it build its own version just to run tests, which won’t be a great choice, admittedly.)

@barracuda156
Copy link
Author

I don't know anything about the R package, so I can't help you there.

Does the s2geometry test suite pass?

@jmr 85% passes: #316
Hopefully we can fix it.

@jmr
Copy link
Member

jmr commented Apr 5, 2024

It looks like this is fixed and the current PPC32 failures are tracked in in #316, so closing.

@jmr jmr closed this as completed Apr 5, 2024
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