Hello everyone,
I decided to revisit this and ended up discovering the build script for BerkeleyDB initially posted in this thread by the OP is quite incorrect.
Here is the correct syntax!
#!/bin/bash
## Path to MXE source
MXE_PATH=/home/demon/dev/mxe
## Path for mingw headers
MXE_INCLUDE=$MXE_PATH/usr/i686-w64-mingw32.static/include
## Path to db source
db=db-6.1.26
## Make a clean working tree / Create working DIR
## You can also use `make distclean` within build_mxe to start fresh
rm -rf ./$db/build_mxe
mkdir -p ./$db/build_mxe
cd ./$db/build_mxe
## Correct naming of header file
sed -i "s/WinIoCtl.h/winioctl.h/g" ../src/dbinc/win_db.h
## Define CC and C++ compiler & user level commands
export CC=$MXE_PATH/usr/bin/i686-w64-mingw32.static-gcc
export CXX=$MXE_PATH/usr/bin/i686-w64-mingw32.static-g++
export AR=$MXE_PATH/usr/bin/i686-w64-mingw32.static-ar
export STRIP=$MXE_PATH/usr/bin/i686-w64-mingw32.static-strip
export RANLIB=$MXE_PATH/usr/bin/i686-w64-mingw32.static-ranlib
### Find mingw headers in non-standard directory
export CPPFLAGS=-I$MXE_INCLUDE
## Configure the build
../dist/configure \
--build=x86_64-pc-linux-gnu \
--host=x86 \
--disable-replication \
--enable-cxx \
--enable-mingw \
--program-transform-name='s,.exe,,;s,\(.*\),\1.exe,' \
--prefix=/home/demon/dev/mxe_db \
--exec-prefix=/home/demon/dev/mxe_db
## Build DB and install it
make -j(nproc); make -j(nproc) install
Also discussed here (with build log):
https://stackoverflow.com/questions/50639135/how-to-compile-berkeley-db-5-3-28-for-mxe-cross-compile