Opened 9 years ago

Closed 9 years ago

#15561 closed defect (fixed)

freetype 2.3.5 is too old for some fonts of current systems.

Reported by: Emmanuel Charpentier Owned by:
Priority: major Milestone: sage-6.1
Component: packages: standard Keywords: r-project graphics interfaces
Cc: Merged in:
Authors: Emmanuel Charpentier, Volker Braun Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: u/charpent/ticket/15561 (Commits, GitHub, GitLab) Commit: c70498bb446188823dcb355b474938f3a8acfb8f
Dependencies: #15539 Stopgaps:

Status badges

Description (last modified by Volker Braun)

The now-current freetype library has problems with newer fonts. This forbids its uses in some applications on machines having system fonts not supported by this version.

This was diagnosed on sage's R (see this thread) by Volker Braun.

A stopgap measure is to upgrade freetype to a more forgiving version of freetype, hence this ticket.

The current freetype tarball hits a snag in libpng, because it uses setjmp for exception handling, which triggers a compiler error due to this settinng up been made twice. So a small patch to the current libpng is part of this branch.

New tarball: http://download.savannah.gnu.org/releases/freetype/freetype-2.5.2.tar.bz2

Attachments (1)

freetype-2.5.2.tar.bz2 (1.6 MB) - added by Emmanuel Charpentier 9 years ago.
source tarball of the new versioj of freetype

Download all attachments as: .zip

Change History (28)

comment:1 Changed 9 years ago by Emmanuel Charpentier

Branch: u/charpent/ticket/15561
Created: Dec 21, 2013, 7:49:59 AMDec 21, 2013, 7:49:59 AM
Modified: Dec 21, 2013, 7:49:59 AMDec 21, 2013, 7:49:59 AM

comment:2 Changed 9 years ago by Emmanuel Charpentier

Commit: f570a62601eea75502fa2bab4431643fa1cbc2c7
Status: newneeds_review

freetype 2.5.2 installs flawlessly IFF libpng12 is patched to avoid a test for setting up error catching via setjmp in libpng12 (which freetype 2.5.2 does anyway).

The resulting sage passes make ptestlong and is able to draw a curve (from sage -R in console). So I think that this ticket is ready for review.

Since it installs a newer version of a standard package and paches another onte, I think that it should be reviewed on various system (at least Mac OS X and/or Cygwin, which seem to be the most difficult cases) before clearing it.

comment:3 Changed 9 years ago by Emmanuel Charpentier

Status: needs_reviewneeds_work

I have two problems with this branch :

1) I seem to be unable to get this code back on an sage tree on another machine :

sage -dev checkout --ticket 15561
sage -dev diff

gives me an empty diff...

2) I added a new freetype tarball in upstream and deleted the previous one. None of this appears in the branch, at least as displayed on the trac page.

I'll have to beg some help on sage-support...

Last edited 9 years ago by Emmanuel Charpentier (previous) (diff)

Changed 9 years ago by Emmanuel Charpentier

Attachment: freetype-2.5.2.tar.bz2 added

source tarball of the new versioj of freetype

comment:4 Changed 9 years ago by Emmanuel Charpentier

This branch requires the tarball of the new version of freetype, which is also attached to this ticket.

comment:5 Changed 9 years ago by Emmanuel Charpentier

Description: modified (diff)
Status: needs_workneeds_review
Summary: freetype 2.3.5 is too old for some fontsfreetype 2.3.5 is too old for some fonts of current systems.

Okay, I am satisfied that my push *was* successful, and that the ansence of the new upstream tarball was intended. So I'm putting it up for review again.

comment:6 Changed 9 years ago by Emmanuel Charpentier

Okay, I am satisfied that my push *was* successful, and that the ansence of the new upstream tarball was intended. So I'm putting it up for review again.

comment:7 Changed 9 years ago by Volker Braun

Description: modified (diff)

comment:8 Changed 9 years ago by Volker Braun

Reviewers: Volker Braun
Status: needs_reviewpositive_review

comment:9 Changed 9 years ago by Volker Braun

Dependencies: #15539

