-
Notifications
You must be signed in to change notification settings - Fork 140
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
pydantic v2 #1017
Comments
Related: #995 |
This worked for me.
|
Originally posted by @caarmen in #995 (comment) Would like to be able to use pydantic 2. Some libs seem to require it (ex: ariadne-codegen: mirumee/ariadne-codegen#186 ) |
Originally posted by @IsakTheHacker in #995 I need the pydantic package for my app which depends on the native pydantic-core package written in Rust. I have tried following the guide for building Cryptography version 39 and read #657. It is hard to understand exactly what I need to do to set up Rust support when there is no official documentation. For example, do I need to cross-compile Python as described here or is that specific to the Cryptogaphy package? |
@IsakTheHacker: I'll try to centralize all the notes about Rust in a single place: #1030. |
Is there a method to manually build and insert the module? I don't need the latest version each time, but since I need to build for Android and iOS. Neither are currently functioning. |
Since
|
Originally posted by @maciekglowka in #1261 (comment) Would this approach [from #1261] work for crates that don't support ABI3 ? I am currently trying to build pydantic core, but due to a Originally posted by @emanuele-f in #1261 (comment) Hello, no, for non-ABI3 modules currently you will still need to cross compile the Python interpreter as explained in #657 Originally posted by @maciekglowka in #1261 (comment) Shoot....thanks for the quick answer though. I was worried that'd be the case (after spending half a day again trying different configurations). |
@maciekglowka: Are the libgcc errors the same as in #1142? If so, that probably indicates that the build is using the Linux compiler rather than the Android one. The current NDK has replaced GCC with Clang, so I don't think libgcc even exists for Android anymore. |
@mhsmith that's the issue. No libgcc to link to (as it's not in the android toolchain anymore). I've tried to use rust's nightly feature to build the std lib from source (https://doc.rust-lang.org/cargo/reference/unstable.html#build-std) but no success yet. |
You mean the Rust std lib? Why would you need to rebuild that? If Rust has Android support, doesn't it provide a pre-compiled copy?
No, that's the wrong approach. Libgcc is very closely coupled to the exact compiler version, and it can't be used with a different one. Clang has its own equivalent called libcompiler_rt. But all this is a compiler implementation detail which you shouldn't normally be aware of. These are static libraries, included implicitly by the linker, so we don't even need to worry about distributing them. Numba is an exception because it does low-level JIT compilation, so its recipe will need to be significantly changed to work with the current NDK. Like I said, the fact that you're seeing a reference to libgcc anywhere in the build probably indicates that a Linux compiler has been used at some point. I suggest you look through the build log to try and find out how this happened. It's often caused by build scripts which hard-code "cc" or "gcc" rather than using the CC environment variable. |
Thought that was something worth a shot (to avoid linking to the Ok, thanks - I will look for the wrong toolchain used by PyO3 |
You should provide the env variables for the cross compilation, either by editing the build-wheel script or by creating a patch under the pydantic package. The following worked before, but may need adaptations now that the abi3 modules compilation support was merged:
|
Thanks for the help! |
anything update for this topic? I need to use the pydantic v2, but seems it's not possible for android. |
As far as I know, nobody has made any further progress on this package. If anyone else needs this package, please don't post a comment unless it provides some actual help in building it. Instead, register your support by clicking the thumbs up button below the top comment. Meanwhile, you may be able to use Pydantic version 1 as shown in the workaround above, and/or use an older version of the package that requires it. |
I follow this link #657 to build pydantic v2.4.2,but download package step report error:
how to fix this?
The text was updated successfully, but these errors were encountered: