Author vstinner
Recipients vstinner
Date 2021-05-14.16:58:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When Python is built without --enable-shared, the "Py_FrozenMain" is not exported.

When Python is built with --enable-shared, the "Py_FrozenMain" is exported as expected.

I can reproduce the issue with attached reproduce.tar.gz example:

* exports "func1" symbol
* doesn't export the "func1" symbol

The difference is that links directly two object files (.o) into a binary, whereas creates a static library (.a) and then link the static library into a binary.

Python is always built with a static library (libpythonVERSION.a) which causes the issue.

A solution is to pass -Wl,--whole-archive option to the linker to export *all* symbols exported by all object files, and not only export symbols of the object files which are used.

I'm not sure why, but "Py_FrozenMain" is the *only* impacted symbol of the whole C API.

This issue was discovered by Petr Viktorin who works on the stable ABI:
Date User Action Args
2021-05-14 16:58:44vstinnersetrecipients: + vstinner
2021-05-14 16:58:44vstinnersetmessageid: <>
2021-05-14 16:58:44vstinnerlinkissue44133 messages
2021-05-14 16:58:43vstinnercreate