equinor / segyio

Fast Python library for SEGY files.
Other
471 stars 213 forks source link

Build error with glibc 2.34 #520

Closed cpaelzer closed 1 year ago

cpaelzer commented 2 years ago

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;
...
cpaelzer commented 2 years ago

I realized that this is an embedded source, therefore this is actually a derivative of this issue => https://github.com/catchorg/Catch2/issues/2178 And thereby this fix => https://github.com/woodard/libabigail/commit/8ae8dcb8d5b87dafd0b9fdd716654e4bf3284c95

Maybe you just need to update that file from catch2?

ErlendHaa commented 1 year ago

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