Build SDL3_ttf.DLL from Linux

I can build an SDL3.DLL + SDL3_image.dll without any problems using the following commands:
SDL3:

cmake -S ../SDL/ -B . -DCMAKE_CXX_COMPILER="/usr/bin/x86_64-w64-mingw32-g++" -DCMAKE_C_COMPILER="/usr/bin/x86_64-w64-mingw32-gcc" -DCMAKE_RC_COMPILER="/usr/bin/x86_64-w64-mingw32-windres" -DCMAKE_FIND_ROOT_PATH="/usr/x86_64-w64-mingw32" -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="ONLY" -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" -DCMAKE_SYSTEM_NAME="Windows" --install-prefix ~/SDL_win64_DLL

SDL3_image:

cmake -S ../SDL_image/ -B . -DCMAKE_CXX_COMPILER="/usr/bin/x86_64-w64-mingw32-g++" -DCMAKE_C_COMPILER="/usr/bin/x86_64-w64-mingw32-gcc" -DCMAKE_RC_COMPILER="/usr/bin/x86_64-w64-mingw32-windres" -DCMAKE_FIND_ROOT_PATH="/usr/x86_64-w64-mingw32" -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="ONLY" -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" -DCMAKE_SYSTEM_NAME="Windows" --install-prefix ~/SDL_win64_DLL

But when I try to build an SDL3_ttf.dll, I get an error because of “Freetype”.

cmake -S ../SDL_ttf -B . -DCMAKE_CXX_COMPILER="/usr/bin/x86_64-w64-mingw32-g++" -DCMAKE_C_COMPILER="/usr/bin/x86_64-w64-mingw32-gcc" -DCMAKE_RC_COMPILER="/usr/bin/x86_64-w64-mingw32-windres" -DCMAKE_FIND_ROOT_PATH="/usr/x86_64-w64-mingw32" -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="ONLY" -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" -DCMAKE_SYSTEM_NAME="Windows" --install-prefix ~/SDL_win64_DLL
-- The C compiler identification is GNU 10.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring SDL3_ttf 3.0.0
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - not found
-- Performing Test HAVE_WL_NO_UNDEFINED
-- Performing Test HAVE_WL_NO_UNDEFINED - Success
-- Linker identification: GNUlike
-- Performing Test LINKER_SUPPORTS_VERSION_SCRIPT
-- Performing Test LINKER_SUPPORTS_VERSION_SCRIPT - Success
-- SDL3_ttf: Using system freetype library
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Freetype (missing: FREETYPE_LIBRARY) (found version
  "2.11.1")
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindFreetype.cmake:162 (find_package_handle_standard_args)
  CMakeLists.txt:255 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/tux/Schreibtisch/Git_SDL_Script/SDL/SDL3_ttf/build_win64/CMakeFiles/CMakeOutput.log".
See also "/home/tux/Schreibtisch/Git_SDL_Script/SDL/SDL3_ttf/build_win64/CMakeFiles/CMakeError.log".

Does anyone have an idea how to get around this?

Attached are the two log files.
CMakeError.log (1.9 KB)
CMakeOutput.log (24.7 KB)

I once tried to install Freetype via cross compiler. The DLLs were then copied to /usr/local/bin by default.
Afterwards I tried again to build the SDL3_tty.dll. I still get the same error even though I removed the install prefix.
SDL3, SDL3_net, SDL3_image, SDL3_mix all work.

One an idea how I need to handle the FreeType it is recognized by SDL3_ttf.

I’ve now got it working and can build SDL3_ttf.dll and SDL3_rtf.dll under Linux.
I’ve written a quick guide for this.
Thanks to these following tips: [SDL3.x] make / cmake Build Parameters - #4 by yataro

Introduction

The following instructions apply if you leave the installation folder of CMAKE at default.

First, back up the folder: usr/local/

SDL3_ttf.dll

If the following error occurs, follow the instructions below.

CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Freetype (missing: FREETYPE_LIBRARY) (found version
"2.11.1")
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.22/Modules/FindFreetype.cmake:162 (find_package_handle_standard_args)
CMakeLists.txt:253 (find_package)

Download the latest FreeType and install win64-cross (dll).

Install cmake-gui

sudo apt install cmake-qt-gui

Switch to the folder with .../SDL/SDL3_ttf/build_win64.

Double-click on CMakeCache.txt , this should then open it with cmake-gui.

Change the following paths:

  • FREETYPE_INCLUDE_DIR_freetype usr/include/freetype2 → /usr/local/include/freetype2

  • FREETYPE_INCLUDE_DIR_ft2build usr/include/freetype2 → /usr/local/include/freetype2

  • Click [Generate].

  • Exit the tool.

  • In the console, type make/make install, then the SDL3_ttf.dll should be built.

SDL3_rtf.dll

Change to the folder with .../SDL/SDL3_ttf/build_win64.
Double click on CMakeCache.txt , this should then open it with cmake-gui.

Change the following path:

  • SDL3_ttf_DIR SDL3_ttf_DIR-NOTFOUND → /usr/local/lib/cmake/SDL3_ttf

  • Click [Generate].

  • Exit tool.

  • In the console type make/make install, then the SDL3_rtf.dll should be built.

1 Like