moan0s / matrix-registration-bot

A bot that is used to create and manage registration tokens for a matrix server
GNU Affero General Public License v3.0
67 stars 10 forks source link

Can't build latest version #24

Closed olivercoad closed 1 year ago

olivercoad commented 1 year ago

Hi,

This doesn't docker build on version 1.2.2. It has an error when trying to setup python-olm

This means it is broken with matrix-docker-ansible-deploy on arm64 because the only image published is for amd64, so it builds the latest version instead of pulling the pre-build docker image.

#7 25.78   Running setup.py install for logbook: started
#7 26.14   Running setup.py install for logbook: finished with status 'done'
#7 27.25   DEPRECATION: future is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
#7 27.25   Running setup.py install for future: started
#7 27.83   Running setup.py install for future: finished with status 'done'
#7 27.93   DEPRECATION: atomicwrites is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
#7 27.93   Running setup.py install for atomicwrites: started
#7 28.18   Running setup.py install for atomicwrites: finished with status 'done'
#7 28.36   DEPRECATION: python-olm is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
#7 28.36   Running setup.py install for python-olm: started
#7 28.70   Running setup.py install for python-olm: finished with status 'error'
#7 28.70   error: subprocess-exited-with-error
#7 28.70   
#7 28.70   × Running setup.py install for python-olm did not run successfully.
#7 28.70   │ exit code: 1
#7 28.70   ╰─> [31 lines of output]
#7 28.70       make: *** No rule to make target '../include/olm/olm.h', needed by 'include/olm/olm.h'.  Stop.
#7 28.70       running install
#7 28.70       /opt/venv/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
#7 28.70         warnings.warn(
#7 28.70       running build
#7 28.70       running build_py
#7 28.70       creating build
#7 28.70       creating build/lib.linux-x86_64-cpython-311
#7 28.70       creating build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/group_session.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/_compat.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/__version__.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/sas.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/account.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/__init__.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/utility.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/pk.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/session.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       copying olm/_finalize.py -> build/lib.linux-x86_64-cpython-311/olm
#7 28.70       running build_ext
#7 28.70       generating cffi module 'build/temp.linux-x86_64-cpython-311/_libolm.c'
#7 28.70       creating build/temp.linux-x86_64-cpython-311
#7 28.70       building '_libolm' extension
#7 28.70       creating build/temp.linux-x86_64-cpython-311/build
#7 28.70       creating build/temp.linux-x86_64-cpython-311/build/temp.linux-x86_64-cpython-311
#7 28.70       gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/opt/venv/include -I/usr/local/include/python3.11 -c build/temp.linux-x86_64-cpython-311/_libolm.c -o build/temp.linux-x86_64-cpython-311/build/temp.linux-x86_64-cpython-311/_libolm.o -I../include
#7 28.70       build/temp.linux-x86_64-cpython-311/_libolm.c:570:18: fatal error: olm/olm.h: No such file or directory
#7 28.70         570 |         #include <olm/olm.h>
#7 28.70             |                  ^~~~~~~~~~~
#7 28.70       compilation terminated.
#7 28.70       error: command '/usr/bin/gcc' failed with exit code 1
#7 28.70       [end of output]
#7 28.70   
#7 28.70   note: This error originates from a subprocess, and is likely not a problem with pip.
#7 28.71 error: legacy-install-failure
#7 28.71 
#7 28.71 × Encountered error while trying to install package.
#7 28.71 ╰─> python-olm
#7 28.71 
#7 28.71 note: This is an issue with the package mentioned above, not pip.
#7 28.71 hint: See above for output from the failure.
#7 28.78 
#7 28.78 [notice] A new release of pip available: 22.3 -> 22.3.1
#7 28.78 [notice] To update, run: python -m pip install --upgrade pip
------
executor failed running [/bin/sh -c /opt/venv/bin/pip install --no-cache-dir matrix-registration-bot==1.2.2]: exit code: 1
moan0s commented 1 year ago

Yes, that's a serious issue. Did you have any success solving this?

olivercoad commented 1 year ago

By manually building a previous version.

On Thu., 15 Dec. 2022, 04:04 Julian-Samuel Gebühr, @.***> wrote:

Yes, that's a serious issue. Did you have any success solving this?

— Reply to this email directly, view it on GitHub https://github.com/moan0s/matrix-registration-bot/issues/24#issuecomment-1351778768, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5P62VEYJFOP4XQIRAPKMDWNH4YZANCNFSM6AAAAAASEI5KGA . You are receiving this because you authored the thread.Message ID: @.***>

SapuSeven commented 1 year ago

If you still have problems, use the following patch to fix the current version:

diff --git a/Dockerfile b/Dockerfile
index 934616c..5a53d37 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
 FROM python:3-slim AS compile-image
 MAINTAINER Julian-Samuel Gebühr

-RUN apt-get update && apt-get install -y --no-install-recommends build-essential gcc
+RUN apt-get update && apt-get install -y --no-install-recommends build-essential gcc libolm-dev

 RUN python -m venv /opt/venv
 RUN /opt/venv/bin/pip install --no-cache-dir matrix-registration-bot

As far as I can see, develop already has those changes, so if you are using matrix-docker-ansible-deploy you can just add the following line to your vars.yml for now:

matrix_bot_matrix_registration_bot_docker_repo_version: develop

I hope we can merge and release a new version soon to fix this issue.

moan0s commented 1 year ago

I think this is fixed with 3262c0d116e74bdc59d681d5e95bac940be39b01 if not feel free to reopen :)

Mawarii commented 11 months ago

I'm still getting an error while building the Dockerfile. Still a python-olm issue. I tried to build it on arm64 and amd64 but had no luck. So I tried to fix it. And it seems that only the python3 images have those problems. So I switched to a plain debian (maybe there is a better choice) and I was able to build it on arm64 and amd64 with no issue.

FROM debian:12-slim AS compile-image
MAINTAINER Julian-Samuel Gebühr

RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-venv python3-dev build-essential gcc libolm-dev

RUN python3 -m venv /opt/venv

WORKDIR /app
COPY requirements.txt ./
RUN /opt/venv/bin/pip install -r requirements.txt
COPY . .
RUN /opt/venv/bin/pip install .
RUN /opt/venv/bin/pip install matrix-nio==0.20.2

FROM debian:12-slim

RUN apt-get update && apt-get install -y python3 python3-dev libolm-dev
COPY --from=compile-image /opt/venv /opt/venv

VOLUME ["/data"]
WORKDIR /data

CMD ["/opt/venv/bin/matrix-registration-bot"]
Mawarii commented 11 months ago

OK the build works, but the image is running into issues. I don't know why. I will try to investigate more in the next days.