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

opensuse-tumbleweed: python3 build fails because of openssl #34273

Closed
mkoeppe opened this issue Aug 3, 2022 · 28 comments
Closed

opensuse-tumbleweed: python3 build fails because of openssl #34273

mkoeppe opened this issue Aug 3, 2022 · 28 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 3, 2022

Our OpenSUSE system package info leads to the installation of LibreSSL, which is not compatible with the python3 build.

[python3-3.10.6] checking whether compiling and linking against OpenSSL works... yes
[python3-3.10.6] checking for --with-openssl-rpath... 
[python3-3.10.6] checking whether OpenSSL provides required APIs... no
[python3-3.10.6] checking for --with-ssl-default-suites... python
[python3-3.10.6] checking for --with-builtin-hashlib-hashes... md5,sha1,sha256,sha512,sha3,blake2
[python3-3.10.6] checking for --with-experimental-isolated-subinterpreters... no
[python3-3.10.6] checking for --with-static-libpython... yes
[python3-3.10.6] checking for --disable-test-modules... no
[python3-3.10.6] configure: creating ./config.status

Our configure script does not know that.

We update the distro file and add an additional check to openssl spkg-configure.m4

To test: tox -e docker-opensuse-tumbleweed-standard -- V=1 python3

CC: @sagetrac-tmonteil @dimpase

Component: packages: standard

Author: Matthias Koeppe

Branch/Commit: d46f190

Reviewer: Kwankyu Lee

Issue created by migration from https://trac.sagemath.org/ticket/34273

@mkoeppe mkoeppe added this to the sage-9.7 milestone Aug 3, 2022
@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 4, 2022

comment:2
configure:17891: gcc -o conftest  -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden   -Wl,-rpath-link,/sage/local/lib -L/sage/local/lib -Wl,-rpath,/sage/local/lib -Wl,-rpath-link,/sage/local/lib -L/sage/local/lib -Wl,-rpath,/sage/local/lib   conftest.c -lcrypt -ldl  -lm -lssl -lcrypto  >&5
conftest.c: In function 'main':
conftest.c:442:12: error: 'NID_sha3_512' undeclared (first use in this function); did you mean 'NID_sha512'?
  442 | OBJ_nid2sn(NID_sha3_512);
      |            ^~~~~~~~~~~~
      |            NID_sha512
conftest.c:442:12: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:443:12: error: 'NID_blake2b512' undeclared (first use in this function)
  443 | OBJ_nid2sn(NID_blake2b512);
      |            ^~~~~~~~~~~~~~
conftest.c:444:1: error: implicit declaration of function 'EVP_PBE_scrypt'; did you mean 'EVP_PKEY_decrypt'? [-Werror=implicit-function-declaration]
  444 | EVP_PBE_scrypt(NULL, 0, NULL, 0, 2, 8, 1, 0, NULL, 0);
      | ^~~~~~~~~~~~~~
      | EVP_PKEY_decrypt
cc1: some warnings being treated as errors
configure:17891: $? = 1

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 4, 2022

comment:3

We should probably explicitly install libopenssl-3-devel

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 4, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 4, 2022

comment:5

We should probably get the more detailed configure check from Python:
https://github.com/python/cpython/blob/main/configure.ac#L6823


New commits:

de3e0f3build/pkgs/openssl/distros/opensuse.txt: Use libopenssl-3-devel

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 4, 2022

Commit: de3e0f3

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 4, 2022

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 4, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

d46f190build/pkgs/openssl/spkg-configure.m4: Add API check from python3 configure.ac

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 4, 2022

Changed commit from de3e0f3 to d46f190

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 4, 2022

Author: Matthias Koeppe

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 4, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

a9eaae5tox.ini, build/bin/write-dockerfile.sh: Add 'tox -e docker-...-incremental'
b9bfbf9tox.ini: Add comment
4c0d7f5tox.ini: Use FROM_DOCKER_REPOSITORY
a07874dbuild/bin/write-dockerfile.sh: In incremental build, keep logs
ae269d1tox.ini (docker-incremental): Do not include '-incremental' in the Docker image name
b354a38tox.ini, .github/workflows/docker.yml: Reimplement -incremental via SKIP_SYSTEM_PACKAGES
5decaddbuild/bin/write-dockerfile.sh: Do not use persistent env var PACKAGES (except on nix)
49ebf1bMerge #34228

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 4, 2022

Changed commit from d46f190 to 49ebf1b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 4, 2022

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 4, 2022

Changed commit from 49ebf1b to d46f190

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 5, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 5, 2022

comment:16

This fixes it. Let's get it in

@kwankyu
Copy link
Collaborator

kwankyu commented Aug 8, 2022

comment:18

I ran the test and got: docker-opensuse-tumbleweed-standard: commands succeeded.

I am new to this business, and let me ask some naive questions. What was the sign of failure (of LibreSSL)? From the tox test, I still get

[python3-3.10.5] checking whether compiling and linking against OpenSSL works... yes
[python3-3.10.5] checking for --with-openssl-rpath... 
[python3-3.10.5] checking whether OpenSSL provides required APIs... yes
[python3-3.10.5] checking for --with-ssl-default-suites... python
[python3-3.10.5] checking for --with-builtin-hashlib-hashes... md5,sha1,sha256,sha512,sha3,blake2
[python3-3.10.5] checking for --with-experimental-isolated-subinterpreters... no
[python3-3.10.5] checking for --with-static-libpython... yes
[python3-3.10.5] checking for --disable-test-modules... no

