Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 910220 - =dev-python/pydantic-core-2.0.2: ImportError: undefined symbol: mi_malloc when built with LTO
Summary: =dev-python/pydantic-core-2.0.2: ImportError: undefined symbol: mi_malloc whe...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2023-07-11 13:49 UTC by Andrew Udvare
Modified: 2023-07-17 09:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Udvare 2023-07-11 13:49:47 UTC
$ python
Python 3.11.4 (main, Jul  2 2023, 13:22:45) [GCC 13.1.1 20230527] on linux
Type "help", "copyright", "credits" or "license" for more information.
(ins)>>> import pydantic_core
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/pydantic_core/__init__.py", line 6, in <module>
    from ._pydantic_core import (
ImportError: /usr/lib/python3.11/site-packages/pydantic_core/_pydantic_core.cpython-311-x86_64-linux-gnu.so: undefined symbol: mi_malloc

I noticed this when trying something that needs Pydantic. I downgraded to pydantic-core 0.39.0 which does not have this issue, but ultimately the issue is caused by LTO like a lot of Rust packages.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-12 05:45:03 UTC
It's because Rust.
Comment 2 Larry the Git Cow gentoo-dev 2023-07-12 06:25:11 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc51935f7aae5f89d1ffecabef322680979952b8

commit dc51935f7aae5f89d1ffecabef322680979952b8
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2023-02-09 00:49:47 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-07-12 06:24:42 +0000

    cargo.eclass: filter out lto flags for C/CXX compilers
    
    we do it in src_compile to avoid excessive flag stripping in projects
    using cargo.eclass just to fetch crates.
    
    Bug: https://bugs.gentoo.org/903908
    Closes: https://bugs.gentoo.org/893658
    Closes: https://bugs.gentoo.org/910220
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
    Signed-off-by: Sam James <sam@gentoo.org>

 eclass/cargo.eclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-12 11:33:11 UTC
We still need to adjust distutils-r1.
Comment 4 Larry the Git Cow gentoo-dev 2023-07-17 09:44:26 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2da31f41428439e273db7f1a8c8c3ff883641ed

commit d2da31f41428439e273db7f1a8c8c3ff883641ed
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2023-07-12 12:19:36 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2023-07-17 09:44:19 +0000

    distutils-r1.eclass: Disable LTO when using cargo.eclass
    
    Strip LTO flags when cargo.eclass is inherited.  This means that Rust
    extensions are being built, and linking them with C/C++ style LTO
    results in broken shared libraries.
    
    Closes: https://bugs.gentoo.org/910220
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 eclass/distutils-r1.eclass | 7 +++++++
 1 file changed, 7 insertions(+)