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

4.11.2: build fails with glibc 2.34 #10250

Closed
kloczek opened this issue Feb 24, 2021 · 46 comments · Fixed by #10266
Closed

4.11.2: build fails with glibc 2.34 #10250

kloczek opened this issue Feb 24, 2021 · 46 comments · Fixed by #10266

Comments

@kloczek
Copy link

kloczek commented Feb 24, 2021

[tkloczko@barrel ocaml-4.11.2]$ make
make coldstart
make[1]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make -C runtime  all
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
cp runtime/ocamlrun boot/ocamlrun
make -C stdlib  \
  CAMLC='$(BOOT_OCAMLC) -use-prims ../runtime/primitives' all
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/stdlib'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/stdlib'
cd stdlib; cp stdlib.cma std_exit.cmo *.cmi camlheader ../boot
cd boot; ln -sf ../runtime/libcamlrun.a .
make[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make opt.opt
make[1]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make checkstack
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
if /usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE  -Wl,-E -o tools/checkstack tools/checkstack.c; \
  then tools/checkstack; \
fi
rm -f tools/checkstack
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make runtime
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make -C runtime  all
make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make core
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make coldstart
make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make -C runtime  all
make[4]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
cp runtime/ocamlrun boot/ocamlrun
make -C stdlib  \
  CAMLC='$(BOOT_OCAMLC) -use-prims ../runtime/primitives' all
make[4]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/stdlib'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/stdlib'
cd stdlib; cp stdlib.cma std_exit.cmo *.cmi camlheader ../boot
cd boot; ln -sf ../runtime/libcamlrun.a .
make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make coreall
make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make -C runtime  all
make[4]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
make ocamlc
make[4]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make[4]: 'ocamlc' is up to date.
make[4]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make ocamllex ocamltools library
make[4]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make -C yacc  all
make[5]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/yacc'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/yacc'
make -C lex all
make[5]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/lex'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/lex'
make -C tools all
make[5]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/tools'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/tools'
make -C stdlib  all
make[5]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/stdlib'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/stdlib'
make[4]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make ocaml
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make[2]: 'ocaml' is up to date.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make opt-core
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
make -C runtime  allopt
make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o signals_nat_n.o signals_nat.c
signals_nat.c:198:13: error: variably modified ‘sig_alt_stack’ at file scope
  198 | static char sig_alt_stack[SIGSTKSZ];
      |             ^~~~~~~~~~~~~
make[3]: *** [Makefile:344: signals_nat_n.o] Error 1
@Octachron
Copy link
Member

It looks like you are missing the configure step? Do you have more context? On the Inria CI, 4.11.2 builds fine (except a test that should have been disabled on Windows).

@kloczek
Copy link
Author

kloczek commented Feb 24, 2021

No that was executed after configure.
Here is build log without some parts which are OK (if you wish to peak on it ..)

+ cd ocaml-4.11.2
+ autoconf -f
configure.ac:1580: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
build-aux/ax_pthread.m4:88: AX_PTHREAD is expanded from...
lib/m4sugar/m4sh.m4:594: AS_CASE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
configure.ac:1580: the top level
+ CFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none'
+ CXXFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none'
+ FFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules'
+ FCFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules'
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin'
+ CC=/usr/bin/gcc
+ CXX=/usr/bin/g++
+ FC=/usr/bin/gfortran
+ AR=/usr/bin/gcc-ar
+ NM=/usr/bin/gcc-nm
+ RANLIB=/usr/bin/gcc-ranlib
+ export CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS CC CXX FC AR NM RANLIB
+ ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --disable-silent-rules --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info 'OC_CFLAGS=-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none' 'OC_LDFLAGS=-Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin' --libdir=/usr/lib64/ocaml
configure: WARNING: unrecognized options: --disable-dependency-tracking, --disable-silent-rules
configure: Configuring OCaml version 4.11.2
checking build system type... x86_64-redhat-linux-gnu
checking host system type... x86_64-redhat-linux-gnu
checking target system type... x86_64-redhat-linux-gnu
checking for x86_64-redhat-linux-gnu-ld... no
checking for x86_64-redhat-linux-gnu-link... no
checking for ld... ld
checking how to print strings... printf
checking for x86_64-redhat-linux-gnu-gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to enable C11 features... none needed
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by /usr/bin/gcc... ld
checking if the linker (ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/gcc-nm
checking the name lister (/usr/bin/gcc-nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-redhat-linux-gnu file names to x86_64-redhat-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-redhat-linux-gnu file names to toolchain format... func_convert_file_noop
checking for ld option to reload object files... -r
checking for x86_64-redhat-linux-gnu-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for x86_64-redhat-linux-gnu-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for x86_64-redhat-linux-gnu-ar... /usr/bin/gcc-ar
checking for archiver @FILE support... @
checking for x86_64-redhat-linux-gnu-strip... no
checking for strip... strip
checking for x86_64-redhat-linux-gnu-ranlib... /usr/bin/gcc-ranlib
checking for gawk... gawk
checking command to parse /usr/bin/gcc-nm output from /usr/bin/gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for x86_64-redhat-linux-gnu-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /usr/bin/gcc supports -fno-rtti -fno-exceptions... no
checking for /usr/bin/gcc option to produce PIC... -fPIC -DPIC
checking if /usr/bin/gcc PIC flag -fPIC -DPIC works... yes
checking if /usr/bin/gcc static flag -static works... no
checking if /usr/bin/gcc supports -c -o file.o... yes
checking if /usr/bin/gcc supports -c -o file.o... (cached) yes
checking whether the /usr/bin/gcc linker (ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C preprocessor... /usr/bin/gcc -E
checking C compiler vendor... gcc-11-0
checking whether #! works in shell scripts... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for cos in -lm... yes
checking for math.h... yes
checking for unistd.h... (cached) yes
checking for stdint.h... (cached) yes
checking for sys/shm.h... yes
checking for dirent.h... yes
checking for sys/select.h... yes
checking for off_t... yes
checking size of int... 4
checking size of long... 8
checking size of long *... 8
checking size of short... 2
checking size of long long... 8
configure: Target is a 64 bits architecture
checking whether byte ordering is bigendian... no
checking alignment of double... 8
checking alignment of long... 8
checking alignment of long long... 8
checking whether the C compiler supports -fno-tree-vrp... yes
checking whether the C compiler supports __attribute__((aligned(n)))... yes
checking for x86_64-redhat-linux-gnu-ld... no
checking for ld... ld
configure: checking semantics of signal handlers
checking for sigaction... yes
checking for sigprocmask... yes
configure: POSIX signal handling found.
checking for expm1... yes
checking for log1p... yes
checking for hypot... yes
checking for fma... yes
checking for copysign... yes
checking for getrusage... yes
checking for times... yes
checking for secure_getenv... yes
checking for issetugid... no
checking for library containing clock_gettime... none required
checking for socket... yes
checking for socketpair... yes
checking for bind... yes
checking for listen... yes
checking for accept... yes
checking for connect... yes
checking for socklen_t... yes
checking for inet_aton... yes
checking for struct sockaddr_in6... yes
checking for getaddrinfo... yes
checking for getnameinfo... yes
checking for inet_pton... yes
checking for inet_ntop... yes
checking for rewinddir... yes
checking for lockf... yes
checking for mkfifo... yes
checking for getcwd... yes
checking for sys/types.h... (cached) yes
checking for utime.h... yes
checking for utime... yes
checking for utimes... yes
checking for fchmod... yes
checking for fchown... yes
checking for truncate... yes
checking for ftruncate... yes
checking for select... yes
checking for fd_set... yes
checking for nanosleep... yes
checking for symlink... yes
checking for readlink... yes
checking for lstat... yes
checking for waitpid... yes
checking for wait4... yes
checking for getgroups... yes
checking for setgroups... yes
checking for initgroups... yes
checking for termios.h... yes
checking for tcgetattr... yes
checking for tcsetattr... yes
checking for tcsendbreak... yes
checking for tcflush... yes
checking for tcflow... yes
checking for setitimer... yes
checking for gethostname... yes
checking for sys/utsname.h... yes
checking for uname... yes
checking for gettimeofday... yes
checking for mktime... yes
checking for setsid... yes
checking for putenv... yes
checking for setenv... yes
checking for unsetenv... yes
checking for locale.h... yes
checking for newlocale... yes
checking for freelocale... yes
checking for uselocale... yes
checking for xlocale.h... no
checking for strtod_l... yes
checking for dlopen... no
checking for dlopen in -ldl... yes
configure: Dynamic loading of shared libraries is supported.
checking for sys/mman.h... yes
checking for mmap... yes
checking for munmap... yes
checking for pwrite... yes
checking whether the C compiler supports -fdebug-prefix-map... yes
checking for struct stat.st_atim.tv_nsec... yes
configure: stat supports nanosecond precision
checking how many arguments gethostbyname_r() takes... six
checking how many arguments gethostbyaddr_r() takes... eight
checking for mkstemp... yes
checking for nice... yes
checking for dup3... yes
checking for pipe2... yes
checking for accept4... yes
checking for getauxval... yes
checking for execvpe... yes
checking for ffs... yes
checking for _BitScanForward... no
configure: replay debugger supported
checking whether stack overflows can be detected... yes
checking whether /usr/bin/gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
configure: the POSIX threads library is supported
checking for sigwait... yes
checking for bfd.h... yes
checking for bfd_openr in -lbfd... yes
checking whether the assembler supports --debug-prefix-map... yes
checking whether the assembler supports CFI directives... yes
configure: not using frame pointers
checking whether mmap supports huge pages... yes
checking whether to build spacetime... no
configure: creating ./config.status
config.status: creating Makefile.common
config.status: creating Makefile.config
config.status: creating tools/eventlog_metadata
config.status: creating runtime/caml/m.h
config.status: creating runtime/caml/s.h
config.status: executing libtool commands
configure: WARNING: unrecognized options: --disable-dependency-tracking, --disable-silent-rules
+ /usr/bin/make -O -j1 V=1 VERBOSE=1
/usr/bin/make coldstart
make[1]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2'
/usr/bin/make -C runtime  all
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
echo "/usr/lib64/ocaml/stublibs" > ld.conf
echo "/usr/lib64/ocaml" >> ld.conf
tr -d '\r' < caml/instruct.h | \
sed -n -e '/^  /s/ \([A-Z]\)/ \&\&lbl_\1/gp' \
       -e '/^}/q' > caml/jumptbl.h
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -o interp_b.o interp.c
../tools/make-version-header.sh ../VERSION > caml/version.h
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -o misc_b.o misc.c
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -o stacks_b.o stacks.c
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -o fix_code_b.o fix_code.c

[..]

make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ocaml-4.11.2/runtime'
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o startup_aux_n.o startup_aux.c
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o startup_nat_n.o startup_nat.c
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o main_n.o main.c
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o fail_nat_n.o fail_nat.c
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o roots_nat_n.o roots_nat.c
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o signals_n.o signals.c
/usr/bin/gcc -c -O2 -fno-strict-aliasing -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -fno-tree-vrp -ffunction-sections -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE   -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o signals_nat_n.o signals_nat.c
signals_nat.c:198:13: error: variably modified 'sig_alt_stack' at file scope
  198 | static char sig_alt_stack[SIGSTKSZ];
      |             ^~~~~~~~~~~~~

@Octachron
Copy link
Member

Octachron commented Feb 24, 2021

Autoconf 2.70 is not supported. Can you check that everything is fine with 2.69 ?

@kloczek
Copy link
Author

kloczek commented Feb 24, 2021

But looks like it this is not an autoconf issue (?)
It could be probably first packaghe which would have some ac 2.71 issues in about 2.5k packages which I've so far build in last few weeks using that version.
2.69 has a lot of bugs and to be honest I have no intention to go back to version released in 2014/04 (7 years old code base).
If it is really ac 2.71 related issue I suggest to have look on what it may be because debian already swiched to 2.71 and looks like Fedora will jump on it very soon, and probably other distros will folow.
I may be only just front of that comming wave :)

Neveretheless I don't see any warnings in build log or so which may point on what exactly it may be :/

@Octachron
Copy link
Member

It is more a matter of reducing all unknown variables. The error is that somehow SIGSTKSZ ends up not being a constant on your system.

@kloczek
Copy link
Author

kloczek commented Feb 24, 2021

You know .. that code looks a bit odd:

    197
    198 static char sig_alt_stack[SIGSTKSZ];
    199

Than that static char is used to initialize:

    284 #ifdef HAS_STACK_OVERFLOW_DETECTION
    285   {
    286     stack_t stk;
    287     struct sigaction act;
    288     stk.ss_sp = sig_alt_stack;
    289     stk.ss_size = SIGSTKSZ;
    290     stk.ss_flags = 0;
    291     SET_SIGACT(act, segv_handler);
    292     act.sa_flags |= SA_ONSTACK | SA_NODEFER;
    293     sigemptyset(&act.sa_mask);
    294     if (sigaltstack(&stk, NULL) == 0) { sigaction(SIGSEGV, &act, NULL); }
    295   }
    296 #endif

That code could be OK if sig_alt_stack would be just #define but it is not like that.

@kloczek
Copy link
Author

kloczek commented Feb 24, 2021

no sorry I was wrong ..

@xavierleroy
Copy link
Contributor

xavierleroy commented Feb 24, 2021

Re: autoconf, if you don't want to use the same version of autoconf as the one we use, please do not run autoconf at all and use the pre-generated configure script found in the distribution tarball.

Re: SIGSTKSZ, rest assured we have all the #ifdef needed. The Open Group specification says it is a compile-time constant. Apparently it is not in the C library you're using.

Which C library are you using? Which Linux distribution? What does the following command prints?

find /usr/include -name '*.h' -print | xargs grep SIGSTKSZ

@kloczek
Copy link
Author

kloczek commented Feb 24, 2021

I'm using my own distribution which is fesora rawhide based. However glibs still is from rawhide

[tkloczko@barrel SPECS]$ grep -r SIGSTKSZ -w /usr/include/
/usr/include/asm-generic/signal.h:#if !defined MINSIGSTKSZ || !defined SIGSTKSZ
/usr/include/asm-generic/signal.h:#define SIGSTKSZ      8192
/usr/include/asm/signal.h:#define SIGSTKSZ      8192
/usr/include/bits/sigstack.h:#define SIGSTKSZ   8192
/usr/include/bits/sigstksz.h:/* Definition of MINSIGSTKSZ and SIGSTKSZ.  Linux version.
/usr/include/bits/sigstksz.h:# undef SIGSTKSZ
/usr/include/bits/sigstksz.h:# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
/usr/include/bits/sigstksz.h:/* Minimum stack size for a signal handler: SIGSTKSZ.  */
/usr/include/bits/sigstksz.h:# define MINSIGSTKSZ SIGSTKSZ
/usr/include/doctest/doctest.h:        static char             altStackMem[4 * SIGSTKSZ];
/usr/include/boost/test/impl/execution_monitor.ipp:#    define BOOST_TEST_ALT_STACK_SIZE SIGSTKSZ
/usr/include/rb_mjit_min_header-3.0.0-x86_64.h:#define SIGSTKSZ 8192
/usr/include/features.h:                        MINSIGSTKSZ and SIGSTKSZ.
/usr/include/features.h:                        MINSIGSTKSZ and SIGSTKSZ.
[tkloczko@barrel SPECS]$ rpm -q glibc
glibc-2.33.9000-1.fc35.x86_64
[tkloczko@barrel SPECS]$ grep -r SIGSTKSZ /usr/include/ -lw | xargs rpm -qf | sort | uniq
boost-devel-1.75.0-1.fc34.x86_64
doctest-devel-2.4.5-2.fc34.x86_64
glibc-headers-x86-2.33.9000-1.fc35.noarch
kernel-headers-5.11.0-1.fc35.x86_64
ruby-devel-3.0.0-145.fc34.x86_64

Will try to make test without executing autoconf and back to you shortly.

BTW GNU autotools. Looks like autoheader reports missing templates in configure.ac.
Ig you want I can try to patch that so it would allow in future use by ocaml build process autoheader (I've been dointg that few times in last few weeks for few projects so for me it will be probably quicker to fo that :) ).

[tkloczko@barrel ocaml-4.11.2]$ autoreconf -fiv
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: configure.ac: not using aclocal
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: You should add the contents of the following files to 'aclocal.m4':
libtoolize:   '/usr/share/aclocal/libtool.m4'
libtoolize:   '/usr/share/aclocal/ltoptions.m4'
libtoolize:   '/usr/share/aclocal/ltsugar.m4'
libtoolize:   '/usr/share/aclocal/ltversion.m4'
libtoolize:   '/usr/share/aclocal/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: configure.ac: not using aclocal
autoreconf: running: /usr/bin/autoconf --force
configure.ac:20: warning: AC_INIT: not a literal: "m4_esyscmd(head -n1 VERSION | tr -d '\r\n')"
configure.ac:518: warning: ac_ext=c
configure.ac:518: ac_cpp='$CPP $CPPFLAGS'
configure.ac:518: ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
configure.ac:518: ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
configure.ac:518: ac_compiler_gnu=$ac_cv_c_compiler_gnu
configure.ac:518: if test -n "$ac_tool_prefix"; then
configure.ac:518:   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
configure.ac:518: set dummy ${ac_tool_prefix}gcc; ac_word=$2
configure.ac:518: { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
configure.ac:518: printf %s "checking for $ac_word... " >&6; }
configure.ac:518: if test ${ac_cv_prog_CC+y}
configure.ac:518: then :
configure.ac:518:   printf %s "(cached) " >&6
configure.ac:518: else $as_nop
configure.ac:518:   if test -n "$CC"; then
configure.ac:518:   ac_cv_prog_CC="$CC" # Let the user override the test.
configure.ac:518: else
configure.ac:518: as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
configure.ac:518: for as_dir in $PATH
configure.ac:518: do
configure.ac:518:   IFS=$as_save_IFS
configure.ac:518:   case $as_dir in #(((
configure.ac:518:     '' is m4_require'd but not m4_defun'd
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/programs.m4:41: _AC_CHECK_PROG is expanded from...
./lib/autoconf/programs.m4:101: AC_CHECK_PROG is expanded from...
./lib/autoconf/programs.m4:221: AC_CHECK_TOOL is expanded from...
./lib/autoconf/c.m4:452: AC_PROG_CC is expanded from...
configure.ac:518: the top level
configure.ac:1572: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
build-aux/ax_pthread.m4:88: AX_PTHREAD is expanded from...
lib/m4sugar/m4sh.m4:594: AS_CASE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
configure.ac:1572: the top level
autoreconf: running: /usr/bin/autoheader --force
autoheader: warning: missing template: ARCH_ALIGN_DOUBLE
autoheader: warning: Use AC_DEFINE([ARCH_ALIGN_DOUBLE], [], [Description])
autoheader: warning: missing template: ARCH_ALIGN_INT64
autoheader: warning: missing template: ARCH_BIG_ENDIAN
autoheader: warning: missing template: ARCH_SIXTYFOUR
autoheader: warning: missing template: ASM_CFI_SUPPORTED
autoheader: warning: missing template: CAML_SAFE_STRING
autoheader: warning: missing template: CAML_WITH_FPIC
autoheader: warning: missing template: ENABLE_CALL_COUNTS
autoheader: warning: missing template: FLAT_FLOAT_ARRAY
autoheader: warning: missing template: FUNCTION_SECTIONS
autoheader: warning: missing template: HAS_ACCEPT4
autoheader: warning: missing template: HAS_ARCH_CODE32
autoheader: warning: missing template: HAS_BITSCANFORWARD
autoheader: warning: missing template: HAS_BROKEN_PRINTF
autoheader: warning: missing template: HAS_C99_FLOAT_OPS
autoheader: warning: missing template: HAS_DIRENT
autoheader: warning: missing template: HAS_DUP3
autoheader: warning: missing template: HAS_EXECVPE
autoheader: warning: missing template: HAS_FCHMOD
autoheader: warning: missing template: HAS_FFS
autoheader: warning: missing template: HAS_GETAUXVAL
autoheader: warning: missing template: HAS_GETCWD
autoheader: warning: missing template: HAS_GETGROUPS
autoheader: warning: missing template: HAS_GETHOSTBYADDR_R
autoheader: warning: missing template: HAS_GETHOSTBYNAME_R
autoheader: warning: missing template: HAS_GETHOSTNAME
autoheader: warning: missing template: HAS_GETRUSAGE
autoheader: warning: missing template: HAS_GETTIMEOFDAY
autoheader: warning: missing template: HAS_HUGE_PAGES
autoheader: warning: missing template: HAS_INET_ATON
autoheader: warning: missing template: HAS_INITGROUPS
autoheader: warning: missing template: HAS_IPV6
autoheader: warning: missing template: HAS_ISSETUGID
autoheader: warning: missing template: HAS_LIBBFD
autoheader: warning: missing template: HAS_LIBUNWIND
autoheader: warning: missing template: HAS_LOCALE_H
autoheader: warning: missing template: HAS_LOCKF
autoheader: warning: missing template: HAS_MACH_ABSOLUTE_TIME
autoheader: warning: missing template: HAS_MKFIFO
autoheader: warning: missing template: HAS_MKSTEMP
autoheader: warning: missing template: HAS_MKTIME
autoheader: warning: missing template: HAS_MMAP
autoheader: warning: missing template: HAS_NANOSECOND_STAT
autoheader: warning: missing template: HAS_NANOSLEEP
autoheader: warning: missing template: HAS_NICE
autoheader: warning: missing template: HAS_PIPE2
autoheader: warning: missing template: HAS_POSIX_MONOTONIC_CLOCK
autoheader: warning: missing template: HAS_PUTENV
autoheader: warning: missing template: HAS_PWRITE
autoheader: warning: missing template: HAS_REWINDDIR
autoheader: warning: missing template: HAS_SECURE_GETENV
autoheader: warning: missing template: HAS_SELECT
autoheader: warning: missing template: HAS_SETENV_UNSETENV
autoheader: warning: missing template: HAS_SETGROUPS
autoheader: warning: missing template: HAS_SETITIMER
autoheader: warning: missing template: HAS_SETSID
autoheader: warning: missing template: HAS_SIGWAIT
autoheader: warning: missing template: HAS_SOCKETS
autoheader: warning: missing template: HAS_SOCKLEN_T
autoheader: warning: missing template: HAS_STACK_OVERFLOW_DETECTION
autoheader: warning: missing template: HAS_STDINT_H
autoheader: warning: missing template: HAS_STRERROR
autoheader: warning: missing template: HAS_STRTOD_L
autoheader: warning: missing template: HAS_SYMLINK
autoheader: warning: missing template: HAS_SYS_SELECT_H
autoheader: warning: missing template: HAS_SYS_SHM_H
autoheader: warning: missing template: HAS_TERMIOS
autoheader: warning: missing template: HAS_TIMES
autoheader: warning: missing template: HAS_TRUNCATE
autoheader: warning: missing template: HAS_UNAME
autoheader: warning: missing template: HAS_UNISTD
autoheader: warning: missing template: HAS_UTIME
autoheader: warning: missing template: HAS_UTIMES
autoheader: warning: missing template: HAS_WAIT4
autoheader: warning: missing template: HAS_WAITPID
autoheader: warning: missing template: HAS_WORKING_FMA
autoheader: warning: missing template: HAS_XLOCALE_H
autoheader: warning: missing template: HAS___SECURE_GETENV
autoheader: warning: missing template: HUGE_PAGE_SIZE
autoheader: warning: missing template: NO_NAKED_POINTERS
autoheader: warning: missing template: OCAML_OS_TYPE
autoheader: warning: missing template: POSIX_SIGNALS
autoheader: warning: missing template: PROFINFO_WIDTH
autoheader: warning: missing template: SIZEOF_LONGLONG
autoheader: warning: missing template: SIZEOF_PTR
autoheader: warning: missing template: SUPPORTS_ALIGNED_ATTRIBUTE
autoheader: warning: missing template: SUPPORT_DYNAMIC_LINKING
autoheader: warning: missing template: WITH_FRAME_POINTERS
autoheader: warning: missing template: WITH_PROFINFO
autoheader: warning: missing template: WITH_SPACETIME
autoreconf: error: /usr/bin/autoheader failed with exit status: 1

@kloczek
Copy link
Author

kloczek commented Feb 24, 2021

BTW probably it would be good to check what kind of changes proposes autoupdate from ac 2.71 (will try to check that as well)

@xavierleroy
Copy link
Contributor

This is the source of the problem:

/usr/include/bits/sigstksz.h:# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)

My Ubuntu 20.04 distro doesn't have /usr/include/bits/sigstksz.h. Where does this file come from? Why is is included from <signal.h>?

Also, I'm positive this is an incorrect definition of SIGSTKSZ, which must be a constant.

@xavierleroy
Copy link
Contributor

I'm using my own distribution which is fesora rawhide based

We support released version of Fedora. In particular, Fedora 33 is part of our CI. But we don't support Rawhide, and we don't support your own distribution.

@kloczek
Copy link
Author

kloczek commented Feb 24, 2021

My Ubuntu 20.04 distro doesn't have /usr/include/bits/sigstksz.h. Where does this file come from? Why is is included from <signal.h>?

[tkloczko@barrel SPECS]$ rpm -qf /usr/include/bits/sigstksz.h
glibc-headers-x86-2.33.9000-1.fc35.noarch

We support released version of Fedora. In particular, Fedora 33 is part of our CI. But we don't support Rawhide, and we don't support your own distribution.

I fully understand that however if tha cost fixing such issue would wi relatively low I would suggest to fix that ASAP as it may save a lot of time on racting on simillar issues :)

@stedolan
Copy link
Contributor

This looks like it might be because of this glibc patch from last month, which sometimes redefines SIGSTKSZ as a non-constant: http://patches-tcwg.linaro.org/patch/48061/

I think glibc's position is that we have opted-in to this non-POSIX definition by defining _GNU_SOURCE - if you don't, you get a constant SIGSTKSZ. There may be some way to opt out of this while keeping the other _GNU_SOURCE features, but it might be easiest just to malloc the alt stack at startup.

@Octachron
Copy link
Member

If I read the patch discussion correctly, this issue concerns the unreleased glibc 2.34 ?

@kloczek
Copy link
Author

kloczek commented Feb 25, 2021

Looks like other projests are affected by the same issue.
Here is the patch for stress-ng ColinIanKing/stress-ng@7c4f747

@gasche
Copy link
Member

gasche commented Feb 25, 2021

But if libc breaks code that is standard-compliant, isn't it a bug in libc itself, a change that should be reverted, or at least made easy to opt-out of?

@kloczek
Copy link
Author

kloczek commented Feb 25, 2021

Only FTR: I've asked on fedora list about that change in glibc is that it was not kind of mistake or not .. https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/BR5DU2NSKRZAJHEUWOI4H6ZIQQNVAXAR/

@Octachron Octachron changed the title 4.11.2: build fails 4.11.2: build fails with glibc 2.34 Feb 25, 2021
@avsm
Copy link
Member

avsm commented Feb 26, 2021

I doubt glibc is going to revert this particular decision, and (as @stedolan observes) have a "get out of POSIX card" by virtue of _GNU_SOURCE being defined. The changelog from glibc 2.34 is:

Add _SC_MINSIGSTKSZ and _SC_SIGSTKSZ. When _SC_SIGSTKSZ_SOURCE or _GNU_SOURCE are defined, MINSIGSTKSZ and SIGSTKSZ are no longer constant on Linux. MINSIGSTKSZ is redefined to sysconf(_SC_MINSIGSTKSZ) and SIGSTKSZ is redefined to sysconf (_SC_SIGSTKSZ).

The relevant commit in glibc is here: bminor/glibc@6c57d32

I don't entirely follow the compatibility logic described in the commit message, but glibc seems to have dug themselves into a hole by shadowing the kernel's definition to userspace, and then having to support older binaries. Musl doesn't seem to have this problem as far as I can tell.

@xavierleroy
Copy link
Contributor

All right, we'll malloc the alternate stack. I just wish C standard libraries would take backward compatibility more seriously.

@rwmjones
Copy link
Contributor

I've just hit this one while trying to build OCaml 4.12 for Rawhide (which uses the new glibc with this patch). Did you have a suggested patch already or would you like me to try doing one?

@rwmjones
Copy link
Contributor

This is the patch I came up with, not the greatest thing in the world, but feel free to take it and adapt it if it's useful to you: https://pagure.io/fedora-ocaml/c/dfb5e954a04f59b0456cc4c0ddf3acaf22e0ff07?branch=fedora-35-4.12.0

@gasche
Copy link
Member

gasche commented Feb 28, 2021

@rwmjones It's a detail, but I think that we want to use caml_stat_alloc rather than malloc directly, so that it is properly collected if the runtime is shut down.

xavierleroy added a commit to xavierleroy/ocaml that referenced this issue Mar 2, 2021
In Glibc 2.34 and later, SIGSTKSZ may not be a compile-time constant.
It is no longer possible to statically allocate the alternate signal
stack for the main thread, as we've been doing for the last 25 years.

This commit implements dynamic allocation of the alternate signal stack
even for the main thread.  It reuses the code already in place to allocate
the alternate signal stack for other threads.

Fixes: ocaml#10250.
@xavierleroy
Copy link
Contributor

Proposed fix at #10266. Compared with @rwmjones's patch, it doesn't need a "constructor" function.

@xavierleroy
Copy link
Contributor

It's a detail, but I think that we want to use caml_stat_alloc rather than malloc directly, so that it is properly collected if the runtime is shut down.

Collecting an alternate stack while it is still in use can end up in a disaster. We would need to sigaltstack away from the alternate stack before it can be freed. For the moment, I'd rather stick to malloc() and risk a memory leak.

@gasche
Copy link
Member

gasche commented Mar 3, 2021

It's a detail, but I think that we want to use caml_stat_alloc rather than malloc directly, so that it is properly collected if the runtime is shut down.

Collecting an alternate stack while it is still in use can end up in a disaster. We would need to sigaltstack away from the alternate stack before it can be freed. For the moment, I'd rather stick to malloc() and risk a memory leak.

I don't know what sigalstack is and how it works, but I assumes it installs some kind of handler for something. I would expect shutting down the runtime to un-install this handler, so that the process ends up in the same configuration that it was before the OCaml runtime was started. (I guess this is what you describe as "sigal-stacking away?") Then we should be fine as long as the uninstallation happens before freeing the pools. You point out that uninstalling is non-trivial, and maybe we don't really care that much about preserving shutdown, but maybe this could be a correctness problem for startup/shutdown users, rather than just a memory leak?

@jibnew
Copy link

jibnew commented Dec 7, 2021

The issue was fixed in OCaml 4.13.0. Why don't you use the latest 4.13.1 version of OCaml?

I did install 4.13.2 but unfortunately I need elpi, and when I try to install it opam says it is only possible if I downgrade to 4.12.2

dra27 pushed a commit to dra27/ocaml that referenced this issue Dec 10, 2021
…l#10726)

In Glibc 2.34 and later, SIGSTKSZ may not be a compile-time constant.
It is no longer possible to statically allocate the alternate signal
stack for the main thread, as we've been doing for the last 25 years.

This commit implements dynamic allocation of the alternate signal stack
even for the main thread.  It reuses the code already in place to allocate
the alternate signal stack for other threads.

The alternate signal stack is freed when the main OCaml code / an OCaml thread
stops.

Fixes: ocaml#10250
@tlringer
Copy link

tlringer commented Jan 4, 2022

Quick question, since one of my students (@cosmoviola) just ran into this: Say the student needs to be on a version of OCaml prior to the fix. Is there a way to use an old glibc somehow that doesn't have this problem? We are confused because this problem didn't manifest on his old computer, but now manifests on his new one. He is on Ubuntu 21.10.

@gasche
Copy link
Member

gasche commented Jan 4, 2022

@dra27 has worked on backporting the fix to older OCaml versions (see #10725); it is not merged in the compiler upstream (it would be in version branches, not in a released bugfix, but your student could build and install the version branch), but there is growing consensus that it should be, and I think @dra27 is planning to include the patch in opam switches as well (see ocaml/opam-repository#19855 for 4.10-4.12 vrsions of the backport).

Long story short: @dra27 has worked on this and, if all goes according to his plan, in a few days/weeks opam switch create 4.0<n> should just work.

(Whenever we discuss backporting fixes, people wonder if we really have users that want to run OCaml 4.02 or what have you. Would you mind sharing your own reasons to use old OCaml versions (which version)? My guess would be that you are working on an old Coq development that only works with old Coq versions, that are themselves only compatible with older OCaml versions.)

@tlringer
Copy link

tlringer commented Jan 4, 2022

Thanks, that makes sense. We can work in a later OCaml for now, and revisit in a few weeks.

Indeed the reason is that we need an old Coq (though not immediately, just eventually). The Coq plugin infrastructure changed really dramatically from 8.9.x to 8.10.x, so we need Coq 8.9.x for a plugin. Though if 4.10-4.12 already have that backported fix, that may be enough for Coq 8.9.x---I need to check what the assumptions are for 8.9.x, since I don't remember.

We had been on 4.07.1+flambda, which worked for Coq 8.9.1 with a Coq plugin that also relies on a very specific version of SerAPI. I'd been too scared to mess around with other versions, but can check what the latest version of OCaml that works with that is.

In general, though, the OCaml developments I use are always held back by any breaking changes to the Coq plugin infrastructure, which break my plugins (ironically, my proof repair plugins).

@gasche
Copy link
Member

gasche commented Jan 4, 2022

opam show coq.8.9.1 suggests that it needs ocaml < "4.10", so you would need OCaml 4.09 indeed.

(I wonder if the Coq people would consider backporting fixes to work with more recent OCaml versions, so that it gets easier in the future to install old Coq releases.)

@glondu
Copy link
Contributor

glondu commented Jan 5, 2022

Using an old OCaml (or Coq) with a new OS is a bit antinomic. Maybe using a chroot could be an option? I suggest using schroot (with a Debian 11 "bullseye" environment, which has OCaml 4.11.1) in this case. A more trendy way might be using Docker. I don't know if it works well with WSL2, though.

@gasche
Copy link
Member

gasche commented Jan 5, 2022

I don't really agree. (As you know well, but for context:) Coq is used in academic environments where it is common for a given software/proof project to sit unused for years, and then be dusted off and tested/used, and even re-developed. It is a common use-case to develop again with software that was written 5, 10 years ago, and we expect to be able to do this within the comfort of an up-to-date development system, rather than a time-capsule of the entire system as it existed at the time. (The tooling of the time was poorer, older systems may also not work for my hardware, etc.) (In the general case there are also security concerns with using frozen version of old systems, but Coq does not talk to the network and I guess some OSes, possibly Debian, have kept backporting security fixes on 5-year-old OSes.) My desire as a user is to use a given Coq development with all the other components of my system as up-to-date as possible.

Now Coq, by design, has very fragile compatibility, old proof developments (and all-the-more plugins) will only work with a small range of versions. This forces an old Coq version on the user. Coq also tends to be tightly coupled with OCaml versions (this is not by design, but rather due to (imho fairly debatable) implementation choices depending on low-level, unspecified and unstable details of OCaml for performance reasons); this in turn forces an older OCaml version on the user. (I think the Coq team could/should consider backporting OCaml-compatibility fixes to older Coq releases, to make their users' lives easier. It may also make them more careful about not depending too tighly on unspecified parts, or putting more work in asking for better-specified and compatible interfaces for their low-level needs.)

@glondu
Copy link
Contributor

glondu commented Jan 5, 2022

Personally, I would first go with a "time capsule" as you say to assess the worthiness of doing more efforts to make my target work with an up-to-date environment. And by "environment", I mean the OS as well as OCaml and Coq. I was suggesting using a chroot just to make progress, not as a long-term solution to the problem.

@dra27
Copy link
Member

dra27 commented Jan 5, 2022

ocaml/opam-repository#19855 now contains back-ports right the way back to 3.07 - it's only closed because the PR was causing too much pressure on opam-repository's CI system. As @gasche says, consensus is in the process of being reached, and there should at least be a plan next week! The discussion at the moment is where the patches should go, not whether opam-repository should carry them.

For forward progress, opam repo add dra27 'git+https://github.com/dra27/opam-repository.git#glibc-2.34-4.10+' can be used to add the patched compilers to any opam switch.

I'm sure there will finally come a point where OCaml 3.07 needs too much effort to be compiled on a modern system, but the more years it goes on being possible, the more belligerent I seem to become in finding the required patches 😁 The fact that there's the occasional use for very old OCaml compilers at least means I don't feel totally mad doing that...

@tlringer
Copy link

tlringer commented Jan 5, 2022

Thanks, I appreciate it!

@samuelgruetter
Copy link

Thank you @dra27 -- here's another Coq user who appreciates your back-porting work 👍

A note for other users whose Google search might lead them here: After running just opam repo add dra27 'git+https://github.com/dra27/opam-repository.git#glibc-2.34-4.10+', opam switch create MySwitchName 4.10.2 still used the unpatched version and still produced the same error. As I learned by reading opam help switch, one has to use the --repositories option to specify the desired priority ranking among repos, ie something like opam switch create MySwitchName 4.10.2 --repositories=dra27,default, and then opam install coq.8.13.2 worked.

@gasche
Copy link
Member

gasche commented Jan 10, 2022

Note: as far as I can tell, coq 8.13 should work fine with OCaml 4.13, which works fine with the last glibc. (But thanks for the usage instruction! Hopefully they will be replaced by "it just works" shortly.)

@samuelgruetter
Copy link

(apologies for going off-topic)

Note: as far as I can tell, coq 8.13 should work fine with OCaml 4.13

When I tried to build coq 8.13.2 with OCaml 4.13.0 (using make -f Makefile.dune world), I got a this optional argument cannot be erased error and the build failed, so I assumed that OCaml 4.13.0 is too new for coq 8.13.2, but now that I tried again with ./configure -local && make, this error was only reported as a warning and the build succeeded.

gasche referenced this issue Jan 24, 2022
Updated separately to allow the previous patch to be used for multiple
releases.
@dra27
Copy link
Member

dra27 commented Jan 24, 2022

The back-ports have been done! 🥳

TL;DR the compilers work if installed via opam; there almost certainly will not be any new maintenance releases for 4.12 and earlier.

Status:

  • 3.12-4.12 incl. have had the patches pushed to their respective release branches on ocaml/ocaml and the opam-repository packages apply those patches to all the maintenance releases. On each branch, the commit headed "Dynamically allocate the alternate signal stack" (e.g. 1eeb0e7 for 4.12) can be applied as a patch to any of the releases for that branch (e.g. for 4.12.0 in opam-repository). The branches themselves also build (i.e. you can "pin" the compiler).
  • 3.07-3.11 incl. carry the patches directly in opam-repository (these may get re-housed in ocaml/ocaml some day, but that's a separate, and much lower-priority project). At present, these compilers can only be installed from opam-repository (which was already the case!)

@Zimmi48
Copy link

Zimmi48 commented Jan 24, 2022

Thanks a lot for your effort @dra27!

@Zimmi48
Copy link

Zimmi48 commented Jan 24, 2022

@gasche FWIW, the Coq Platform is current built with OCaml 4.10. The reason for this choice is a compromise between various requirements. OCaml >= 4.10 is needed to be compatible with recent macOS versions IIUC but OCaml < 4.13 is required for camlp5 < 8.00, thus for Elpi, and thus for the Platform.

For some use cases, 4.07.1 is still the recommended version for Coq because of this issue coq/coq#7698 that is actively been worked on (coq/coq#15220).

And regarding extending the compatibility of old Coq versions with new OCaml versions, this is mostly a problem of manpower I would say.

@ejgallego
Copy link

@samuelgruetter

When I tried to build coq 8.13.2 with OCaml 4.13.0 (using make -f Makefile.dune world),

That triggers a developer build, so all warnings are fatal. For a non dev build you can use dune build -p directly, please open an issue if the doc could be improved [and sorry for the problem]

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

Successfully merging a pull request may close this issue.