#27169 closed enhancement (fixed)

Upgrade to FreeType 2.9.1

Reported by: slelievre Owned by:
Priority: major Milestone: sage-8.7
Component: packages: standard Keywords: upgrade, freetype
Cc: arojas, charpent, dimpase, embray, fbissey, gh-timokau, infinity0, novoselt, slelievre, thansen Merged in:
Authors: Samuel Lelièvre, Dima Pasechnik Reviewers: François Bissey, Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: 4c0c338 (Commits) Commit: 4c0c33816b155d6775f6d99318e6f9d9249add9b
Dependencies: Stopgaps:

Description (last modified by slelievre)

This ticket is to upgrade to FreeType 2.9.1.

Note that downloading from that url works in a browser but not with curl -O $URL which results in a zero byte file. Some redirection must be going on.

Our last upgrade was to FreeType 2.8.1 in #24240 (merged in SageMath 8.2.beta0).

This might help with #27163, see comment 27 there.

Change History (28)

comment:1 Changed 22 months ago by slelievre

  • Branch set to u/slelievre/t/27169

comment:2 Changed 22 months ago by slelievre

  • Cc fbissey added
  • Commit set to a1dd17fddae717cfe602e3ece5d47ca547a8816e
  • Description modified (diff)
  • Summary changed from Upgrade to Freetype 2.9.1 to Upgrade to FreeType 2.9.1

To upgrade, I downloaded the new tarball to upstream and then ran

sage --package update freetype 2.9.1

New commits:

a1dd17fUpgrade to FreeType 2.9.1

comment:3 Changed 22 months ago by slelievre

The spkg-install has something about harfbuzz.

Someone knowledgeable should check if that is still needed.

comment:4 Changed 22 months ago by slelievre

According to FreeType documentation,

FreeType is released under two open-source licenses: our own BSD-like FreeType License and the GNU Public License, Version 2. It can thus be used by any kind of projects, be they proprietary or not.

Not sure if this double licensing was already the case when FreeType was first included as a standard package, and whether we should update the SPKG.txt to mention that.

Last edited 22 months ago by slelievre (previous) (diff)

comment:5 Changed 22 months ago by fbissey

Yes, I thought I did the harfbuzz thing https://github.com/sagemath/sage/commit/4afa106419b7a603d77bb2c316f776226dd87fc0

That's from 2015, I am hoping it is fixed but I cannot dig into it right now.

For the license I think we should update SPKG.txt as this is relevant for redistribution.

comment:6 Changed 22 months ago by fbissey

There is a mirror of freetype on github so I could check. And the answer is yes. harfbuzz minimal version detection is now done. So it is fixed.

comment:7 Changed 22 months ago by dimpase

Something is not right - check that one gets freetype-config script installed to SAGE_LOCAL/bin. This is needed for other libs using freetype, and seems to be broken by this update.

comment:8 Changed 22 months ago by slelievre

Thanks François for mentioning that the FreeType code repo is mirrored on GitHub; the main mirror and one such mirror are at:

The FreeType README suggests:

Please read the docs/CHANGES file, it contains IMPORTANT INFORMATION.

Read the files docs/INSTALL for installation instructions; see the file docs/LICENSE.TXT for the available licenses.

The FreeType 2 API reference is located in docs/reference; use the file ft2-toc.html as the top entry point. Additional documentation is available as a separate package from our sites. Go to

and download one of the following files.

  • freetype-doc-2.9.1.tar.bz2
  • freetype-doc-2.9.1.tar.gz
  • ftdoc291.zip

To view the documentation online, go to

According to the FreeType CHANGES file (also mirrored on GitHub):

  • Use of the freetype-config script to get compilation and linking options is deprecated since it doesn't support cross-compiling, among other deficiencies. Instead, you should use the pkg-config interface.

The configure script no longer installs freetype-config by default. For backwards compatibility, a new configure option --enable-freetype-config is provided that reverts this decision.

It might be worth going through the other changes listed there.

I feel a little bit out of my depth here, if someone wants to take over.

Last edited 22 months ago by slelievre (previous) (diff)

comment:9 Changed 22 months ago by dimpase

I've got past this issue by

  • build/pkgs/freetype/spkg-install

    diff --git a/build/pkgs/freetype/spkg-install b/build/pkgs/freetype/spkg-install
    index 49450d4944..b2713060ac 100644
    a b  
    11cd src
    22
    33# Disabling harfbuzz until upstream properly check for suitable version
    4 GNUMAKE=${MAKE} sdh_configure --with-harfbuzz=no
     4GNUMAKE=${MAKE} sdh_configure --enable-freetype-config
    55sdh_make
    66sdh_make_install

(no need to worry about harfbuzz any more.)

I think the rest of updates are enhancements, we don't need to worry about them.

