Skip to content

Build fails when trying to build Python extension module #6740

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

Closed
cmacmackin opened this issue Mar 4, 2020 · 3 comments
Closed

Build fails when trying to build Python extension module #6740

cmacmackin opened this issue Mar 4, 2020 · 3 comments

Comments

@cmacmackin
Copy link

Details

Note: all of this is being done on the development branch; the master branch does not yet have any sphinx documentation.

Expected Result

I am trying to use Sphinx's autodoc features on a project with a compiled Python extension, in order to extract the docstrings contained within the compiled module. To do this, I added the following to my conf.py file:

import subprocess
from sysconfig import get_path
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
if read_the_docs_build:
    complete = subprocess.run(['g++', '-DPEAKINGDUCK_EXPORTS',
                               '-I../thirdparty/pybind11/include',
                               '-I' + get_path('include'),
                               '-I../thirdparty/units/include',
                               '-I../thirdparty/eigen', '-I../include',
                               '-fPIC', '-fvisibility=hidden', '-shared',
                               '-o', '../PEAKINGDUCK.so',
                               '../py/peakingduck.cpp'])

The idea is to build the shared object library before running Sphinx so that autodoc can import it and produce documentation for the methods it provides. This works fine on my local computer, including when setting the READTHEDOCS environment variable to True.

Actual Result

When I tried submitting this to Read the Docs, one of two things happens:

This appears to be the same bug as in #3185, so perhaps building in Conda will help as it did with that issue.

@cmacmackin
Copy link
Author

I have tried switching over to Conda, as this appeared to work in #3185, but this caused the builder to run out of memory: https://readthedocs.org/projects/peakingduck/builds/10549300/

@cmacmackin
Copy link
Author

After some investigation I discovered that the compiler was using too much RAM. I was able to reduce the amount it used sufficiently by playing with configurations of its internal garbage collector. This was achieved with the flags --param ggc-min-expand=10 --param ggc-min-heapsize=16384.

@humitos
Copy link
Member

humitos commented Mar 4, 2020

Thanks for sharing the workaround!

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

No branches or pull requests

2 participants