Skip to content

Compilation error while compiling cppyy #310

@Vipul-Cariappa

Description

@Vipul-Cariappa

I am following the compilation from the README file. I get the following error message while compiling cppyy package.

❯ python -m pip install --upgrade . --no-deps
Processing /home/vipul/Workspace/c/cppyy-compiler-research
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install backend dependencies did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      Collecting cppyy-cling==6.28.0
        Using cached cppyy_cling-6.28.0-py2.py3-none-manylinux2014_x86_64.whl.metadata (2.0 kB)
      Collecting cppyy-backend==1.14.11
        Using cached cppyy-backend-1.14.11.tar.gz (34 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Using cached cppyy_cling-6.28.0-py2.py3-none-manylinux2014_x86_64.whl (42.2 MB)
      Building wheels for collected packages: cppyy-backend
        Building wheel for cppyy-backend (pyproject.toml): started
        Building wheel for cppyy-backend (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × 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-312
            creating build/temp.linux-x86_64-cpython-312
            creating build/temp.linux-x86_64-cpython-312/src
            gcc -pthread -B /home/vipul/micromamba/envs/compiler-research/compiler_compat -fno-strict-overflow -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/vipul/micromamba/envs/compiler-research/include -fPIC -O2 -isystem /home/vipul/micromamba/envs/compiler-research/include -fPIC -I/tmp/pip-build-env-i51to3pf/overlay/lib/python3.12/site-packages/cppyy_backend/include -I/home/vipul/micromamba/envs/compiler-research/include/python3.12 -c src/clingwrapper.cxx -o build/temp.linux-x86_64-cpython-312/src/clingwrapper.o -O2 -pthread -std=c++1z -m64
            In file included from /tmp/pip-build-env-i51to3pf/overlay/lib/python3.12/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-i51to3pf/overlay/lib/python3.12/site-packages/cppyy_backend/include/Rtypes.h:26:
            /tmp/pip-build-env-i51to3pf/overlay/lib/python3.12/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-i51to3pf/overlay/lib/python3.12/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
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install backend dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Googleing around, I found a similar issue at root-project/root#13156.

I fixed it by commenting out the declarations of strlcpy and strlcat functions from /usr/include/string.h file. It did compile after that. But this should not be recommended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions