s2 icon indicating copy to clipboard operation
s2 copied to clipboard

s2 fails to install on centos7/gcc 4.8

Open paleolimbot opened this issue 1 year ago • 4 comments

Following up on #138 with its own issue since it's a different underlying cause. It seems that the version of Abseil we're using doesn't support gcc 4.8 even though it claims to still support C++11. I seem to remember that gcc's C++11 support is incomplete anyway.

Reprex:

# docker run --rm -it ghcr.io/apache/arrow-nanoarrow:centos7-amd64
yum install openssl-devel
R -e 'install.packages("s2")'

With failure:

In file included from ../src/absl/base/casts.h:38:0, from ../src/absl/base/internal/endian.h:22, from ../src/absl/strings/internal/cord_internal.h:26, from ../src/absl/strings/cord_analysis.h:22, from absl/strings/cord_analysis.cc:15: ../src/absl/meta/type_traits.h:55:53: error: ‘max_align_t’ is not a member of ‘std’ #define ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT alignof(std::max_align_t) ^ ../src/absl/container/internal/inlined_vector.h:129:40: note: in expansion of macro ‘ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT’ (alignof(ValueType<A>) > ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT)> ^ ../src/absl/meta/type_traits.h:55:53: note: suggested alternative: #define ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT alignof(std::max_align_t) ^ ../src/absl/container/internal/inlined_vector.h:129:40: note: in expansion of macro ‘ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT’ (alignof(ValueType<A>) > ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT)> ^ In file included from /usr/include/c++/4.8.2/cstddef:42:0, from ../src/absl/strings/cord_analysis.h:18, from absl/strings/cord_analysis.cc:15: /usr/lib/gcc/aarch64-redhat-linux/4.8.5/include/stddef.h:425:3: note: ‘max_align_t’ } max_align_t; ^ In file included from ../src/absl/container/inlined_vector.h:53:0, from absl/strings/cord_analysis.cc:22: ../src/absl/container/internal/inlined_vector.h: In destructor ‘absl::lts_20220623::inlined_vector_internal::AllocationTransaction<A>::~AllocationTransaction()’: ../src/absl/container/internal/inlined_vector.h:224:22: error: template argument 2 is invalid MallocAdapter<A>::Deallocate(GetAllocator(), GetData(), GetCapacity()); ^ ../src/absl/container/internal/inlined_vector.h:224:35: error: invalid type in declaration before ‘(’ token MallocAdapter<A>::Deallocate(GetAllocator(), GetData(), GetCapacity()); ^ ../src/absl/container/internal/inlined_vector.h:224:76: error: expression list treated as compound expression in initializer [-fpermissive] MallocAdapter<A>::Deallocate(GetAllocator(), GetData(), GetCapacity()); ^ ../src/absl/container/internal/inlined_vector.h: In member function ‘absl::lts_20220623::inlined_vector_internal::Pointer<A> absl::lts_20220623::inlined_vector_internal::AllocationTransaction<A>::Allocate(absl::lts_20220623::inlined_vector_internal::SizeType<A>)’: ../src/absl/container/internal/inlined_vector.h:239:24: error: template argument 2 is invalid MallocAdapter<A>::Allocate(GetAllocator(), requested_capacity); ^ ../src/absl/container/internal/inlined_vector.h: In member function ‘void absl::lts_20220623::inlined_vector_internal::Storage<T, N, A>::DeallocateIfAllocated(’: ../src/absl/container/internal/inlined_vector.h:452:22: error: template argument 2 is invalid MallocAdapter<A>::Deallocate(GetAllocator(), GetAllocatedData(), ^ ../src/absl/container/internal/inlined_vector.h:452:35: error: invalid type in declaration before ‘(’ token MallocAdapter<A>::Deallocate(GetAllocator(), GetAllocatedData(), ^ ../src/absl/container/internal/inlined_vector.h:453:58: error: expression list treated as compound expression in initializer [-fpermissive] GetAllocatedCapacity()); ^ ../src/absl/container/internal/inlined_vector.h: In member function ‘void absl::lts_20220623::inlined_vector_internal::Storage<T, N, A>::InitFrom(const absl::lts_20220623::inlined_vector_internal::Storage<T, N, A>&)’: ../src/absl/container/internal/inlined_vector.h:505:24: error: template argument 2 is invalid MallocAdapter<A>::Allocate(GetAllocator(), requested_capacity); ^ ../src/absl/container/internal/inlined_vector.h: In member function ‘void absl::lts_20220623::inlined_vector_internal::Storage<T, N, A>::Initialize(ValueAdapter, absl::lts_20220623::inlined_vector_internal::SizeType<A>)’: ../src/absl/container/internal/inlined_vector.h:536:24: error: template argument 2 is invalid MallocAdapter<A>::Allocate(GetAllocator(), requested_capacity); ^ ../src/absl/container/internal/inlined_vector.h: In member function ‘void absl::lts_20220623::inlined_vector_internal::Storage<T, N, A>::ShrinkToFit()’: ../src/absl/container/internal/inlined_vector.h:871:18: error: template argument 2 is invalid MallocAdapter<A>::Deallocate(GetAllocator(), storage_view.data, ^ ../src/absl/container/internal/inlined_vector.h:871:31: error: invalid type in declaration before ‘(’ token MallocAdapter<A>::Deallocate(GetAllocator(), storage_view.data, ^ ../src/absl/container/internal/inlined_vector.h:872:53: error: expression list treated as compound expression in initializer [-fpermissive] storage_view.capacity); ^ make: *** [absl/strings/cord_analysis.o] Error 1 ERROR: compilation failed for package ‘s2’

  • removing ‘/usr/lib64/R/library/s2’

I had tried to maintain compatibility with centos7's default compiler but it is probably not feasible given that all new Abseil releases only support back to C++14.

A workaround is to install "devtoolset8" ( https://stackoverflow.com/questions/53310625/how-to-install-gcc8-using-devtoolset-8-gcc ), which will get you gcc 8.

paleolimbot avatar Jun 07 '23 12:06 paleolimbot

I can confirm that this works.

edzer avatar Jun 07 '23 13:06 edzer

@atisor73 I think your workaround might need to be: install devtoolset8 (if you have admin access), or alternatively, I think that Posit Package Manager provides centos7 builds for s2 https://packagemanager.posit.co/client/#/repos/2/packages/s2 .

paleolimbot avatar Jun 07 '23 14:06 paleolimbot

@edzer This frees us up to do drop gcc 4.8 support! Updating s2 + Abseil will be the next "s2 thing" that I do.

paleolimbot avatar Jun 07 '23 14:06 paleolimbot

This works great! s2 install now works. Still facing some issues installing sf, but they seem unrelated to the installation for s2. Thanks for all your help!

In case anyone else has this issue on red hat, the commands I had to use with rhel are slightly different, I was able to find them here. In particular, this line was crucial: sudo yum-config-manager --enable rhel-server-rhscl-7-rpms

atisor73 avatar Jun 07 '23 16:06 atisor73