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.

Title: _dbm requires -lgdbm if gdbm is built as static libraries
Type: compile error Stage: resolved
Components: Build Versions: Python 3.7, Python 3.6
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: ncoghlan, yan12125
Priority: normal Keywords: patch

Created on 2017-02-04 05:18 by yan12125, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
gdbm.patch yan12125, 2017-02-04 05:18
gdbm.patch yan12125, 2017-02-04 15:50 The correct patch, please ignore previous one
Messages (4)
msg286907 - (view) Author: Chih-Hsuan Yen (yan12125) * Date: 2017-02-04 05:18
In, _dbm links to gdbm_compat only. If gdbm is built as dynamic libraries, has a NEEDED flag for, so both symbols in libgdbm and libgdbm_compat can be used. However, as static libraries does not provide such a flag, importing _dbm raises ImportError:

shell@ASUS_Z00E_2:/data/local/tmp $ python3.7m -c 'import _dbm'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: dlopen failed: cannot locate symbol "gdbm_errno" referenced by "/data/local/tmp/python3/usr/lib/python3.7/lib-dynload/"...

gdbm_errno is a symbol in libgdbm.a.

gdbm manual [1] suggests linking to both libraries, too.

msg286908 - (view) Author: Chih-Hsuan Yen (yan12125) * Date: 2017-02-04 05:21
Add the developer who wrote this line (issue15044)
msg286971 - (view) Author: Chih-Hsuan Yen (yan12125) * Date: 2017-02-04 15:50
Sorry, -lgdbm should come after -lgdbm_compat, or symbols in libgdbm.a are still not resolved. I don't know why - linking is a magic :(
msg337012 - (view) Author: Chih-Hsuan Yen (yan12125) * Date: 2019-03-02 14:37
I gave up building gdbm as a static library. It brings more headache than benefits.
Date User Action Args
2022-04-11 14:58:42adminsetgithub: 73626
2019-03-02 14:37:49yan12125setstatus: open -> closed
resolution: wont fix
messages: + msg337012

stage: resolved
2017-02-04 15:50:03yan12125setfiles: + gdbm.patch

messages: + msg286971
2017-02-04 05:21:06yan12125setnosy: + ncoghlan
messages: + msg286908
2017-02-04 05:18:54yan12125create