Bug 106451

Summary: cross-compilation failed: configure by default adds native freetype to Makefile instead of --host's one
Product: cairo Reporter: Sergio <feedly.chsk>
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Sergio 2018-05-09 09:03:55 UTC
cairo 1.14.12 (latest versions' numbers could not be selected (are absent in list) in bug input form)

Trying to cross-build on Debian 9.4 with its MinGW-w64, and last versions of libz, libpixman, libpng built and installed (in mingw).

./configure --host=i686-w64-mingw32 --prefix=/usr/local/i686-w64-mingw32

Output fragments:

checking for cairo's FreeType font backend feature... 
checking for FREETYPE... no
checking for freetype-config... /usr/bin/freetype-config
checking freetype2 libtool version... 18.3.12 - OK
checking whether cairo's FreeType font backend feature could be enabled... yes
checking for cairo's Fontconfig font backend feature... 
checking for FONTCONFIG... no

The following font backends:
  User:          yes (always builtin)
  FreeType:      yes
  Fontconfig:    no (requires fontconfig >= 2.2.95)
  Win32:         yes


So far configure has found native freetype-config and turn freetype backend on automatically. There are vars in generated Makefile: 

$ grep -i freet Makefile
CAIRO_CFLAGS =  -D_REENTRANT     -I/usr/local/i686-w64-mingw32/include/pixman-1      -I/usr/local/i686-w64-mingw32/include/libpng16 -I/usr/i686-w64-mingw32/include     -Wall -Wextra -Wmissing-declarations -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wsign-compare -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wvolatile-register-var -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline -fno-strict-aliasing -fno-common -Wp,-D_FORTIFY_SOURCE=2 -Wno-unused-but-set-variable           -I/usr/include/freetype2     
CAIRO_LIBS =  -lpthread     -L/usr/local/i686-w64-mingw32/lib -lpixman-1      -L/usr/local/i686-w64-mingw32/lib -L/usr/i686-w64-mingw32/lib -lpng16 -lz  -lgdi32 -lmsimg32          -lz -lz -L/usr/lib/x86_64-linux-gnu -lfreetype     
CAIRO_NONPKGCONFIG_CFLAGS =           -I/usr/include/freetype2     
CAIRO_NONPKGCONFIG_LIBS =         -lz -lz -L/usr/lib/x86_64-linux-gnu -lfreetype     
FREETYPE_CFLAGS = 
FREETYPE_CONFIG = /usr/bin/freetype-config
FREETYPE_LIBS = 

As you can see configure mixes:
1) i686-w64-mingw32 include paths and lib paths of pixman, libpng, libz, etc with 
2) localhost's x86_64-linux-gnu paths of freetype include, lib and freetype-config. 
Next make fails of course:

Generating cairo.def
  CCLD     libcairo.la
/usr/lib/x86_64-linux-gnu/libfreetype.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

Appending --enable-ft=no to configure arguments resolves issue through disabling freetype. 

What is expected by me? I expect crossbuilding with default args --host and --prefix should succeed. If no usable freetype installation found then freetype part has to be automatically disabled by configure. Warnings are to be printed at the summary table at the end of configure's console ouput.
Comment 1 GitLab Migration User 2018-08-25 13:35:27 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/84.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.