comment:10 Changed 22 months ago by git

  • Commit changed from a1dd17fddae717cfe602e3ece5d47ca547a8816e to 58139434d4f02198e6572747c420be9888df910b

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

5813943Add description + url + double license info in freetype/SPKG.txt

comment:11 Changed 22 months ago by slelievre

  • Authors set to Samuel Lelièvre, Dima Pasechnik

I edited SPKG.txt. Dima, would you push your change to spkg-install and set to needs_review?


New commits:

5813943Add description + url + double license info in freetype/SPKG.txt

comment:12 Changed 22 months ago by dimpase

I can't push to your personal branch. As this is the only difference so far, and hopefully stays this way, I'd rather let you add this change yourself.

comment:13 Changed 22 months ago by dimpase

OK, this also appears to fix #27163

Subject to adding patch in comment 9, positive review.

comment:14 Changed 22 months ago by git

  • Commit changed from 58139434d4f02198e6572747c420be9888df910b to 4c0c33816b155d6775f6d99318e6f9d9249add9b

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

4c0c338Enable freetype-config and no longer disable harfbuzz

comment:15 Changed 22 months ago by slelievre

  • Reviewers set to François Bissey, Dima Pasechnik
  • Status changed from new to needs_review

Should have used a public branch, sorry. Added your change now.

comment:16 Changed 22 months ago by slelievre

  • Cc novoselt added

Cc-ing Andrey Novoseltsev in case this might impact SageCell.

comment:17 Changed 22 months ago by fbissey

Looks good to me. Let's see if Andrey has something to say before putting it to positive review.

comment:18 Changed 22 months ago by novoselt

I hope that SageMathCell will not be affected, so please go ahead!

comment:19 Changed 22 months ago by fbissey

  • Status changed from needs_review to positive_review

comment:20 Changed 22 months ago by slelievre

  • Type changed from PLEASE CHANGE to enhancement

comment:21 follow-up: Changed 22 months ago by charpent

  • Status changed from positive_review to needs_work

On Debian testing, neither develop+#27169 nor develop+#25674+#27169 give a fincyional results. In both cases :

> capabilities()
       jpeg         png        tiff       tcltk         X11        aqua 
      FALSE       FALSE       FALSE        TRUE       FALSE       FALSE 
   http/ftp     sockets      libxml        fifo      cledit       iconv 
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
        NLS     profmem       cairo         ICU long.double     libcurl 
       TRUE       FALSE       FALSE        TRUE        TRUE        TRUE 
Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
  impossible de charger l'objet partagé '/usr/local/sage-8/local/lib/R//modules//R_X11.so':
  /usr/lib/x86_64-linux-gnu/libcairo.so.2: undefined symbol: FT_Done_MM_Var

and

> install.packages("Cairo")
--- SVP sélectionner un miroir CRAN pour cette session ---
Secure CRAN mirrors 

 1: 0-Cloud [https]                   2: Algeria [https]                
 3: Australia (Canberra) [https]      4: Australia (Melbourne 1) [https]
 5: Australia (Melbourne 2) [https]   6: Australia (Perth) [https]      
 7: Austria [https]                   8: Belgium (Ghent) [https]        
 9: Brazil (PR) [https]              10: Brazil (RJ) [https]            
11: Brazil (SP 1) [https]            12: Brazil (SP 2) [https]          
13: Bulgaria [https]                 14: Chile 1 [https]                
15: Chile 2 [https]                  16: China (Hong Kong) [https]      
17: China (Guangzhou) [https]        18: China (Lanzhou) [https]        
19: China (Shanghai 1) [https]       20: China (Shanghai 2) [https]     
21: Colombia (Cali) [https]          22: Czech Republic [https]         
23: Denmark [https]                  24: East Asia [https]              
25: Ecuador (Cuenca) [https]         26: Ecuador (Quito) [https]        
27: Estonia [https]                  28: France (Lyon 1) [https]        
29: France (Lyon 2) [https]          30: France (Marseille) [https]     
31: France (Montpellier) [https]     32: France (Paris 2) [https]       
33: Germany (Erlangen) [https]       34: Germany (Göttingen) [https]    
35: Germany (Münster) [https]        36: Greece [https]                 
37: Iceland [https]                  38: India [https]                  
39: Indonesia (Jakarta) [https]      40: Ireland [https]                
41: Italy (Padua) [https]            42: Japan (Tokyo) [https]          
43: Japan (Yonezawa) [https]         44: Korea (Busan) [https]          
45: Korea (Gyeongsan-si) [https]     46: Korea (Seoul 1) [https]        
47: Korea (Ulsan) [https]            48: Malaysia [https]               
49: Mexico (Mexico City) [https]     50: Norway [https]                 
51: Philippines [https]              52: Serbia [https]                 
53: Spain (A Coruña) [https]         54: Spain (Madrid) [https]         
55: Sweden [https]                   56: Switzerland [https]            
57: Turkey (Denizli) [https]         58: Turkey (Mersin) [https]        
59: UK (Bristol) [https]             60: UK (London 1) [https]          
61: USA (CA 1) [https]               62: USA (IA) [https]               
63: USA (KS) [https]                 64: USA (MI 1) [https]             
65: USA (OR) [https]                 66: USA (TN) [https]               
67: USA (TX 1) [https]               68: Uruguay [https]                
69: (other mirrors)                  

