# Base image: Latest Debian FROM debian:latest # Step 1: Update and install base dependencies RUN apt-get update -y && \ apt-get install -y \ mingw-w64 \ cmake \ pkg-config \ libgnutls28-dev \ curl \ tar \ m4 \ gcc-mingw-w64-x86-64 \ meson \ ninja-build \ fluid # Step 2: Set environment variables for MinGW tools ENV CC=/usr/bin/x86_64-w64-mingw32-gcc \ CXX=/usr/bin/x86_64-w64-mingw32-g++ \ RC=/usr/bin/x86_64-w64-mingw32-windres \ CMAKE_C_FLAGS="-isystem /usr/lib/gcc/x86_64-w64-mingw32/12-win32/include" \ CMAKE_CXX_FLAGS="-isystem /usr/lib/gcc/x86_64-w64-mingw32/12-win32/include" \ CMAKE="cmake -DCMAKE_SYSTEM_NAME=Windows \ -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 \ -DCMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc \ -DCMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++ \ -DCMAKE_SYSROOT=/usr/x86_64-w64-mingw32 \ -DCMAKE_FIND_ROOT_PATH=/usr/x86_64-w64-mingw32 \ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY" # Step 3: Download and build zlib RUN curl -LO https://zlib.net/zlib-1.3.1.tar.gz && \ tar -xvzf zlib-1.3.1.tar.gz && \ cd zlib-1.3.1 && \ ./configure --prefix=/usr/x86_64-w64-mingw32 && \ sed -ri 's/(LDSHAREDLIBC=)-lc/\1/;' Makefile && \ make && \ make install # Step 4: Download and build libpng RUN curl -LO https://download.sourceforge.net/libpng/libpng-1.6.44.tar.gz && \ tar -xvzf libpng-1.6.44.tar.gz && \ cd libpng-1.6.44 && \ ./configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 && \ make && \ make install # Step 5: Download and build FLTK RUN curl -LO https://www.fltk.org/pub/fltk/1.3.9/fltk-1.3.9-source.tar.gz && \ tar xzf fltk-1.3.9-source.tar.gz && \ cd fltk-1.3.9 && \ $CMAKE -DZLIB_LIBRARY=/usr/x86_64-w64-mingw32/lib/libz.a \ -DZLIB_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include \ -DPNG_LIBRARY=/usr/x86_64-w64-mingw32/lib/libpng.a \ -DPNG_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include \ -G "Unix Makefiles" . && \ make && \ make install # Step 6: Download and build libjpeg RUN curl -LO http://www.ijg.org/files/jpegsrc.v9f.tar.gz && \ tar -xvzf jpegsrc.v9f.tar.gz && \ cd jpeg-9f && \ ./configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-shared && \ make && \ make install # Step 7: Download and build nettle RUN curl -LO https://ftp.gnu.org/gnu/nettle/nettle-3.10.tar.gz && \ tar -xvzf nettle-3.10.tar.gz && \ cd nettle-3.10 && \ ./configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 && \ make && \ make install # Step 8: Download and build GMP RUN curl -LO https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz && \ tar -xf gmp-6.3.0.tar.xz && \ cd gmp-6.3.0 && \ ./configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 && \ make && \ make install # Step 9: Download and build pixman RUN curl -LO https://cairographics.org/releases/pixman-0.43.4.tar.gz && \ tar -xvzf pixman-0.43.4.tar.gz && \ cd pixman-0.43.4 && \ echo "[binaries]" > cross-mingw.txt && \ echo "c = '/usr/bin/x86_64-w64-mingw32-gcc'" >> cross-mingw.txt && \ echo "cpp = '/usr/bin/x86_64-w64-mingw32-g++'" >> cross-mingw.txt && \ echo "ar = '/usr/bin/x86_64-w64-mingw32-ar'" >> cross-mingw.txt && \ echo "strip = '/usr/bin/x86_64-w64-mingw32-strip'" >> cross-mingw.txt && \ echo "pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'" >> cross-mingw.txt && \ echo "windres = '/usr/bin/x86_64-w64-mingw32-windres'" >> cross-mingw.txt && \ echo "[host_machine]" >> cross-mingw.txt && \ echo "system = 'windows'" >> cross-mingw.txt && \ echo "cpu_family = 'x86_64'" >> cross-mingw.txt && \ echo "cpu = 'x86_64'" >> cross-mingw.txt && \ echo "endian = 'little'" >> cross-mingw.txt && \ echo "[paths]" >> cross-mingw.txt && \ echo "prefix = '/usr/x86_64-w64-mingw32'" >> cross-mingw.txt && \ meson setup builddir --cross-file cross-mingw.txt --prefix=/usr/x86_64-w64-mingw32 --buildtype=release && \ ninja -C builddir && \ ninja -C builddir install # Step 10: Download and build TigerVNC RUN apt install -y git RUN git clone https://github.com/TigerVNC/tigervnc.git # This is the documented way to run cmake. It results in error: "Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)" # RUN cd tigervnc && mkdir build && cd build && \ # CC=/usr/bin/x86_64-w64-mingw32-gcc \ # CXX=/usr/bin/x86_64-w64-mingw32-g++ \ # RC=/usr/bin/x86_64-w64-mingw32-windres \ # cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ # -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \ # -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib \ # .. # This is my current best attempt. RUN cd tigervnc && \ mkdir build && \ cd build && \ $CMAKE -G "Unix Makefiles" \ -DZLIB_LIBRARY=/usr/x86_64-w64-mingw32/lib/libz.so \ -DZLIB_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include \ -DPIXMAN_LIBRARY=/usr/x86_64-w64-mingw32/bin/libpixman-1-0.dll \ -DPIXMAN_LIBRARIES=/usr/x86_64-w64-mingw32/lib \ -DPIXMAN_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include/pixman-1 \ -DJPEG_LIBRARY=/usr/x86_64-w64-mingw32/bin/libjpeg-9.dll \ -DJPEG_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include \ -DNETTLE_LIBRARY=/usr/x86_64-w64-mingw32/lib/libnettle.so \ -DNETTLE_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include \ -DGMP_LIBRARY=/usr/x86_64-w64-mingw32/lib/libgmp.so \ -DGMP_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include \ -DFLTK_INCLUDE_DIR=/usr/local/include \ -DFLTK_LIBRARY=/usr/lib/x86_64-w64-mingw32/lib/libfltk.a \ -DFLTK_IMAGES_LIBRARY=/usr/x86_64-w64-mingw32/lib/libfltk_images.a \ -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \ -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib \ -DENABLE_NLS=OFF \ -DLC_MESSAGES=0 \ -DPIXMAN_FOUND=TRUE \ .. RUN cd tigervnc/build && \ make vncviewer # The cmake command works, but then during compilation there is fatal error: pixman.h: No such file or directory # Note that the following files exist: # find /usr -name '*pixman*' # /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 # /usr/lib/x86_64-linux-gnu/libpixman-1.so.0.42.2 # /usr/share/doc/libpixman-1-0 # /usr/share/lintian/overrides/libpixman-1-0 # /usr/x86_64-w64-mingw32/bin/libpixman-1-0.dll # /usr/x86_64-w64-mingw32/include/pixman-1 # /usr/x86_64-w64-mingw32/include/pixman-1/pixman-version.h # /usr/x86_64-w64-mingw32/include/pixman-1/pixman.h # /usr/x86_64-w64-mingw32/lib/libpixman-1.dll.a # /usr/x86_64-w64-mingw32/lib/pkgconfig/pixman-1.pc