Breaks PIL, so I'm setting #15539 as dep

comment:11 in reply to:  10 Changed 9 years ago by Emmanuel Charpentier

Replying to vbraun:

Build errors: * http://build.sagemath.org/sage/builders/%20%20fast%20UW%20redhawk%20%28Ubuntu%2010.04%20x86_64%29%20incremental/builds/27/steps/compile/logs/freetype * http://build.sagemath.org/sage/builders/%20%20fast%20UW%20mod%20%28Ubuntu%208.04%20x86_64%29%20incremental/builds/26/steps/compile/logs/freetype

Ahiii ! That's the snag in libpng that triggered me to patch pngconf.h. How can i check that this patch has been applied ? This error (horror ?) originates in a code section that I #defined around...

Edit, Dec 25 : I see *another* build problem with PIL and freetype. but I could diagnose it only by creating a new sage tree and git'ing #15661 directly : adding #15561 to an already compiled tree does not force recompilation of PIL.

The problem : 

[ ... ]

gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/charpent/sagebis/sage/local/include/freetype2 -IlibImaging -I/home/charpent/sagebis/sage/local/include -I/usr/include -I/home/charpent/sagebis/sage/local/include/python2.7 -c _imagingft.c -o build/temp.linux-x86_64-2.7/_imagingft.o
_imagingft.c:68:31: fatal error: freetype/fterrors.h: Aucun fichier ou dossier de ce type
 #include <freetype/fterrors.h>
                               ^
compilation terminated.
error: command 'gcc' failed with exit status 1

[ ... ]

This happens twice (PIL attemps compilation with and without Tkinter support). This is caused by the fact that the directory containing freetype headers is no longer local/include/freetype but local/include/freetype2.

Since Pillow is now accepted in the next sage, my plan is :

  • start a new tree
  • fetch the Pillow branch (for rebase ?)
  • fetch #15561 and adjust it.

Your thoughts ?

Last edited 9 years ago by Emmanuel Charpentier (previous) (diff)

comment:12 Changed 9 years ago by Emmanuel Charpentier

Another question : should I merge #15539 and #15561 (and test with Pillow instead of PIL) ?

Last edited 9 years ago by Emmanuel Charpentier (previous) (diff)

comment:13 Changed 9 years ago by Volker Braun

