This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2018-09-26.17:10:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537981804.63.0.545547206417.issue34814@psf.upfronthosting.co.za>
In-reply-to
Content
Example of the bug:

---
$ git apply ~/Setup.patch
$ ./configure --with-pydebug --enable-shared
$ make
$ grep _contextvars Makefile
(...)

Modules/_contextvarsmodule.o: $(srcdir)/Modules/_contextvarsmodule.c; $(CC) $(CCSHARED) $(PY_CFLAGS) $(PY_CPPFLAGS)  -c $(srcdir)/Modules/_contextvarsmodule.c -o Modules/_contextvarsmodule.o

Modules/_contextvars$(EXT_SUFFIX):  Modules/_contextvarsmodule.o; $(BLDSHARED)  Modules/_contextvarsmodule.o   -o Modules/_contextvars$(EXT_SUFFIX)

$ find -name "_contextvars.*so"
./Modules/_contextvars.cpython-38dm-x86_64-linux-gnu.so

$ ldd $(find -name "_contextvars.*so")
	linux-vdso.so.1 (0x00007ffd27973000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd081433000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fd081074000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd081854000)
---

The _contextvars shared library is not linked to libpython. There is not "-lpythonX.Y" in the Makefile rule.


Now with the patch:
---
$ git clean -fdx
$ git apply ~/Setup.patch
$ ./configure --with-pydebug --enable-shared
$ make
$ grep _contextvars Makefile
(...)

Modules/_contextvarsmodule.o: $(srcdir)/Modules/_contextvarsmodule.c; $(CC) $(CCSHARED) $(PY_CFLAGS) $(PY_CPPFLAGS)  -c $(srcdir)/Modules/_contextvarsmodule.c -o Modules/_contextvarsmodule.o

Modules/_contextvars$(EXT_SUFFIX):  Modules/_contextvarsmodule.o $(LDLIBRARY); $(BLDSHARED)  Modules/_contextvarsmodule.o $(BLDLIBRARY)   -o Modules/_contextvars$(EXT_SUFFIX)

$ find -name "_contextvars.*so"
./Modules/_contextvars.cpython-38dm-x86_64-linux-gnu.so

$ ldd $(find -name "_contextvars.*so")
	linux-vdso.so.1 (0x00007ffd1e918000)
	libpython3.8dm.so.1.0 => not found
        (...)
---

With my patch, _contextvars.cpython-38dm-x86_64-linux-gnu.so is linked to libpython3.8dm.so.1.0 as expected. The Makefile rule adds  $(LDLIBRARY) to the dependencies of the _contextvars(...).so rule and it adds $(BLDLIBRARY) to the linker flags of this rule.
History
Date User Action Args
2018-09-26 17:10:04vstinnersetrecipients: + vstinner
2018-09-26 17:10:04vstinnersetmessageid: <1537981804.63.0.545547206417.issue34814@psf.upfronthosting.co.za>
2018-09-26 17:10:04vstinnerlinkissue34814 messages
2018-09-26 17:10:04vstinnercreate