The International Simutrans Forum

 

Author Topic: [r8764] Freetype build broken on Ubuntu  (Read 501 times)

0 Members and 1 Guest are viewing this topic.

Offline ceeac

  • *
  • Posts: 45
[r8764] Freetype build broken on Ubuntu
« on: May 30, 2019, 06:34:39 AM »
OS: Ubuntu 19.04

Simutrans cannot be compiled with USE_FREETYPE=1 on Ubuntu because ft2build.h is not found. This is especially visible when building using autoconf because it enables USE_FREETYPE by default when freetype is installed.
The relevant header, however, is installed:

Code: [Select]
$ find /usr/include/ | grep ft2build
/usr/include/freetype2/ft2build.h

So it is probably a matter of looking in /usr/include/ vs. looking in /usr/include/freetype2/ .

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5525
  • Languages: EN, NO
Re: [r8764] Freetype build broken on Ubuntu
« Reply #1 on: May 30, 2019, 11:50:23 AM »
So it is probably a matter of looking in /usr/include/ vs. looking in /usr/include/freetype2/ .

Simutrans uses freetype-config to get the paramter(s) needed to locate freetype.

Offline R1dO

  • *
  • Posts: 42
  • Languages: NL EN
Re: [r8764] Freetype build broken on Ubuntu
« Reply #2 on: May 30, 2019, 12:37:59 PM »
Problem here is that Ubuntu seems to have dropped "freetype-config" when moving from "libfreetype6-dev 2.8" to libfreetype6-dev 2.9", so it is not available anymore on up-to-date Ubuntu installs.

Luckily "freetype-config" acts as a wrapper when "pkg-config" is available on the system (which should be on Ubuntu).

Hence you can work around this by making the following change to config.default
Code: [Select]
#FREETYPE_CONFIG = freetype-config                                                                     
FREETYPE_CONFIG = pkg-config freetype2 

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9514
  • Languages: De,EN,JP
Re: [r8764] Freetype build broken on Ubuntu
« Reply #3 on: June 03, 2019, 01:08:25 AM »
Does this is somehow detected by autoconf. Otherwise I expect a lot of other software will be "broken" too ...

Offline R1dO

  • *
  • Posts: 42
  • Languages: NL EN
Re: [r8764] Freetype build broken on Ubuntu
« Reply #4 on: June 03, 2019, 07:29:51 PM »
I'm not really knowledgeable enough about autoconf to be absolute certain but test seem to indicate it does.

The test performed (on a system without `freetype-config`):
* Using a pristine repository copy (no manual alterations [1])
* Run `autoconf` -> output message includes: "checking for library containing FT_Init_FreeType... -lfreetype"
* Run `./configure` -> Verified `configure.default` includes: "USE_FREETYPE = 1"
* Run `make`

This creates a working binary, with only one catch. In order to compile successfully i had to edit the Makefile (line 14)
from
Code: [Select]
FREETYPE_CONFIG ?= freetype-configto
Code: [Select]
FREETYPE_CONFIG ?= pkg-config freetype2
As for the breakage of other software. This will most likely be the case for all distributions that do not take special precautions when building freetype2 (e.g. using the flag '--enable-freetype-config' for versions >= 2.9.1).
More information:
* The reason why the developers of freetype2 dropped it (for default builds) is mentioned in this bugreport
* They also warn against it's usage in one of their basic tutorials (last sentence of the first step).

Hope this helps a bit

[1] With the exception of the Makefile edit

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5525
  • Languages: EN, NO
Re: [r8764] Freetype build broken on Ubuntu
« Reply #5 on: June 04, 2019, 05:38:22 AM »
On my Linux box, both freetype-config and pkg-config freetype2 works. On MSYS2, only freetype-config works. Since it is apparently possible to get new versions to work the old way, but not to get old versions to work the new way, it is probably best for Simutrans to stick with the legacy as default for now. Maybe it is possible for the Makefile to try both, but I don't know enough Makefile to know how to do that.