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

Bump to Flint version 3 #80

Merged
merged 3 commits into from
Sep 12, 2023
Merged

Conversation

GiacomoPope
Copy link
Contributor

This PR follows #43 but from the latest commits to master avoiding conflicts.

@GiacomoPope
Copy link
Contributor Author

Hmm some things are now failing, so I imagine I've messed up this PR. I'll work through the error messages.

Error: Command ['python', '-m', 'pip', 'wheel', PurePosixPath('/project'), '--wheel-dir=/tmp/cibuildwheel/built_wheel', '--no-deps'] failed with code 1. 

Checking for common errors...
Error: Process completed with exit code 1.

Doesn't look like the most helpful message though! :D

@oscarbenjamin
Copy link
Collaborator

The error is

        INFO: gcc: src/flint/types/fmpz.c
        src/flint/types/fmpz.c:1121:10: fatal error: partitions.h: No such file or directory
         1121 | #include "partitions.h"
              |          ^~~~~~~~~~~~~~
        compilation terminated.

You have to expand the little triangle on the line that says "Building wheel..." to see the build failures from cibuildwheel in GitHub Actions.

@GiacomoPope
Copy link
Contributor Author

You have to expand the little triangle on the line that says "Building wheel..." to see the build failures from cibuildwheel in GitHub Actions

Yeah I had just done that and I've pushed a fix, thanks for the help

@GiacomoPope
Copy link
Contributor Author

GiacomoPope commented Sep 11, 2023

Hmm the tests on the CI pass but I seem to have some issues locally, not 100% sure this is ready yet.

Some errors on compiling:

INFO: compile options: '-I/usr/local/include -I/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include -I/usr/local/include/flint -I/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/flint -I/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c'
INFO: clang: src/flint/types/fmpz_poly.c
In file included from src/flint/types/fmpz_poly.c:1149:
In file included from .local/include/flint/arb_poly.h:21:
In file included from .local/include/flint/fmpq_types.h:15:
.local/include/flint/fmpz_types.h:29:1: error: typedef redefinition with different types ('struct fmpz_factor_struct' vs 'struct fmpz_factor_struct')
fmpz_factor_struct;
^
/usr/local/include/flint/fmpz_factor.h:35:3: note: previous definition is here
} fmpz_factor_struct;
  ^
In file included from src/flint/types/fmpz_poly.c:1149:
In file included from .local/include/flint/arb_poly.h:21:
In file included from .local/include/flint/fmpq_types.h:15:
.local/include/flint/fmpz_types.h:38:3: error: typedef redefinition with different types ('struct fmpz_preinvn_struct' vs 'struct fmpz_preinvn_struct')
} fmpz_preinvn_struct;
  ^
/usr/local/include/flint/fmpz.h:55:3: note: previous definition is here
} fmpz_preinvn_struct;
  ^
In file included from src/flint/types/fmpz_poly.c:1149:
In file included from .local/include/flint/arb_poly.h:21:
In file included from .local/include/flint/fmpq_types.h:15:
.local/include/flint/fmpz_types.h:48:1: error: typedef redefinition with different types ('struct fmpz_poly_struct' vs 'struct fmpz_poly_struct')
fmpz_poly_struct;
^
/usr/local/include/flint/fmpz_poly.h:53:3: note: previous definition is here
} fmpz_poly_struct;
  ^
In file included from src/flint/types/fmpz_poly.c:1149:
In file included from .local/include/flint/arb_poly.h:21:
In file included from .local/include/flint/fmpq_types.h:15:
.local/include/flint/fmpz_types.h:60:1: error: typedef redefinition with different types ('struct fmpz_poly_factor_struct' vs 'struct fmpz_poly_factor_struct')
fmpz_poly_factor_struct;
^
/usr/local/include/flint/fmpz_poly.h:71:3: note: previous definition is here
} fmpz_poly_factor_struct;
  ^
In file included from src/flint/types/fmpz_poly.c:1149:
In file included from .local/include/flint/arb_poly.h:21:
In file included from .local/include/flint/fmpq_types.h:15:
.local/include/flint/fmpz_types.h:71:1: error: typedef redefinition with different types ('struct fmpz_mat_struct' vs 'struct fmpz_mat_struct')
fmpz_mat_struct;
^
/usr/local/include/flint/fmpz_mat.h:46:3: note: previous definition is here
} fmpz_mat_struct;
  ^
In file included from src/flint/types/fmpz_poly.c:1149:
In file included from .local/include/flint/arb_poly.h:21:
.local/include/flint/fmpq_types.h:39:1: error: typedef redefinition with different types ('struct fmpq_poly_struct' vs 'struct fmpq_poly_struct')
fmpq_poly_struct;
^
/usr/local/include/flint/fmpq_poly.h:42:3: note: previous definition is here
} fmpq_poly_struct;

