equinor / segyio

Fast Python library for SEGY files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build error with glibc 2.34

cpaelzer opened this issue · comments

Hi,
as reported in Ubuntu here https://bugs.launchpad.net/debian/+source/segyio/+bug/1951658 segyio fails to build with a newer glibc.

In file included from /usr/include/signal.h:328,
                 from /<<PKGBUILDDIR>>/external/catch2/catch/catch.hpp:4855,
                 from /<<PKGBUILDDIR>>/lib/test/testsuite.cpp:2:
/<<PKGBUILDDIR>>/external/catch2/catch/catch.hpp:7431:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
 7431 | constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
      | ^~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /<<PKGBUILDDIR>>/external/catch2/catch/catch.hpp:4855,
                 from /<<PKGBUILDDIR>>/lib/test/testsuite.cpp:2:
/usr/include/unistd.h:640:17: note: ‘long int sysconf(int)’ declared here
  640 | extern long int sysconf (int __name) __THROW;
      | ^~~~~~~
In file included from /<<PKGBUILDDIR>>/lib/test/testsuite.cpp:2:
/<<PKGBUILDDIR>>/external/catch2/catch/catch.hpp:7490:45: error: size of array ‘altStackMem’ is not an integral constant-expression
 7490 | char FatalConditionHandler::altStackMem[sigStackSize] = {};
      | ^~~~~~~~~~~~

It tries to use MINSIGSTKSZ as part of a constant expression, but in glibc 2.34 this now expands to a call to sysconf().
Commit: https://sourceware.org/git/?p=glibc.git;a=commit;h=28d07380c2ae5786e242be336ccc1c9e3111f3fa
News: https://sourceware.org/git/?p=glibc.git;a=blame;f=NEWS;hb=f9be44c7e6d90cb1fe3a0fbe3cc299ac783f0be8#l12

This line is still present as of 1.9.8 here
https://github.com/equinor/segyio/blob/master/external/catch2/catch/catch.hpp#L7431

Therefore this reproduces if you use e.g. a Jammy (22.04) system and run your build steps
=> https://cdimage.ubuntu.com/daily-live/current/

git clone https://github.com/equinor/segyio
mkdir segyio/build
cd segyio/build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
make
...
/root/segyio/external/catch2/catch/catch.hpp:7431:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
 7431 |     constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
...

I realized that this is an embedded source, therefore this is actually a derivative of this issue
=> catchorg/Catch2#2178
And thereby this fix
=> woodard/libabigail@8ae8dcb

Maybe you just need to update that file from catch2?

Thank's for reporting, and sorry for the delayed answer. Catch have been upgraded to v2.13.9