can't build python part with C modules
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Snapcraft |
Undecided
|
Unassigned |
Bug Description
Building python packages that have C modules fails with snapcraft as C headers are not found.
This is a sample snap that fails building on Bionic:
name: test
version: '1.0'
summary: test
description: test
grade: stable
confinement: strict
base: core18
apps:
uwsgi:
command: uwsgi
parts:
uwsgi:
plugin: python
source: .
python-
- uWSGI
build-packages:
- python3-dev
stage-packages:
- libpython3.6
exporting C_INCLUDE_
Tested with both stable (2.43.1) and candidate (3.0) snaps.
Also, removing the core18 base and using libpython3.5 when building on xenial shows the same issue
description: | updated |
description: | updated |
description: | updated |
Alberto Donato (ack) wrote : | #1 |
林博仁(Buo-ren, Lin) (buo-ren-lin) wrote : | #2 |
> This is a bigger issue when building with VMs in snapcraft 3, as there's no way to export C_INCLUDE_PATH.
You can use the `build-environment` key, refer https:/
For legacy Snapcraft syntax you have to override the build step and build the part manually, or [write a local plugin](https:/
林博仁(Buo-ren, Lin) (buo-ren-lin) wrote : | #3 |
Here's the part recipe that fixes the problem:
```
parts:
uwsgi:
plugin: python
source: .
python-
- uWSGI
build-packages:
- python3-dev
build-
- C_INCLUDE_PATH: /usr/include/
stage-packages:
- libpython3.6
```
I noticed that "/usr/include/
Alberto Donato (ack) wrote : | #4 |
Thanks, that's much nicer that having to export it outside of snapcraft!
Still, I think this bug is valid as snapcraft should pass that export itself in the python plugin, as it knows the python version that's being used.
This is a bigger issue when building with VMs in snapcraft 3, as there's no way to export C_INCLUDE_PATH.
FWIW I also tried
override-build: | PATH=/usr/ include/ python3. 6
export C_INCLUDE_
snapcraftctl build
but that didn't work for me either