You should merge in the Pillow ticket, but its not ready yet (i.e. doesn't build).

comment:14 Changed 9 years ago by Volker Braun

You need to bump the libpng patchlevel to force a rebuild (libpng/package-version.txt). Otherwise it won't be built.

comment:15 in reply to:  14 Changed 9 years ago by Emmanuel Charpentier

Replying to vbraun:

You need to bump the libpng patchlevel to force a rebuild (libpng/package-version.txt). Otherwise it won't be built.

This I do not understand : #15561 *does* bump libpng (from 1.2.35.p5 to 1.2.25p6) and freetype (from 2.3.5.p4 to 2.5.2.p0) ; #15539 does *not* touch libpng nor freetype (it *uses* them *as is*). Is there another proposed branch that bumps libpng ? If so, how can I find it ?

comment:16 in reply to:  13 Changed 9 years ago by Emmanuel Charpentier

Replying to vbraun:

You should merge in the Pillow ticket, but its not ready yet (i.e. doesn't build).

Would that be a merge (i. e. creating a branch incorporating changes both from #15539 an #15561) or a rebase (i. e. creating a patch that *assumes* that #15539 has been incorporated) ?

Now that 15539 is closed as "fixed", rebasing sounds logical. What do you advise ?

comment:17 Changed 9 years ago by Volker Braun

You should always merge (and never rebase) branches that are already published on trac, since somebody else might have used that already as a base for their own branch.

Here is the full buildbot log: http://build.sagemath.org/sage/builders/%20%20fast%20UW%20mod%20%28Ubuntu%208.04%20x86_64%29%20incremental/builds/26

It did compile libpng-1.2.35.p6, so thats your ticket.

Last edited 9 years ago by Volker Braun (previous) (diff)

comment:18 in reply to:  17 Changed 9 years ago by Emmanuel Charpentier

Replying to vbraun:

You should always merge (and never rebase) branches that are already published on trac, since somebody else might have used that already as a base for their own branch.

Okay. Can't say I fully understand it yet, but I did that.

Here is the full buildbot log: http://build.sagemath.org/sage/builders/%20%20fast%20UW%20mod%20%28Ubuntu%208.04%20x86_64%29%20incremental/builds/26 It did compile libpng-1.2.35.p6, so thats your ticket.

Indeed ! Don't understand it either. I just restarted a clean tree, used git (not sage's scripts) to fetch Pillow and #15561 in separate local branches, merged Pillow in 15561 and compiled (successfully).

In the full buildbot log, the error points at pngconf.h line 328. That's the place where the error takes places while using the *unpatched* pngconf.h ; with the patched pngconf.h, the error should take place on line 334.

Is it possible that buildbot's freetype compilation might pickup an unpatched (possibly system's) pngconf.h ? If so, how to prevent this from happening ?

Last edited 9 years ago by Emmanuel Charpentier (previous) (diff)

comment:19 Changed 9 years ago by Volker Braun

Looking at build/deps, the freetype package does not depend on libpng so will potentially build at the same time. Might be a race condition.

comment:20 in reply to:  19 Changed 9 years ago by Emmanuel Charpentier

Replying to vbraun:

Looking at build/deps, the freetype package does not depend on libpng so will potentially build at the same time. Might be a race condition.

Ouch ! Freetype depends on libpng, but libpng needs to be patched *first*, which means it can't be patched by freetype's branch, if I understand that correctly. The only way out I see is :

  1. create a new branch patching libpng in a ticket #xx
  2. wait for #xx to get reviewed and getting to state "fixed", and
  3. modify #15561 to depend on #xx.

I don't see how this can be made in one ticket. Do you have different thoughts ?

comment:21 Changed 9 years ago by Volker Braun

No, you can do everything in your current branch.

comment:22 in reply to:  21 Changed 9 years ago by Emmanuel Charpentier

Replying to vbraun:

No, you can do everything in your current branch.

I don't see how to. Care to enlighten the dummy of the day ?

comment:23 Changed 9 years ago by Volker Braun

If that race is actually the problem then you only have to add the dependency to build/deps. Then libpng will be built first (and patched as part of its build process), and then freetype will be built afterward. I think I'm missing the problem here, but in any case that should work (TM).

comment:24 Changed 9 years ago by git

Commit: f570a62601eea75502fa2bab4431643fa1cbc2c7c70498bb446188823dcb355b474938f3a8acfb8f

Branch pushed to git repo; I updated commit sha1. New commits:

c70498bbuid/deps : added a dependency of freetype on libpng in order to work around a build-time race condition.
bedf0d8Merge branch 'pillow' into ticket/15561
f005905pillow: depends on setuptools
adc90cePillow -> pillow
8987381remove PIL (it has been replaced by Pillow)
2c055bdPillow: fix patch to work against 2.2.2
6690d97doc: remove now unused environment variables
3778f42Pillow: re-resolve #9864
6df0adbreplace PIL with Pillow

comment:25 Changed 9 years ago by Emmanuel Charpentier

Status: needs_workneeds_review

comment:26 in reply to:  23 Changed 9 years ago by Emmanuel Charpentier

Replying to vbraun:

If that race is actually the problem then you only have to add the dependency to build/deps . Then libpng will be built first (and patched as part of its build process), and then freetype will be built afterward. I think I'm missing the problem here, but in any case that should work (TM).

Okay. I did that, pushed the commit and updated status to "needs review". I'm curious about the buildbot's behaviour...

Edit, a bit later : the resulting tree passes the '(make distclean ; make )' test in an enviroment where MAKE is "make -j8". So it *can* be built in a parallel setting.

Last edited 9 years ago by Emmanuel Charpentier (previous) (diff)

comment:27 Changed 9 years ago by Volker Braun

Resolution: fixed
Status: needs_reviewclosed
Note: See TracTickets for help on using tickets.