New submission from Omer Ozarslan <omerfar...@gmail.com>:
distutils honors some environment variables during extension build, however, LDFLAGS is appended before declaring object files. This causes undefined symbols during importing an extension built with some static libraries using this environment variable. This is not apparent in the case of dynamic linking, but it can be observed by adding "-Wl,--as-needed" flag, since this will link libraries only if they are required. Therefore, it will be necessary to add them after object files in case of dynamic linking as well in that case. I believe this part is the culprit as it appends LDFLAGS environment variable to executable name: https://github.com/python/cpython/blob/c994c8f/Lib/distutils/sysconfig.py#L211-L235 I attached a minimal example (it requires cython, which relies on distutils for compilation). It would be nice if LDFLAGS is appended after object files, or a new environment variable (e.g. LDLIBS) is introduced to distutils to be appended after object files. ---------- components: Distutils files: python-issue.tar.gz messages: 348436 nosy: dstufft, eric.araujo, ozars priority: normal severity: normal status: open title: distutils appends LDFLAGS environment variable before object file names Added file: https://bugs.python.org/file48505/python-issue.tar.gz _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37680> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com