wlav / cppyy-backend

23 stars 27 forks source link

Build from source failure on undeclared identifier _POSIX_SEM_VALUE_MAX #16

Closed willwray closed 8 months ago

willwray commented 9 months ago

(Reporting here rather than cppyy repo because this issue is specific to the build here.)

I'm attempting to follow the instructions for building from source

Start with the cppyy-cling package (cppyy-backend repo, subdirectory “cling”), which requires source to be pulled in from upstream, and thus takes a few extra steps:

$ git clone https://github.com/wlav/cppyy-backend.git
$ cd cppyy-backend/cling
$ python setup.py egg_info
$ python create_src_directory.py
$ python -m pip install . --upgrade

This fails for me on two different systems and three compilers Ubuntu (with clang16 or gcc11.4) and Fedora36 with gcc12.2

(Should I retry with other or older compilers?)

The SEM_VALUE_MAX error starts with commit 00c7bed "upgrade Cling from upstream (28.04)" (before that commit there's another blocking error - a compile fail on a const qualifier).

Ubuntu 22.04.3 GCC11.4

      [ 97%] Generating G__ThreadLegacy.cxx, ../../lib/libThreadLegacy.rootmap
      In file included from input_line_8:16:
      In file included from /Data/home/will/repos/cppyy-backend/cling/builddir/include/ROOT/TReentrantRWLock.hxx:21:
      In file included from /usr/include/c++/11/condition_variable:47:
      In file included from /usr/include/c++/11/stop_token:37:
      In file included from /usr/include/c++/11/semaphore:35:
      /usr/include/c++/11/bits/semaphore_base.h:62:41: error: use of undeclared identifier '_POSIX_SEM_VALUE_MAX'; did you mean '_SC_SEM_VALUE_MAX'?
          static constexpr ptrdiff_t _S_max = _POSIX_SEM_VALUE_MAX;
                                              ^
      /usr/include/x86_64-linux-gnu/bits/confname.h:140:5: note: '_SC_SEM_VALUE_MAX' declared here
          _SC_SEM_VALUE_MAX,
          ^
      Error: /Data/home/will/repos/cppyy-backend/cling/builddir/core/rootcling_stage1/src/rootcling_stage1: compilation failure (/Data/home/will/repos/cppyy-backend/cling/builddir/lib/libThreadLegacyde1d7a8d17_dictUmbrella.h)
      gmake[2]: *** [core/thread/CMakeFiles/G__ThreadLegacy.dir/build.make:106: core/thread/G__ThreadLegacy.cxx] Error 1
      gmake[1]: *** [CMakeFiles/Makefile2:28486: core/thread/CMakeFiles/G__ThreadLegacy.dir/all] Error 2
      gmake[1]: *** Waiting for unfinished jobs....
      [ 97%] Built target Cling
      gmake: *** [Makefile:156: all] Error 2
      error: Failed to build cppyy-cling

Fedora36 GCC12.2

  [ 97%] Generating G__ThreadLegacy.cxx, ../../lib/libThreadLegacy.rootmap
  In file included from input_line_8:16:
  In file included from /home/will/repos/cppyy-backend/cling/builddir/include/ROOT/TReentrantRWLock.hxx:21:
  In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/condition_variable:46:
  In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/stop_token:37:
  In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/semaphore:35:
  /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/semaphore_base.h:59:41: error: use of undeclared identifier '_POSIX_SEM_VALUE_MAX'; did you mean '_SC_SEM_VALUE_MAX'?
      static constexpr ptrdiff_t _S_max = _POSIX_SEM_VALUE_MAX;
                                          ^
  /usr/include/bits/confname.h:140:5: note: '_SC_SEM_VALUE_MAX' declared here
      _SC_SEM_VALUE_MAX,
      ^
...
wlav commented 9 months ago

Related: https://github.com/wlav/cppyy-backend/issues/12

wlav commented 8 months ago

Workaround in repo as detailed in https://github.com/wlav/cppyy-backend/issues/12 .