cross-compilation failed: configure by default adds native freetype to Makefile instead of --host's one
Submitted by Sergio
Assigned to Chris Wilson @ickle
Link to original bug (#106451)
Description
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:
- i686-w64-mingw32 include paths and lib paths of pixman, libpng, libz, etc with
- 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.