STR #3473

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features ]

STR #3473

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:4 - High, e.g. key functionality not working
Scope:2 - Specific to an operating system
Subsystem:Config Files
Summary:Proposal: use `pkg-config` to detect `freetype2` rather than `freetype-config`.
Created By:deech
Assigned To:AlbrechtS
Fix Version:1.3-current
Fix Commit:669f159665b04a3bf9c2dbbe9db71b59a45e46c2
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Name/Time/Date Filename/Size top right image
#1 deech
05:14 May 24, 2018
#2 chris
09:24 Aug 19, 2018
#3 chris
23:55 Aug 19, 2018
bottom left image   bottom right image

Trouble Report Comments:

Name/Time/Date Text top right image
#1 deech
18:18 May 23, 2018
Currently on the latest Arch Linux `xft` is not detected properly because the Arch `freetype2` package has stopped shipping `freetype-config` which is used on line 1038-1040 of `` to populate the appropriate C flags. The suggested workaround is to use `pkg-config --cflags freetype2`.

Although some of the less bleeding-edge distros like Debian still include `freetype-config` I think it's only a matter of time before they stop supporting it as well.

Would there be any objection to introducing a dependency on `pkg-config` with `xft` is enabled? I am happy to make a patch.
#2 deech
05:14 May 24, 2018
I've attached a patch to ``.  
#3 AlbrechtS
22:38 May 26, 2018
Thanks for the patch, I'll take a look into it when time permits.

I'm not sure if we want to have a dependency on pkg-config though. Since I don't have time to verify it right now, some questions:

(1) Does your patch test whether pkg-config is available?
(2) Is there a fallback to the "old way" if pkg-config is missing?

A quick glance at the patch seems to indicate that (1) is true, but I can't see if (2) is also true. Sorry for my lack of time to investigate further.
#4 chris
09:23 Aug 19, 2018
Stumbled over this problem now too..

The "web" seems to agree to use pkg-config for this test.

Attaching a simpler version of a possible patch.

This change should probably also be done for FLTK-1.3.
#5 AlbrechtS
13:23 Aug 19, 2018
I agree that we need to change this.

But I think we need to support a fallback for older systems that still have freetype-config and don't have pkg-config installed. We should:

(1) try pkg-config first
(2) try freetype-config if (1) fails
(3) output an error message if both methods fail

The error message (3) should recommend to install pkg-config.
#6 chris
23:58 Aug 19, 2018
Updated patch working as Albrecht outlines.
Strangely on my Ubuntu 18.04 machine `pkg-config --cflags xft`did not find a package, but `pkg-config --cflags freetype2`did, so I included both versions.
#7 AlbrechtS
02:10 Aug 27, 2018
@Chris: Thanks for the modified patch. Looks good, but I couldn't test it yet.

Note to myself and other devs (@Chris: no need to update the patch):

There's an issue if pkg-config is not present. The second 'if' clause does not consider this. It should be nested like this (untested):

+     if test "x$PKGCONFIG" != x; then
+         FT_FLAGS="`$PKGCONFIG --cflags xft`"
+         if test "x$FT_FLAGS" = x; then
+             FT_FLAGS="`$PKGCONFIG --cflags freetype2`"
+         fi
+     fi
+     # if that failed, try freetype-config
#8 AlbrechtS
02:19 Aug 27, 2018
Raised priority to 4 (high).

As Chris wrote in comment #4 a patch equivalent to this one *should* be applied to FLTK 1.3.5 as well since some distros don't ship freetype-config anymore.

Otherwise FLTK 1.3.x wouldn't build on Linux/Unix with Xft. The dependency on pkg-config seems to be less important, particularly because freetype-config will be used as fallback if pkg-config is not installed, for instance on older systems.
#9 manolo
09:19 Jan 30, 2019
Fixed in Git repository.

The proposed patch, modified as indicated in comment #7,
has been tested with and without the freetype-config
command, and all runs well.

This has been committed to 2 git branches: master and branch-1.3

@Albrecht: thanks for your solution, and feel free to close this
STR if you agree it's correctly fixed.
#10 AlbrechtS
15:14 Feb 12, 2019
@Manolo: thanks for committing and testing. Looks OK, I'll close this STR.

I only checked the patch and proposed my change in comment #7. The patches were from deech and chris, resp., so we need to thank them.

bottom left image   bottom right image

Return to Bugs & Features ]


Comments are owned by the poster. All other content is copyright 1998-2022 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.