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

Unable to build EE images: python module build fails #206

Closed
lemmy04 opened this issue Apr 16, 2021 · 8 comments
Closed

Unable to build EE images: python module build fails #206

lemmy04 opened this issue Apr 16, 2021 · 8 comments

Comments

@lemmy04
Copy link

lemmy04 commented Apr 16, 2021

I've managed to get ansible-builder past the first problems with building images (See ansible/awx#9917), now installation of the python modules listed in requrements.txt fails:

lemmy@kumiko:~/Work/k3s-appsrv.eregion.home/AWX/awx-ee-community> ansible-builder build --tag quay.io/mhomann/awx-ee-community:0.0.1 --context ./context --container-runtime docker --build-arg ANSIBLE_RUNNER_IMAGE=quay.io/ansible/awx-ee:0.1.1
Running command:
  docker build -f ./context/Dockerfile -t quay.io/mhomann/awx-ee-community:0.0.1 --build-arg=ANSIBLE_RUNNER_IMAGE=quay.io/ansible/awx-ee:0.1.1 ./context
Running command:
  docker run --rm -v /usr/lib/python3.6/site-packages/ansible_builder:/ansible_builder_mount:Z quay.io/mhomann/awx-ee-community:0.0.1 python3 /ansible_builder_mount/introspect.py
File ./context/_build/bindep_combined.txt had modifications and will be rewritten
File ./context/_build/requirements_combined.txt had modifications and will be rewritten
Running command:
  docker build -f ./context/Dockerfile -t quay.io/mhomann/awx-ee-community:0.0.1 --build-arg=ANSIBLE_RUNNER_IMAGE=quay.io/ansible/awx-ee:0.1.1 ./context
...showing last 20 lines of output...
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/curl
    copying python/curl/__init__.py -> build/lib.linux-x86_64-3.8/curl
    running build_ext
    building 'pycurl' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYCURL_VERSION="7.43.0.6" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/usr/include/python3.8 -c src/docstrings.c -o build/temp.linux-x86_64-3.8/src/docstrings.o
    In file included from src/docstrings.c:4:
    src/pycurl.h:5:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-16wp_vrq/pycurl_07cebe73bbfc4e458fe8a17a161be72e/setup.py'"'"'; __file__='"'"'/tmp/pip-install-16wp_vrq/pycurl_07cebe73bbfc4e458fe8a17a161be72e/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-3zgxikkd/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/pycurl Check the logs for full command output.
The command '/bin/sh -c assemble' returned a non-zero code: 1

An error occured (rc=1), see output line(s) above for details.
@shanemcd
Copy link
Member

Can you tell which dependency is trying to pull in pycurl? I'm not seeing it in the dep list for either dnspython or winrm, which you mentioned in your awx issue.

Ideally, the collections themselves would include the proper metadata so ansible-builder could do the right thing™ for you. If you can help us identify which collection needs this dependency, we can get that fixed the right way.

Anyway, in the meantime, you can do this:

  • Create a file called bindep.txt with the following content:
python38-devel [platform:rpm compile]

Then reference it in your execution-environment.yml like this:

---
version: 1
dependencies:
  # snip
  system: bindep.txt

@lemmy04
Copy link
Author

lemmy04 commented Apr 16, 2021

Enter passphrase for /runner/artifacts/9654/ssh_key_data: 
Identity added: /runner/artifacts/9654/ssh_key_data (/runner/artifacts/9654/ssh_key_data)
SSH password: 
BECOME password[defaults to SSH password]: 
cripple-windows | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

next possible occasion that isn't purely virtual due to corona, you, me, beers. possibly more than one.

@lemmy04
Copy link
Author

lemmy04 commented Apr 16, 2021

Anyway, my best guess for the PyCURL requirement would be winrm, isn't that protocol basically https?

@pabelanger
Copy link
Contributor

you need to add python38-devel [compile] into your bindep.txt file, as it is a build-time requirement.

@ilijamt
Copy link

ilijamt commented Apr 29, 2021

Even running it with empty requirements and collections, I still get the same error. I just wanted to run the ansible builder to try it out. Same issue.

@pabelanger
Copy link
Contributor

@ilijamt what does your bindep.txt file look like?

@duntonr
Copy link

duntonr commented May 18, 2021

After having a working custom build with 0.1.0, I started having this issue again with 0.2.0. It fails on cryptography, which seems to be a well-known issue (watson-developer-cloud/python-sdk#418 for example)

I got it working by updating my bindep.txt to

python38-devel      [platform:rpm compile]
python38-dev        [platform:dpkg]
gcc-c++             [platform:rpm]
subversion          [platform:rpm]
subversion          [platform:dpkg]
git-lfs             [platform:rpm]

note addition of additional python38 package but mainly the gcc-c++ package, cribbed from https://github.com/openstack/openstack-ansible/blob/master/bindep.txt

@kdelee
Copy link
Member

kdelee commented Jun 4, 2021

Looks like this has worked itself out, open another issue if you have a new error

@kdelee kdelee closed this as completed Jun 4, 2021
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

6 participants