Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Cross-compiling A5.0 Linux -> Win32, can't find FreeType

Credits go to Edgar Reynaldo and SiegeLord for helping out!
This thread is locked; no one can reply to it. rss feed Print
Cross-compiling A5.0 Linux -> Win32, can't find FreeType
SimonN
Member #8,272
January 2007
avatar

Hi,

I am going to cross-compile Allegro 5.0.11 on Linux (64-bit Debian 6) for 32-bit Windows, using the MinGW 32-bit cross-compiler.

I have successfully cross-compiled zlib and libpng, and installed them to /usr/i586-mingw32msvc/lib and /usr/i586-mingw32msvc/include. No problems here, Allegro 5's cmake script finds them and enables support.

I got stuck on installing FreeType. I have successfully cross-compiled libfreetype.a and have an include directory with a single file, freetype2/ftconfig.h. I haven't figured what install path to give to FreeType's cmake, so I tried to install these manually:

/usr/i586-mingw32msvc/lib/libfreetype.a
/usr/i586-mingw32msvc/include/freetype2/ftconfig.h

...but the A5 cmake file didn't find them, disabling support. Then I tried, also unsuccessfully:

/usr/i586-mingw32msvc/local/lib/libfreetype.a
/usr/i586-mingw32msvc/local/include/freetype2/ftconfig.h

So:

Is FreeType needed at all on Windows for A5's TTF support? I suppose so?

Where does A5's cmake process with MinGW look for FreeType?

Is installing libfreetype.a and freetype2/ftconfig.h enough, or do I need to install all the FreeType headers? *** Edit: yes, this was the problem, see my reply below for detailed instructions.

Maybe someone knows what switch to pass to FreeType's cmake to get the desired behavior for make install, but that's a bonus. ;-)

SiegeLord
Member #7,827
October 2006
avatar

What cmake version are you using? I experimented with a few older cmake's the other day, and some of them definitely had trouble finding freetype.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

SimonN
Member #8,272
January 2007
avatar

$ cmake --version
cmake version 2.8.2

I think it's what came with Debian 6. :-)

SiegeLord
Member #7,827
October 2006
avatar

Yeah, try upgrading. You can download binaries from cmake's website and run them without installing. Grab the most recent one, it should be fine.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

SimonN
Member #8,272
January 2007
avatar

Thanks for the ideas.

I am running cmake 3.2.0-rc2 now, and it still doesn't find Freetype for the cross-compiler.

I'll try installing all possible freetype headers manually now. I start to believe the ftconfig.h is too little.

*****************************
Edit: Progress, lib now found
*****************************

-- Found Freetype: /usr/i586-mingw32msvc/lib/libfreetype.a (found version "2.5.5")

This file has been there all the time (!), but the missing headers were a problem.

When building Freetype with cmake, it'll build an include/ directory in the cmake build dir. Installing that is too little, as suspected above.

When doing a manual install of Freetype for MinGW, the correct thing seems to be:

mkdir BuildDir
cd BuildDir
cmake --host=i586-mingw32msvc ..
make
copy libfreetype.a into usr/i586-mingw32msvc/lib
mkdir usr/i586-mingw32msvc/include/freetype2
copy ../include/* into usr/i586-mingw32msvc/include/freetype2
copy include/* into usr/i586-mingw32msvc/include/freetype2
...and then run A5's cmake, it should find FreeType.

!!@#@%, the forum kills my slashes in front of usr >_>

In hindsight, I feel a little stupid for believing the single header to be eonugh. >_>

Thanks to you two for tips!

***********************
Remaining problems
***********************

I'm getting many undefined references when building Allegro still,
allegro-5.0.11/addons/ttf/ttf.c:891: undefined reference to `_FT_Done_FreeType'
... and similar calls to freetype in other A5 source files, even after sudo /sbin/ldconfig. I'll try to sort this out myself first.

I couldn't fix them. This is sad.

********************
Current solution
********************

I've reverted to FreeType 2.4.12. This version doesn't build with cmake, but with autotools. Now that's much easier on the end user. ;-)

rm -rf everything from FreeType 2.5.x earlier
cd (freetype-dir)
./configure --prefix=/usr/i586-mingw32msvc --build=i686-linux-gnu --host=i586-mingw32msvc
make
sudo make install
sudo /sbin/ldconfig (to be 100 % sure)

Then cmake Allegro with MinGW, which will find the lib, and make succeeds afterwards.

Phrasz
Member #10,091
August 2008

What I've had last time I built:
--------------------------------
For Both:
arch="i686-w64-mingw32"
arch="x86_64-w64-mingw32"

(Pretend $packageZIP is any FreeType tar.gz)
tar -zxf $packageZIP
mv $package/ $package-$arch
cd $package-$arch
./configure --host=$arch --prefix=/usr/$arch
make
sudo make install
cd ..

SimonN
Member #8,272
January 2007
avatar

Right, that's very similar to how I've successfully built Freetype 2.4.12. It looks cleaner than what I wrote, thanks.

The initial problems came from configuring cmake, which is used to build the current Freetype 2.5.x. :-)

Go to: