Page 1 of 1

FreeType2 compile-time errors. [solved]

Posted: Sun Jul 05, 2009 6:30 am
by vulcan
I recently restarted a project I put on hold for about a year and I'm having problems compiling part of the code that uses the FreeType2 library posted here. The code compiled flawlessly with a previous version of the SDK (about a year old...), but I get a linking error with a recent update (26/06/09) of the SDK. Unfortunately I did not keep a copy of the older SDK.

I recompiled the FreeType2 library against the newer SDK without any problems, but the problem still persists. It seems that using the FT_Init_FreeType( ... ) function causes the error that I can't seem to fix.

For simplicity, this code reproduces the same error. FT_New_Face( ... ) is included to show that the rest of the program compiles "fine" but the FT_Init_FreeType( ... ) causes an error, and is hopefully the only one that does so. Could anyone with the FreeType2 library test this out for me and see if it compiles?

Code: Select all

#include <ft2build.h>
#include FT_FREETYPE_H

int main&#40; int argc, char **argv &#41;
&#123;
	FT_Library ft2Library;
	FT_Face ft2Face;

	// Comment this and voila... no compile-time error &#58;-$
	FT_Init_FreeType&#40; &ft2Library &#41;;

	// Source parameter is left NULL intentionally.
	FT_New_Face&#40; ft2Library, NULL, 0, &ft2Face &#41;;

	return 0;
&#125;
Makefile:

Code: Select all

EE_BIN             = freetype.elf
EE_OBJS         = main.o
EE_INCS          += -I ./include -I $&#40;PS2DEV&#41;/.. -I $&#40;PS2SDK&#41;/ports/include
EE_LDFLAGS	  = -L $&#40;PS2DEV&#41;/.. -L $&#40;PS2SDK&#41;/ports/lib -L $&#40;PS2SDK&#41;/ee/lib
EE_CFLAGS    += -fno-builtin-printf -Wall
EE_LIBS           = -lfreetype -lkernel -lc -lgcc

all&#58; $&#40;EE_BIN&#41;

clean&#58;
	@rm -f $&#40;EE_BIN&#41; $&#40;EE_OBJS&#41;

include $&#40;PS2SDK&#41;/samples/Makefile.pref
include $&#40;PS2SDK&#41;/samples/Makefile.eeglobal
Error:
/usr/local/ps2dev/ps2sdk/ports/lib/libfreetype.a(type1cid.o)(.text+0x12d4):src/cid/cidload.c:332: undefined reference to `_ctype_'
/usr/local/ps2dev/ps2sdk/ports/lib/libfreetype.a(type1cid.o)(.text+0x12d8):src/cid/cidload.c:332: undefined reference to `_ctype_'
/usr/local/ps2dev/ps2sdk/ports/lib/libfreetype.a(type1.o)(.text+0x7d8):src/type1/t1afm.c:115: undefined reference to `_ctype_'
/usr/local/ps2dev/ps2sdk/ports/lib/libfreetype.a(type1.o)(.text+0x2c10):src/type1/t1afm.c:66: undefined reference to `_ctype_'
/usr/local/ps2dev/ps2sdk/ports/lib/libfreetype.a(type1.o)(.text+0x7dc):src/type1/t1afm.c:115: undefined reference to `_ctype_'
/usr/local/ps2dev/ps2sdk/ports/lib/libfreetype.a(type1.o)(.text+0x828):src/type1/t1afm.c:124: more undefined references to `_ctype_' follow
/usr/local/ps2dev/ps2sdk/ports/lib/libfreetype.a(type42.o)(.text+0x2078):src/type42/t42drivr.c:96: undefined reference to `atoi'
collect2: ld returned 1 exit status
make: *** [freetype.elf] Error 1

Additional info:
OS: Debian GNU/Linux squeeze/sid

libfreetype is installed under:
/usr/local/ps2dev/ps2sdk/ports/include/freetype/
/usr/local/ps2dev/ps2sdk/ports/include/ft2build.h
/usr/local/ps2dev/ps2sdk/ports/libfreetype.a

Posted: Mon Jul 06, 2009 12:38 am
by Mega Man
I suggest to use ps2sdk-ports/freetype from SVN.

Posted: Mon Jul 06, 2009 7:33 am
by vulcan
Perfect! The code snippet compiled! I can't believe I did not look through the SVN. Thanks a lot Mega Man! Now let's hope everything else works fine :-)