tags:

views:

24

answers:

1

Hi,

I am trying to run a program that manually uses FreeType. I should not compile FreeType to a library but use source code directly. At the moment I can compile my code with no errors. However, when I run my program on Ubuntu it gives a segmentation fault. I believe the problem is related to module structure. I am using FreeType to convert ttf to bitmap, thus I included tt, sfnt, and psnames modules. However, there is something wrong with their initialization I guess.

+2  A: 

Why are you avoiding Ubuntu's provided libfreetype6 and libfreetype6-dev packages?

I could understand that you goal might be to make changes to libfreetype, and thus have an easy way to make your needed changes without affecting the rest of the system, but you're always going to want to use FreeType as a library. (Sure, you could statically link against it, but in my experience, statically linking usually adds to problems instead of removing problems.)

So you could install your own local copy of FreeType into /usr/local/lib/ or ~/local/lib/ (use ./configure --prefix=/usr/local or --prefix=~/local/).

Then when compiling your program, you'd use gcc -I ~/local/include -L ~/local/lib ...

sarnold
thank you for your answer. The thing is I will use my code on a prototype machine that only has gcc. Probably we can compile the library on that machine, but my boss does not want to use a library. He says the code should be compiled without requiring a link to the library. I already made the conversion for the source code and the code compiles now. However, there is something wrong with execution of modules.
@elasolova, at least on my Ubuntu system, libfreetype is linked against libz.so as well. Did you also make a suitable replacement for the compression routines? or remove them? (Or will it still link against the system's /lib/libz.so.1?) If you've gotten this far, then perhaps there's something more specific that needs to be fixed: try pasting the output from `ldd` on your resulting binary and the error message you get when trying to run it.
sarnold