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

charm build fails when compiling c modules in Python dependencies #510

Open
pengale opened this issue Mar 13, 2019 · 3 comments
Open

charm build fails when compiling c modules in Python dependencies #510

pengale opened this issue Mar 13, 2019 · 3 comments

Comments

@pengale
Copy link

pengale commented Mar 13, 2019

If you attempt to build a charm that needs to compile c modules for one of the Python dependencies, it will fail, as charm tools can't see the system python headers.

To reproduce, try building charm-octavia (https://github.com/openstack/charm-octavia), and you should see the error.

Note that this may not be fixable, and it's not a great idea to build c modules in a charm, anyway, as you introduce dependencies on the architecture of your build machine. The snap should fail more gracefully, however, and we should document workarounds.

@johnsca johnsca transferred this issue from juju/charm-helpers Mar 13, 2019
@pengale
Copy link
Author

pengale commented Mar 13, 2019

You can workaround the issue by running the following:

snap run --shell charm
$SNAP/usr/bin/python3.6 $SNAP/bin/charm-build

@johnsca
Copy link
Contributor

johnsca commented Aug 19, 2019

We're using pip download specifically to avoid installation / building, so I'm really unclear why pip is trying to do any compilation at all.

@johnsca
Copy link
Contributor

johnsca commented Sep 11, 2019

I think a big part of the issue with pip download is that because Python packages historically have used code (setup.py) to define their metadata, dependencies, and installation all together, it's perhaps impossible to realistically separate dependency resolution from installation. The move toward the pyproject.toml approach seems like it may eventually improve this situation, but inertia and legacy mean that this is not going to resolve the issue for a long time. So we're left with the situation that snaps, even classically confined, seem fundamentally opposed to the idea of downloading and building arbitrary code / packages within the snap's namespace.

We should look to how snapcraft handles this process and use the same approach. Specifically, I like the idea of using multipass or lxd to do the building "remotely" with hooks to allow for setting up the build environment while keeping it contained and separated from the building snap.

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