sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.33k stars 453 forks source link

Upgrade to FreeType 2.9.1 #27169

Closed slel closed 5 years ago

slel commented 5 years ago

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.

CC: @antonio-rojas @EmmanuelCharpentier @dimpase @embray @kiwifb @timokau @infinity0 @novoselt @slel @tobihan

Component: packages: standard

Keywords: upgrade, freetype

Author: Samuel Lelièvre, Dima Pasechnik

Branch/Commit: 4c0c338

Reviewer: François Bissey, Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/27169

slel commented 5 years ago

Branch: u/slelievre/t/27169

slel commented 5 years ago

Description changed:

--- 
+++ 
@@ -1,11 +1,9 @@
-This ticket is to upgrade to Freetype 2.9.1.
+This ticket is to upgrade to FreeType 2.9.1.

-**Tarball**
+- **Tarball**: https://download.savannah.gnu.org/releases/freetype/freetype-2.9.1.tar.bz2

-- https://download.savannah.gnu.org/releases/freetype/freetype-2.9.1.tar.bz2
-
-Our last upgrade was to Freetype 2.8.1 in #24240
+Our last upgrade was to FreeType 2.8.1 in #24240
 (merged in [SageMath](../wiki/SageMath) 8.2.beta0).

-This might help with #27163.
+This might help with #27163, see comment 27 there.
slel commented 5 years ago
comment:2

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
slel commented 5 years ago

Commit: a1dd17f

slel commented 5 years ago
comment:3

The spkg-install has something about harfbuzz.

Someone knowledgeable should check if that is still needed.

slel commented 5 years ago
comment:4

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.

kiwifb commented 5 years ago
comment:5

Yes, I thought I did the harfbuzz thing https://github.com/sagemath/sage-prod/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.

kiwifb commented 5 years ago
comment:6

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.

dimpase commented 5 years ago
comment:7

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.

slel commented 5 years ago
comment:8

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.

dimpase commented 5 years ago
comment:9

I've got past this issue by

diff --git a/build/pkgs/freetype/spkg-install b/build/pkgs/freetype/spkg-install
index 49450d4944..b2713060ac 100644
--- a/build/pkgs/freetype/spkg-install
+++ b/build/pkgs/freetype/spkg-install
@@ -1,7 +1,7 @@
 cd src

 # Disabling harfbuzz until upstream properly check for suitable version
-GNUMAKE=${MAKE} sdh_configure --with-harfbuzz=no
+GNUMAKE=${MAKE} sdh_configure --enable-freetype-config
 sdh_make
 sdh_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.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from a1dd17f to 5813943

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

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

5813943Add description + url + double license info in freetype/SPKG.txt
slel commented 5 years ago

Author: Samuel Lelièvre, Dima Pasechnik

slel commented 5 years ago
comment:11

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
dimpase commented 5 years ago
comment:12

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.

dimpase commented 5 years ago
comment:13

OK, this also appears to fix #27163

Subject to adding patch in comment 9, positive review.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

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

4c0c338Enable freetype-config and no longer disable harfbuzz
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 5813943 to 4c0c338

slel commented 5 years ago
comment:15

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

slel commented 5 years ago

Reviewer: François Bissey, Dima Pasechnik

slel commented 5 years ago
comment:16

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

kiwifb commented 5 years ago
comment:17

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

novoselt commented 5 years ago
comment:18

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

7822f248-ba56-45f1-ab3d-4de7482bdf9f commented 5 years ago
comment:21

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
7822f248-ba56-45f1-ab3d-4de7482bdf9f commented 5 years ago
comment:22

Replying to @EmmanuelCharpentier:

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... ]

dimpase commented 5 years ago
comment:23

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.

7822f248-ba56-45f1-ab3d-4de7482bdf9f commented 5 years ago
comment:24

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...

7822f248-ba56-45f1-ab3d-4de7482bdf9f commented 5 years ago
comment:25

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 ?

slel commented 5 years ago
comment:26

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.

slel commented 5 years ago

Description changed:

--- 
+++ 
@@ -1,6 +1,9 @@
 This ticket is to upgrade to FreeType 2.9.1.

 - **Tarball**: https://download.savannah.gnu.org/releases/freetype/freetype-2.9.1.tar.bz2
+
+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](../wiki/SageMath) 8.2.beta0).
dimpase commented 5 years ago
comment:27

Replying to @EmmanuelCharpentier:

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.

vbraun commented 5 years ago

Changed branch from u/slelievre/t/27169 to 4c0c338