Selection: 32
essai de l'URL 'https://cran.univ-paris1.fr/src/contrib/Cairo_1.5-9.tar.gz'
Content type 'application/x-gzip' length 86982 bytes (84 KB)
==================================================
downloaded 84 KB

* installing *source* package ‘Cairo’ ...
** package ‘Cairo’ correctement décompressé et sommes MD5 vérifiées
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for pkg-config... /usr/local/sage-8/local/bin/pkg-config
checking whether pkg-config knows about cairo... yes
checking for configurable backends... cairo cairo-ft cairo-pdf cairo-png cairo-ps cairo-xlib cairo-xlib-xrender
configure: CAIRO_CFLAGS=-I/usr/local/sage-8/local/include -I/usr/local/sage-8/local/include/freetype2 -I/usr/local/sage-8/local/include -I/usr/local/sage-8/local/include/libpng16 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid
checking if R was compiled with the RConn patch... no
checking cairo.h usability... yes
checking cairo.h presence... yes
checking for cairo.h... yes
checking for PNG support in Cairo... yes
checking for ATS font support in Cairo... no
configure: CAIRO_LIBS=-L/usr/local/sage-8/local/lib -lfreetype -lz -lpng16 -lz -lcairo -lXext -lXrender -lX11
checking for library containing deflate... no
checking whether Cairo programs can be compiled... configure: error: Cannot compile a simple Cairo program. See config.log for details.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/usr/local/sage-8/local/lib/R/library/Cairo’

Les packages source téléchargés sont dans
	‘/tmp/RtmpDoPTkq/downloaded_packages’
Warning message:
In install.packages("Cairo") :
  l'installation du package ‘Cairo’ a eu un statut de sortie non nul

comment:22 in reply to: ↑ 21 Changed 22 months ago by charpent

Replying to charpent:

Please forget that. Apparently, the tarbal download didn't work an I didn't see that. I'll have to retry.

My most sincere apologies...

[ Lots of bollocks : Snip... ]

comment:23 follow-up: Changed 22 months ago by dimpase

You can always check what version of freetype you have installed in Sage by calling, at sage -sh prompt, freetype-config --ftversion. E.g.

$ sage -sh
...
$ freetype-config  --ftversion
2.9.1

by the way, no need to post lists of CRAN mirrors---you probably also know that

install.packages('Cairo', repos='https://cran.univ-paris1.fr')

would automatically get to the repo of your choice.

comment:24 Changed 22 months ago by charpent

  • Status changed from needs_work to positive_review

After squelching my coroirate firewall's BS and *correctly* installing the source tarball, I now get graphical capabilities with both R 3.4.4 and R 3.5.3 ; in both cases, teh R Cairo package installs correctly.

ptestlong underway (with 3.5.2). That will take a bit of time...

comment:25 in reply to: ↑ 23 ; follow-up: Changed 22 months ago by charpent

Replying to dimpase:

You can always check what version of freetype you have installed in Sage by calling, at sage -sh prompt, freetype-config --ftversion. E.g.

$ sage -sh
...
$ freetype-config  --ftversion
2.9.1

I didn't knew that. Thanks for the tip !

by the way, no need to post lists of CRAN mirrors

Indeed. I was typing too fast...

---you probably also know that

install.packages('Cairo', repos='https://cran.univ-paris1.fr')

would automatically get to the repo of your choice.

Indeed also. But the damn firewall tries to nanny us, which seriously interferes with the availability of a given site, changing with time... So I tend to systematically let R search for a suitable repository.

What troubles me more is that make didn't display any error when I recompiled without the proper freetype source tarball. It should have complained, no ?

comment:26 Changed 22 months ago by slelievre

  • Description modified (diff)

Forgot to warn that downloading from that url works in a browser but not with curl -O $URL which results in a zero byte file. Some redirection must be going on.

comment:27 in reply to: ↑ 25 Changed 22 months ago by dimpase

Replying to charpent:

What troubles me more is that make didn't display any error when I recompiled without the proper freetype source tarball. It should have complained, no ?

Sage's dependencies resolution is far from ideal. The first thing I'd to to test a new package is to run ./sage -f <package_name> followed by make build.

comment:28 Changed 22 months ago by vbraun

  • Branch changed from u/slelievre/t/27169 to 4c0c33816b155d6775f6d99318e6f9d9249add9b
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.