classification
Title: Duplicate symbol _BUFFER_BLOCK_SIZE when statically linking multiple modules
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 3.11, Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: freakboy3742, gregory.p.smith, malin, miss-islington
Priority: normal Keywords: patch

Created on 2021-06-19 03:24 by freakboy3742, last changed 2021-06-22 07:12 by gregory.p.smith. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 26808 merged freakboy3742, 2021-06-20 07:10
PR 26844 merged miss-islington, 2021-06-22 06:36
Messages (4)
msg396114 - (view) Author: Russell Keith-Magee (freakboy3742) * Date: 2021-06-19 03:24
BPO-41486 added _BlocksOutputBuffer for the bz2, lzma and zlib module.

Part of this patch included a new header file, pycore_blocks_output_buffer.h, which defines a BUFFER_BLOCK_SIZE constant.

If two or more of the bz2, lzma or zlib modules are compiled as statically linked modules (i.e., added to Lib/Setup.local), this results in a duplicate symbol error when the Python executable is linked:

```
duplicate symbol '_BUFFER_BLOCK_SIZE' in:
    libpython3.10.a(_bz2module.o)
    libpython3.10.a(_lzmamodule.o)
duplicate symbol '_BUFFER_BLOCK_SIZE' in:
    libpython3.10.a(_bz2module.o)
    libpython3.10.a(zlibmodule.o)
```
msg396308 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2021-06-22 06:36
New changeset 92c2e91580521ba5c85aa3205a0211df5b48689b by Russell Keith-Magee in branch 'main':
bpo-44458: Ensure BUFFER_BLOCK_SIZE symbol is statically allocated. (GH-26808)
https://github.com/python/cpython/commit/92c2e91580521ba5c85aa3205a0211df5b48689b
msg396310 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2021-06-22 07:10
New changeset cf739332bd039cd2303b58663a804f784883820d by Miss Islington (bot) in branch '3.10':
bpo-44458: Ensure BUFFER_BLOCK_SIZE symbol is statically allocated. (GH-26808) (GH-26844)
https://github.com/python/cpython/commit/cf739332bd039cd2303b58663a804f784883820d
msg396311 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2021-06-22 07:12
Good catch.  We don't have buildbots statically linking the modules in these days, that'd be useful to prevent things like this from happening.
History
Date User Action Args
2021-06-22 07:12:19gregory.p.smithsetstatus: open -> closed
resolution: fixed
messages: + msg396311

stage: patch review -> resolved
2021-06-22 07:10:31gregory.p.smithsetmessages: + msg396310
2021-06-22 06:46:51malinsetnosy: + malin
2021-06-22 06:36:47miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request25425
2021-06-22 06:36:47gregory.p.smithsetmessages: + msg396308
2021-06-20 07:10:44freakboy3742setkeywords: + patch
stage: patch review
pull_requests: + pull_request25389
2021-06-19 19:34:12gregory.p.smithsetassignee: gregory.p.smith
2021-06-19 18:40:42ned.deilysetnosy: + gregory.p.smith
2021-06-19 03:24:49freakboy3742create