wlav / cppyy-backend

23 stars 28 forks source link

Different exception specifier when build cppyy #13

Open hzhangxyz opened 1 year ago

hzhangxyz commented 1 year ago

When I run python -m build in cppyy project root directory. It fails when compiling cppyy-backend. Here is the part of output:

  × Building wheel for cppyy-backend (pyproject.toml) did not run successfully.                                                                                                                
  │ exit code: 1                                                                                                                                                                               
  ╰─> [24 lines of output]                                                                                                                                                                     
      running bdist_wheel                                                                                                                                                                      
      running build                                                                                                                                                                            
      running build_ext                                                                                                                                                                        
      checking for build/temp.linux-x86_64-cpython-311                                                                                                                                         
      creating build/temp.linux-x86_64-cpython-311                                                                                                                                             
      creating build/temp.linux-x86_64-cpython-311/src                                                                                                                                         
      gcc -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-pro
tection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -ffat-lto-objects -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat
 -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexc
eptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -fPIC -I/tmp/
pip-build-env-bkpyl8ui/overlay/lib/python3.11/site-packages/cppyy_backend/include -I/tmp/build-env-ov_r3zgr/include -I/usr/include/python3.11 -c src/clingwrapper.cxx -o build/temp.linux-x86_6
4-cpython-311/src/clingwrapper.o -O2 -pthread -std=c++1z -m64                                                                                                                                  
      In file included from /tmp/pip-build-env-bkpyl8ui/overlay/lib/python3.11/site-packages/cppyy_backend/include/Rtypes.h:30,                                                                
                       from src/callcontext.h:11,                                                                                                                                              
                       from src/clingwrapper.cxx:11:                                                                                                                                           
      /usr/include/string.h:506:15: error: declaration of ‘size_t strlcpy(char*, const char*, size_t) noexcept’ has a different exception specifier                                            
        506 | extern size_t strlcpy (char *__restrict __dest,                                                                                                                                  
            |               ^~~~~~~                                                                                                                                                            
      In file included from /tmp/pip-build-env-bkpyl8ui/overlay/lib/python3.11/site-packages/cppyy_backend/include/Rtypes.h:26:                                                                
      /tmp/pip-build-env-bkpyl8ui/overlay/lib/python3.11/site-packages/cppyy_backend/include/strlcpy.h:26:8: note: from previous declaration ‘size_t strlcpy(char*, const char*, size_t)’      
         26 | size_t strlcpy(char *dst, const char *src, size_t siz);                                                                                                                          
            |        ^~~~~~~                                                                                                                                                                   
      /usr/include/string.h:512:15: error: declaration of ‘size_t strlcat(char*, const char*, size_t) noexcept’ has a different exception specifier                                            
        512 | extern size_t strlcat (char *__restrict __dest,                                                                                                                                  
            |               ^~~~~~~                                                                                                                                                            
      /tmp/pip-build-env-bkpyl8ui/overlay/lib/python3.11/site-packages/cppyy_backend/include/strlcpy.h:27:8: note: from previous declaration ‘size_t strlcat(char*, const char*, size_t)’      
         27 | size_t strlcat(char *dst, const char *src, size_t siz);                                                                                                                          
            |        ^~~~~~~
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cppyy-backend
Failed to build cppyy-backend
ERROR: Could not build wheels for cppyy-backend, which is required to install pyproject.toml-based projects

My gcc version is 13.2.1, my clang version(I dont know whether this project uses system llvm) is 15.0.7

hzhangxyz commented 1 year ago

It seems because my glibc version is 2.38, see https://sourceware.org/pipermail/libc-alpha/2023-July/150524.html glibc 2.38 adds strlcpy and strlcat.

hzhangxyz commented 1 year ago

I found the same issue in upstream: https://github.com/root-project/root/issues/13529