Skip to content

Instantly share code, notes, and snippets.

@patricklodder
Created July 29, 2022 20:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patricklodder/d3e16ce97ace16f2045f829901974ccc to your computer and use it in GitHub Desktop.
Save patricklodder/d3e16ce97ace16f2045f829901974ccc to your computer and use it in GitHub Desktop.

Cross-compiling db5.3.28.NC for Windows 64-bit with attached dockerfile

docker build -t bdb_tools - < Dockerfile
export container=$(docker run -d --rm bdb_tools sleep infinity)
docker cp $container:/out/bdb_tools/bdb_tools.zip ./
docker stop $container

Now you can use all the bdb tools in windows. <3

FROM ubuntu:22.04
WORKDIR /build
# Update build system
RUN apt-get update && \
apt-get install -y mingw-w64 gcc-mingw-w64 curl libtool build-essential zip
# Build bdb
RUN curl -L -O http://depends.dogecoincore.org/db-5.3.28.NC.tar.gz && \
echo "76a25560d9e52a198d37a31440fd07632b5f1f8f9f2b6d5438f4bc3e7c9013ef db-5.3.28.NC.tar.gz" |sha256sum -c && \
tar xf db-5.3.28.NC.tar.gz && \
cd db-5.3.28.NC && \
sed -i.old 's/WinIoCtl\.h/winioctl\.h/g' src/dbinc/win_db.h && \
./dist/configure --host=x86_64-w64-mingw32 --disable-shared --disable-replication \
--enable-mingw CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar \
CFLAGS="-O2" && \
make && \
mkdir -p /out && \
make DESTDIR=/out install
# build the archive
WORKDIR /out
RUN mkdir -p bdb_tools && \
cd bdb_tools && \
cp ../usr/local/BerkeleyDB.5.3/bin/*.exe ./ && \
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll ./ && \
zip bdb_tools.zip *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment