According to gdbm NEW, the dbm/ndbm compatibility routines was moved to libgdbm_compat in v1.8.1, which was released in late 2002. The patch works for gdbm-1.8.1+. But I am afraid that the patch will cause build error with gdbm-1.8.0 and earlier version. A more sophisticated approach is needed. The approach will do the following: 1. find gdbm library and gdbm/ndbm.h header 2. check the presence of dbm_open() function in gdbm library 3. if present, link with gdbm 4. if not, link with gdbm_compat Step 1 and 3 are already in setup.py. The patch adds step 4, but step 2 is missing. I don't have enough skill in distutil to implement it though...