Maybe I just have some flint2 and flint3 polluting things. I'll try and fix that, ('struct fmpz_factor_struct' vs 'struct fmpz_factor_struct') is a weird one though!

@oscarbenjamin
Copy link
Collaborator

Maybe I just have some flint2 and flint3 polluting things.

It is better to keep a local build of Flint etc for python-flint development. That is why the build scripts build in .local which also means that you can just rm -rf .local any time you want to start again.

@GiacomoPope
Copy link
Contributor Author

Yeah I have deleted the .local and all the errors are the same (you can see that in the error inlucded from... error. Not really sure what the issue could be.

@GiacomoPope
Copy link
Contributor Author

GiacomoPope commented Sep 11, 2023

Has it just got to do with the cython names colliding with the C ones? e.g. this line in the scraping script:

# rename types to avoid python -- c name collisions
rename_types = [(re.compile(r"\bfmpz\b"),"fmpz_struct"),(re.compile(r"\bfmpq\b"), "fmpq_struct")]

@oscarbenjamin
Copy link
Collaborator

You have a build of Flint in /usr/local.

.local/include/flint/fmpz_types.h:29:1: error: typedef redefinition with different types ('struct fmpz_factor_struct' vs 'struct fmpz_factor_struct')
fmpz_factor_struct;
^
/usr/local/include/flint/fmpz_factor.h:35:3: note: previous definition is here

This is being picked up somehow.

@oscarbenjamin
Copy link
Collaborator

I don't see the nmod_poly_factor.pxd file in this PR.

@GiacomoPope
Copy link
Contributor Author

It's this file: https://github.com/GiacomoPope/python-flint/blob/flint3/src/flint/flintlib/nmod_poly_factor.pxd

Or am I missing something inside /types/?

@oscarbenjamin
Copy link
Collaborator

Oh, yes it was added separately

@oscarbenjamin
Copy link
Collaborator

I think that the errors that you see are just because you have a Flint 2 installed into /usr/local. Maybe remove that and try again.

@GiacomoPope
Copy link
Contributor Author

GiacomoPope commented Sep 11, 2023

If I uninstall the /local/ flint and compile I get no errors but when running the tests I get a weird error:

Jack: python-flint % ls /usr/local/include/flint/
ls: /usr/local/include/flint/: No such file or directory
Jack: python-flint % python3 -m flint.test --tests                                                               
Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 112, in _get_module_details
  File "/Users/Jack/Documents/GitHub/python-flint/src/flint/__init__.py", line 1, in <module>
    from .pyflint import *
ImportError: dlopen(/Users/Jack/Documents/GitHub/python-flint/src/flint/pyflint.cpython-311-darwin.so, 0x0002): Library not loaded: /usr/local/opt/flint/lib/libflint-17.dylib
  Referenced from: <BE5AA1EA-63E8-34DA-A9CA-D471A88D424F> /Users/Jack/Documents/GitHub/python-flint/src/flint/pyflint.cpython-311-darwin.so
  Reason: tried: '/usr/local/opt/flint/lib/libflint-17.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/flint/lib/libflint-17.dylib' (no such file), '/usr/local/opt/flint/lib/libflint-17.dylib' (no such file), '/usr/local/lib/libflint-17.dylib' (no such file), '/usr/lib/libflint-17.dylib' (no such file, not in dyld cache)

I have no idea why the changes made would be doing this and don't have that much time to debug my side tonight. Something about this change has meant all the path stuff is weird

@oscarbenjamin
Copy link
Collaborator

You need to remove the runtime shared libraries as well as the header files before recompiling:

$ ls .local/lib/
libarb.so         libflint.so.17      libgmp.la         libmpfr.la        pkgconfig
libarb.so.2       libflint.so.17.0.0  libgmp.so         libmpfr.so
libarb.so.2.14.0  libflint.so.18      libgmp.so.10      libmpfr.so.6
libflint.so       libflint.so.18.0.0  libgmp.so.10.4.1  libmpfr.so.6.1.0

What does ls /usr/local/lib show?

@GiacomoPope
Copy link
Contributor Author

I'll have an explore tomorrow but I'm really confused about exactly what has caused this to break, unless everything was always drawing from /local/ for me and now the breakage is that I used to have 2.9 and now have 3.0...

@GiacomoPope
Copy link
Contributor Author

GiacomoPope commented Sep 12, 2023

I messed around with a few things this morning and now it all magically works my end. Kind of confused but I think this is good to go now

@oscarbenjamin
Copy link
Collaborator

Okay, looks good!

Let's get this in so we don't have to resolve merge conflicts for a fourth time.

@oscarbenjamin oscarbenjamin merged commit 22cc77c into flintlib:master Sep 12, 2023
16 checks passed
@GiacomoPope GiacomoPope deleted the flint3 branch August 12, 2024 16:41
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

Successfully merging this pull request may close these issues.

2 participants