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

sage.env._get_shared_lib_filename: Fix for MULTIARCH #30901

Closed
tobiasdiez opened this issue Nov 12, 2020 · 32 comments
Closed

sage.env._get_shared_lib_filename: Fix for MULTIARCH #30901

tobiasdiez opened this issue Nov 12, 2020 · 32 comments

Comments

@tobiasdiez
Copy link
Contributor

On distributions that use the multiarch installation scheme, python provides the MULTIARCH sysconfig variable.

We modify sage.env._get_shared_lib_filename to use it.
(Currently it tries to use MULTILIB which does not exist.)
Moreover, I took the opportunity to refactor the code in the _get_shared_lib_filename method to use pathlib.

(extracted from #30371)

CC: @tobiasdiez @kiwifb @tobihan @embray @dimpase

Component: build

Keywords: sd111

Author: Tobias Diez

Branch/Commit: fa4556a

Reviewer: Matthias Koeppe

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

@tobiasdiez tobiasdiez added this to the sage-9.3 milestone Nov 12, 2020
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2020

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

6dd6e5cFix compilation

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2020

Changed commit from 94e20c7 to 6dd6e5c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2020

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

eceefb3Remove string wrap
d345bffFix test

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2020

Changed commit from 6dd6e5c to d345bff

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 12, 2020

comment:4

Why does it change the code for Cygwin? Beyond the scope of the ticket.

And why does it change the doctest to pattern = "*/lib*Singular-*.so"? My guess is that this is untested.

@tobiasdiez
Copy link
Contributor Author

comment:6

Thanks for the review!

I had to change the Cygwin code as it previously took the last match of search_directories, but on the other OS it was the first match. Thus, in order to unify the code I had to change the order. Please view this as part of "Moreover, I took the opportunity to refactor the code in the _get_shared_lib_filename method to use pathlib.".

For the doctest change, the method returns the following path on my system: /usr/lib/x86_64-linux-gnu/libsingular-Singular-4.1.1.so. This is because of the resolve() statement, which follows symlinks. I had to add resolve() since otherwise the singular library doesn't initialize correctly.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2020

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

c47c4bfCorrect indent

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2020

Changed commit from d345bff to c47c4bf

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 13, 2020

comment:8

If you want to make changes to the Cygwin code, then you'll have to test it on Cygwin as well. We have a severe shortage of Cygwin developers/testers and we cannot just replace tested code by untested code.

@tobiasdiez
Copy link
Contributor Author

comment:9

That make sense, I was under the impression that you also have CI for cygwin.

I have tested the code manually during development. After sudo touch /usr/bin/cygSingular-test.dll the following script

import sysconfig
import sys
from sage.env import _get_shared_lib_path

print(sysconfig.get_config_var('BINDIR'))

sys.platform = 'cygwin'
print(_get_shared_lib_path("Singular"))

returns, as expected,

/usr/bin
/usr/bin/cygSingular-test.dll

@dimpase
Copy link
Member

dimpase commented Nov 14, 2020

comment:10

GH Actions cygwin build is very flaky, as it has to be done in stages due to time limits.
We need a dedicated Cygwin runner (GH Actions supports selfhosted runners) to improve it, so that it can be done in one go, I think.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 8, 2020

Changed commit from c47c4bf to 3fcaf5f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 8, 2020

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

3fcaf5fMerge branch 'develop' of git://github.com/sagemath/sage into public/build/multiarchsimple

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 8, 2020

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

090e6f1Simplify code

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 8, 2020

Changed commit from 3fcaf5f to 090e6f1

@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 8, 2020

Changed keywords from none to sd111

@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 14, 2020

comment:14

I think the error handling in src/sage/libs/singular/singular.pyx should not be removed because SINGULAR_SO can be set via sage_conf and hence in this case it is not guaranteed by the new code in sage.env that the file exists

@mkoeppe

This comment has been minimized.

@tobiasdiez
Copy link
Contributor Author

comment:17

Replying to @mkoeppe:

I think the error handling in src/sage/libs/singular/singular.pyx should not be removed because SINGULAR_SO can be set via sage_conf and hence in this case it is not guaranteed by the new code in sage.env that the file exists

There were two existence checks in singular.pyx. The current version still contains if not SINGULAR_SO or not os.path.exists(SINGULAR_SO).

@tobiasdiez

This comment has been minimized.

@tobiasdiez
Copy link
Contributor Author

comment:18

By the way, I didn't change the variables to Path. That was the case in a previous version, but for the sage of keeping the changes confined I've removed it again.

@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 16, 2020

comment:19

Replying to @tobiasdiez:

By the way, I didn't change the variables to Path. That was the case in a previous version, but for the sage of keeping the changes confined I've removed it again.

Thanks for pointing this out. But then I think the renaming of _get_shared_lib_filename to _get_shared_lib_path also should not be done.

Also, please let's get rid of the helper function _get_sage_local.

@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 16, 2020

comment:20

The Cygwin tests are now a bit more robust and although it did not run through completely because of an unrelated problem, it seems OK.

@tobiasdiez
Copy link
Contributor Author

comment:21

Replying to @mkoeppe:

But then I think the renaming of _get_shared_lib_filename to _get_shared_lib_path also should not be done.

But it's the complete path (as a string) that is returned, and not just the name of the file (relative to some folder).

@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 17, 2020

comment:22

OK, fine

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 18, 2020

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

fa4556aRemove _get_sage_local

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 18, 2020

Changed commit from 090e6f1 to fa4556a

@tobiasdiez
Copy link
Contributor Author

comment:24

Replying to @mkoeppe:

Also, please let's get rid of the helper function _get_sage_local.

Done!

@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 18, 2020

@tobiasdiez
Copy link
Contributor Author

comment:26

Thanks!

@vbraun
Copy link
Member

vbraun commented Dec 27, 2020

Changed branch from public/build/multiarchsimple to fa4556a

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

4 participants