Skip to content

Error when importing after compiling with GCC 10 #565

Closed
sthagen/MagicStack-asyncpg
#5

Description

@Gelbpunkt
  • asyncpg version: asyncpg-0.21.0.dev0+7f5c2a2 (same for 0.20.1)
  • PostgreSQL version: does not matter
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : does not matter
  • Python version: 3.8.2 and 3.9.0a5+
  • Platform: Fedora 32 x64/aarch64 and Alpine Linux 3.12 alpha x64/aarch64
  • Do you use pgbouncer?: does not matter
  • Did you install asyncpg with pip?: no
  • If you built asyncpg locally, which version of Cython did you use?: 0.29.16 and 3.0a2
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : does not matter

I have tested this on the following scenarios:
Fedora 32 x86_64, Python 3.8.2, GCC 10.0.1 20200328 (Red Hat 10.0.1-0.11) from official repos
Fedora 33 (rawhide) aarch64, Python 3.8.2, GCC 10.0.1 20200420 (Red Hat 10.0.1-0.12) from official repos
Alpine Linux 3.12 alpha x86_64, Python 3.9a5, GCC 10.0.1 20200427 from source (builds at https://ftp.travitia.xyz/alpine/x86_64/)
Alpine Linux 3.12 alpha aarch64, Python 3.9a5, GCC 10.0.1 20200426 from source (builds at https://ftp.travitia.xyz/alpine/aarch64/)
All have been tested twice with Cython 0.29.16 and Cython 3.0a2.

Whenever I compile asyncpg with GCC 9.3 on any of above scenarios, it compiles fine and runs fine.
Whenever I use GCC 10 in any of above scenarios, it does build fine, but importing it gives me:

>>> import asyncpg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jens/.local/lib/python3.8/site-packages/asyncpg/__init__.py", line 8, in <module>
    from .connection import connect, Connection  # NOQA
  File "/home/jens/.local/lib/python3.8/site-packages/asyncpg/connection.py", line 19, in <module>
    from . import connect_utils
  File "/home/jens/.local/lib/python3.8/site-packages/asyncpg/connect_utils.py", line 28, in <module>
    from . import protocol
  File "/home/jens/.local/lib/python3.8/site-packages/asyncpg/protocol/__init__.py", line 8, in <module>
    from .protocol import Protocol, Record, NO_TIMEOUT  # NOQA
  File "asyncpg/protocol/protocol.pyx", line 1, in init asyncpg.protocol.protocol
ImportError: /home/jens/.local/lib/python3.8/site-packages/asyncpg/pgproto/pgproto.cpython-38-x86_64-linux-gnu.so: undefined symbol: uuid_to_hex

This is weird, as readelf shows:

$ readelf -a /home/jens/.local/lib/python3.8/site-packages/asyncpg/pgproto/pgproto.cpython-38-x86_64-linux-gnu.so | grep uuid_to_hex
000000055d90  004f00000007 R_X86_64_JUMP_SLO 0000000000000000 uuid_to_hex + 0
    79: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND uuid_to_hex
  1176: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND uuid_to_hex

I don't know C much, but I have seen that uuid_to_hex is defined in the code for pgproto, so I have no clue how this happens.

FYI: On all scenarios, I am able to compile and use uvloop and cpython 3.9 without any errors.

EDIT: Same issue with Alpine Linux 3.12 alpha, Python 3.9a6, Cython 3.0a3 and GCC 10 20200430

Activity

  1. Gelbpunkt commented on May 1, 2020

    @Gelbpunkt
    ContributorAuthor

    The error persists with GCC 10.1, the first stable GCC 10 release (https://gcc.gnu.org/).
    Example with python 3.9a6+ in alpine 3.12 alpha:

    / # readelf -a /usr/local/lib/python3.9/site-packages/asyncpg/pgproto/pgproto.cpython-39-x86_64-linux-gnu.so | grep uuid_to_hex
    000000046b48  002a00000007 R_X86_64_JUMP_SLO 0000000000000000 uuid_to_hex + 0
        42: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND uuid_to_hex
      1258: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND uuid_to_hex
  2. ioistired commented on May 2, 2020

    @ioistired
    Contributor

    Seems to be related to #534

  3. added a commit that references this issue on May 2, 2020
  4. kamikaze commented on Jun 26, 2020

    @kamikaze

    getting same issue with gcc 10.1 on ARM64

    $ python
    Python 3.8.3 (default, May 29 2020, 07:06:49) 
    [GCC 10.1.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from asyncpg import PG
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/kamikaze/projects/proj/.venv38/lib/python3.8/site-packages/asyncpg/__init__.py", line 8, in <module>
        from .connection import connect, Connection  # NOQA
      File "/home/kamikaze/projects/proj/.venv38/lib/python3.8/site-packages/asyncpg/connection.py", line 19, in <module>
        from . import connect_utils
      File "/home/kamikaze/projects/proj/.venv38/lib/python3.8/site-packages/asyncpg/connect_utils.py", line 27, in <module>
        from . import protocol
      File "/home/kamikaze/projects/proj/.venv38/lib/python3.8/site-packages/asyncpg/protocol/__init__.py", line 8, in <module>
        from .protocol import Protocol, Record, NO_TIMEOUT  # NOQA
      File "asyncpg/protocol/protocol.pyx", line 1, in init asyncpg.protocol.protocol
    ImportError: /home/kamikaze/projects/proj/.venv38/lib/python3.8/site-packages/asyncpg/pgproto/pgproto.cpython-38-aarch64-linux-gnu.so: undefined symbol: uuid_to_hex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions