undefined reference to `_PyContext_Init'

22 views
Skip to first unread message

Alexander Kokuev

unread,
Nov 19, 2020, 7:48:37 PM11/19/20
to pyoxidizer-users
Hello All,

First of all, thanks to Gregory for this project. Pyoxidizer has a great goal!

I'm trying to run the 'Getting Started' example from pyoxidizer's docs:

I've tried it on macOS and CentOS 7 (run in docker) with the stable version (cargo install pyoxidizer) and with the main branch version (cargo install --git https://github.com/indygreg/PyOxidizer.git --branch main pyoxidizer).

I've got similar results:
MacOS version:
ld: warning: directory not found for option '-L/var/folders/c4/4vv0k30x3xbgnbgswsx9z3g40000gn/T/pyoxidizer-build-exe.qITlQdj6b2MX'
          Undefined symbols for architecture x86_64:
            "_PyContextVar_Get", referenced from:
                _dec_repr in libpyembed-6ebe564424ab2518.rlib(_decimal.o)
                _dec_str in libpyembed-6ebe564424ab2518.rlib(_decimal.o)
                _dec_richcompare in libpyembed-6ebe564424ab2518.rlib(_decimal.o)
                _dec_new in libpyembed-6ebe564424ab2518.rlib(_decimal.o)
                _nm_mpd_qadd in libpyembed-6ebe564424ab2518.rlib(_decimal.o)
                _nm_mpd_qsub in libpyembed-6ebe564424ab2518.rlib(_decimal.o)
                _nm_mpd_qmul in libpyembed-6ebe564424ab2518.rlib(_decimal.o)
                ...

CentOS 7 version:
  = note: /tmp/pyoxidizer.Lwz0Co1iB5Wn/build/target/x86_64-unknown-linux-gnu/debug/deps/libpyembed-7cfc08668dd45ce2.rlib(pylifecycle.o): In function `pycore_init_types':
          /build/Python-3.8.6/Python/pylifecycle.c:587: undefined reference to `_PyContext_Init'
          /tmp/pyoxidizer.Lwz0Co1iB5Wn/build/target/x86_64-unknown-linux-gnu/debug/deps/libpyembed-7cfc08668dd45ce2.rlib(pylifecycle.o): In function `Py_FinalizeEx':
          /build/Python-3.8.6/Python/pylifecycle.c:1334: undefined reference to `_PyContext_Fini'
          /tmp/pyoxidizer.Lwz0Co1iB5Wn/build/target/x86_64-unknown-linux-gnu/debug/deps/libpyembed-7cfc08668dd45ce2.rlib(gcmodule.o): In function `clear_freelists':
          /build/Python-3.8.6/Modules/gcmodule.c:981: undefined reference to `PyContext_ClearFreeList'
          /tmp/pyoxidizer.Lwz0Co1iB5Wn/build/target/x86_64-unknown-linux-gnu/debug/deps/libpyembed-7cfc08668dd45ce2.rlib(_asynciomodule.o): In function `_asyncio_Future_add_done_callback_impl':
          /build/Python-3.8.6/./Modules/_asynciomodule.c:912: undefined reference to `PyContext_CopyCurrent'
          /tmp/pyoxidizer.Lwz0Co1iB5Wn/build/target/x86_64-unknown-linux-gnu/debug/deps/libpyembed-7cfc08668dd45ce2.rlib(_asynciomodule.o): In function `_asyncio_Task___init___impl':
          /build/Python-3.8.6/./Modules/_asynciomodule.c:1980: undefined reference to `PyContext_CopyCurrent'
          /tmp/pyoxidizer.Lwz0Co1iB5Wn/build/target/x86_64-unknown-linux-gnu/debug/deps/libpyembed-7cfc08668dd45ce2.rlib(_contextvarsmodule.o): In function `_Py_INCREF':
          /build/Python-3.8.6/./Include/object.h:459: undefined reference to `PyContext_Type'

It looks like it libpythonXY.a is not linked properly; missing symbols seem to be very base.

Maybe someone had a similar issue? Does anyone have an idea how to debug this issue?

Thanks,
Alex.

Gregory Szorc

unread,
Nov 20, 2020, 7:42:53 PM11/20/20
to Alexander Kokuev, pyoxidizer-users
Alexander,

I'm able to reproduce this failure on at least macOS 11 Big Sur. Unsure about other distributions.

I hope to diagnose and fix it by the end of the weekend.

Gregory

--
You received this message because you are subscribed to the Google Groups "pyoxidizer-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyoxidizer-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyoxidizer-users/f3f496a4-0ec9-47f8-892f-ff79359921e9n%40googlegroups.com.

Alexander Kokuev

unread,
Nov 24, 2020, 5:59:50 PM11/24/20
to pyoxidizer-users
Hello Gregory,

After your commits, the main branch now works like a charm, at least in Big Sur, where I've just tried!
Thank you for the help and the project.

Alex
Reply all
Reply to author
Forward
0 new messages