Saturday, December 30, 2023

Compiling jbig2enc on MSYS on Windows 11 using LLVM & Clang

These are the steps that I use to build jbig2encon MSYS using LLVM/Clang

  1. Install MSYS2 and development tools
  2. Install jbig2enc dependencies
  3. Substitute inet.h to Winsock2
  4. Build

Install MSYS2 and development tools

The official installation instruction for MSYS2 is pretty straightforward. The default is to use GCC and the relevant development tools. For example, this page has a step-by-step instructions on how to install base-devel, gcc, vim and cmake

To use the Clang/LLVM toolchain though, you will need the mingw-w64-clang-x86_64-toolchain group. 


$ sudo pacman -S mingw-w64-clang-x86_64-toolchain



Install these other development tools: automake autoconf libtool nasm pkgconf


$ sudo pacman -S automake autoconf libtool nasm pkgconf



Install jbig2enc dependencies

Assuming you have cloned the source code of jbig2enc, install the dependencies before you start compiling. 


pacman -S zlib-devel clang64/mingw-w64-clang-x86_64-leptonica msys2-w32api-headers


The last package, msys2-w32api-headers, is to provide the Winsock2 library. 


Substitute inet.h to Winsock2

Building jbig2enc in a Windows/MSYS environment will lead to certain network functionality missing, for more details on the specifics, see this blog post

Add the -lws_32 linking flag when you build jbig2enc. 

Build


Now go ahead and build


./autogen.sh
LIBS="-lws2_32" ./configure
make
sudo make install



 

No comments:

Post a Comment