1

Problem

I'm trying to compile Python 3.12.8 from source on CentOS 6.x without root access because I have no sudo authority.

I ran the following commands for configuration and building:

../configure --prefix=$HOME/local/python --with-openssl=$HOME/local/openssl
make -j24

However, the build process encountered an error:

The necessary bits to build these optional modules were not found:
_dbm

What I tried

First, I installed gdbm 1.24 on $HOME/local/gdbm. The source code was obtained from https://ftp.gnu.org/gnu/gdbm/gdbm-1.24.tar.gz using wget.

Next, I set the enviroment variables like below.

export LD_LIBRARY_PATH=$HOME/local/gdbm/lib:$LD_LIBRARY_PATH
export CFLAGS="-I$HOME/local/gdbm/include $CFLAGS"
export CPPFLAGS="-I$HOME/local/gdbm/include $CPPFLAGS"
export LDFLAGS="-L$HOME/local/gdbm/lib $LDFLAGS"
export PATH=$HOME/local/gdbm/bin:$PATH
export C_INCLUDE_PATH=$HOME/local/gdbm/include:$C_INCLUDE_PATH
export PKG_CONFIG_PATH=$HOME/local/gdbm/lib/pkgconfig:$PKG_CONFIG_PATH

However, _dbm is still missing.

What additional steps can I take to resolve the missing _dbm dependency and successfully compile Python? Thank you for reading.

1 Answer 1

1

I solved this problem myself just now.

When compiling gdbm 1.24, I needed to append --enable-libgdbm-compat option. According to GDBM manual, this option provides compatibility for older libraries.

The code needed to run ../configure for gdbm is as follows:

../configure --prefix=$HOME/local/gdbm --enable-libgdbm-compat

After that, install gdbm with the code below as usual:

make
make install

With this fix, I was able to successfully compile and install Python using the code I previously provided in the question.

Sign up to request clarification or add additional context in comments.

1 Comment

Very useful: the default dbm backend (dbm.dumb) being really bad in terms of performance compared to gdbm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.