which seems not much different from the excerpt in the ticket description... How do I check if libopenssl-3-devel works with python3 well? Is the message Sage build/upgrade complete! enough?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 8, 2022

comment:19

Thanks for testing!

The crucial line in python3's configure output is this:

[python3-3.10.5] checking whether OpenSSL provides required APIs... yes

... which has changed from "no".

I should have added a link to a failing build for reference. In https://github.com/sagemath/sage/actions, selecting "CI Linux", there is a completed run for 9.7.beta7, https://github.com/sagemath/sage/actions/runs/2777704621

Selecting "docker / linux (opensuse-tumbleweed, standard)" from the sidebar, one gets to https://github.com/sagemath/sage/runs/7619552751, which shows the end of the failing build of the python3 SPKG:

  [python3-3.10.5]   
  [python3-3.10.5]   Failed to build these modules:
  [python3-3.10.5]   _hashlib              _ssl                                     
  [python3-3.10.5]   
  [python3-3.10.5]   
  [python3-3.10.5]   Could not build the ssl module!
  [python3-3.10.5]   Python requires a OpenSSL 1.1.1 or newer
  [python3-3.10.5]   
  ...
  [python3-3.10.5]   Testing importing of various modules...
  [python3-3.10.5]   ctypes module imported OK
  [python3-3.10.5]   math module imported OK
  [python3-3.10.5]   hashlib module imported OK
  [python3-3.10.5]   crypt module imported OK
  [python3-3.10.5]   socket module imported OK
  [python3-3.10.5]   zlib module imported OK
  [python3-3.10.5]   sqlite3 module imported OK
  [python3-3.10.5]   Traceback (most recent call last):
  [python3-3.10.5]     File "<string>", line 1, in <module>
  [python3-3.10.5]     File "/sage/local/var/lib/sage/venv-python3.10.5/var/tmp/sage/build/python3-3.10.5/src/Lib/ssl.py", line 99, in <module>
  [python3-3.10.5]       import _ssl             # if we can't import it, let the error propagate
  [python3-3.10.5]   ModuleNotFoundError: No module named '_ssl'
  [python3-3.10.5]   ssl module failed to import
  [python3-3.10.5]   Error: One or more modules failed to import.
  [python3-3.10.5]   
  [python3-3.10.5]   real	5m46.942s
  [python3-3.10.5]   user	2m41.648s
  [python3-3.10.5]   sys	0m17.654s
  [python3-3.10.5]   ************************************************************************
  [python3-3.10.5]   Error building package python3-3.10.5
  [python3-3.10.5]   ************************************************************************
  [python3-3.10.5] Full log file: /sage/logs/pkgs/python3-3.10.5.log
make[2]: *** [Makefile:2930: python3-SAGE_VENV-no-deps] Error 1

What happened there is that Python did not build the _ssl module because it did not find a suitable openssl. Python reports this with the message "Could not build the ssl module!" This is only an info message.

Our script https://github.com/sagemath/sage-prod/blob/develop/build/pkgs/python3/spkg-build.in#L120 then checks again for the required modules and exits with an error.

How do I check if libopenssl-3-devel works with python3 well? Is the message Sage build/upgrade complete! enough?

I would say it is not necessary to do more testing than what our build script does.

@kwankyu
Copy link
Collaborator

kwankyu commented Aug 8, 2022

comment:20

Replying to @mkoeppe:

I would say it is not necessary to do more testing than what our build script does.

Okay. Now I understand the situation better. So the success of the tox test has shown that your branch works well (otherwise python build script would have failed).

The relevant github workflow is still running. So let us wait for the result to double-check.

The branch itself seems good as far as I can judge.

@kwankyu
Copy link
Collaborator

kwankyu commented Aug 8, 2022

comment:21

Another test would be to install pkgconfig(libssl) system package, and to check if the configure correctly decide to install openssl from source. Right?

It is quite out of my technical reach though. Have you tried it?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 8, 2022

comment:22

Yes, I tested this. If you want to test it, you can just git revert de3e0f3d5d405ef0f255aaf6d9934f86c72fcca7 and then run tox -e docker-opensuse-tumbleweed-standard -- config.status

@kwankyu
Copy link
Collaborator

kwankyu commented Aug 9, 2022

comment:23

Replying to @mkoeppe:

Yes, I tested this. If you want to test it, you can just git revert de3e0f3d5d405ef0f255aaf6d9934f86c72fcca7 and then run tox -e docker-opensuse-tumbleweed-standard -- config.status

Ah, easy. I did it, and the configure worked correctly.

@kwankyu
Copy link
Collaborator

kwankyu commented Aug 9, 2022

comment:24

Replying to @kwankyu:

The relevant github workflow is still running. So let us wait for the result to double-check.

It would take too long to get the result. As this is simply double-checking the correct result I got locally, I will skip it.

Then, positive review to this ticket.

@kwankyu
Copy link
Collaborator

kwankyu commented Aug 9, 2022

Changed reviewer from https://github.com/mkoeppe/sage/runs/7682738998 to Kwankyu Lee

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 9, 2022

comment:25

Thank you!

@vbraun
Copy link
Member

vbraun commented Aug 29, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants