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

Compilation error while compiling cppyy #310

Closed
Vipul-Cariappa opened this issue Jul 27, 2024 · 3 comments · Fixed by #328
Closed

Compilation error while compiling cppyy #310

Vipul-Cariappa opened this issue Jul 27, 2024 · 3 comments · Fixed by #328

Comments

@Vipul-Cariappa
Copy link
Contributor

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.

@aaronj0
Copy link
Collaborator

aaronj0 commented Sep 23, 2024

It uses the pip package cppyy-cling instead of the libcppyy-backend that you build.
Should be solved by doing:

python -m pip install --upgrade . --no-deps --no-build-isolation

Commenting out the string function headers is not the right solution since you are still using the cppyy-cling backend

@Vipul-Cariappa
Copy link
Contributor Author

I faced this issue on Fedora. It worked fine on Ubuntu.

@vgvassilev
Copy link
Contributor

Is that still a problem? If not maybe close it?

@aaronj0 aaronj0 closed this as completed Sep 24, 2024
@aaronj0 aaronj0 linked a pull request Sep 24, 2024 that will close this issue
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.

3 participants