How do I build xpdf? Missing freetype!

Asked by rrevo

I needed to build xpdf from source. However I am missing some dependencies to freetype. Please let me know how I can proceed.

# First I got the xpdf dependencies
$ sudo apt-get build-dep xpdf

#Next got the sources
$ apt-get source xpdf

# Ran configure
$ ./configure
...[snip]
checking whether to use freetype2 library... maybe
checking where to find the freetype2 header files...
checking ft2build.h usability... no
checking ft2build.h presence... no
checking for ft2build.h... no
not using freetype2 library
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating goo/Makefile
config.status: creating fofi/Makefile
config.status: creating splash/Makefile
config.status: creating xpdf/Makefile
config.status: creating aconf.h
config.status: aconf.h is unchanged
configure: WARNING: Couldn't find FreeType
configure: WARNING: -- You will be able to compile pdftops, pdftotext,
        pdfinfo, pdffonts, and pdfimages, but not xpdf or pdftoppm

I think its looking for ft2build.h. How do I get Freetype so that this dependency can be resolved? libfreetype6 and libfreetype6-dev are installed.

Thanks

rrevo

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu xpdf Edit question
Assignee:
No assignee Edit question
Solved by:
rrevo
Solved:
Last query:
Last reply:
Revision history for this message
Mark Rijckenberg (markrijckenberg) said :
#1

Hi,

Please run the following in the commandline:

sudo aptitude update
sudo aptitude install ftgl-dev lesstif

Then retry the .configure

If it still does not work, please send us the output of following command:

sudo aptitude search freetype

I am currently at work using a Windows machine, so I cannot do further testing on xpdf myself.

Regards,

Mark

Revision history for this message
rrevo (rahulrevo) said :
#2

Did not work. configure gives the same warning as before.

Output -
$ sudo aptitude search freetype
v freetype-tools -
p freetype1-tools - Bundled tests, demos and tools for FreeType 1
p freetype2-demos - FreeType 2 demonstration programs
i libfreetype6 - FreeType 2 font engine, shared library files
i A libfreetype6-dev - FreeType 2 font engine, development files

Revision history for this message
Bhavani Shankar (bhavi) said :
#3

apt-get source xpdf

cd into the extracted directory

then cd into the debian directory

then edit the control file

gedit control

add the missing dependencies to the build depends line

save the file

then do

dch -e

add the line

Updated Build-Depends.

then

save the file (cntrl +x then y)

then

debuild -S -sa

to build from source package

and finally generate the binaries using pbuilder environment

and install them using

sudo dpkg -i <name of the program.deb>

and you are done

More info

Refer to ubuntu packaging guide

https://wiki.ubuntu.com/PackagingGuide

Regards

Revision history for this message
Mark Rijckenberg (markrijckenberg) said :
#4

Hi,

Following link might also be helpful:

http://www.foolabs.com/xpdf/problems.html

"There are a few common problems encountered when compiling Xpdf with FreeType 2. The symptoms are weird compile errors that appear to be related to FreeType ("FT_Error not declared", syntax errors in FreeType include files, etc.)

FreeType 2 requires two different directories on the include path. For example, if you have FT2 installed in /usr/local, you'll need "-I/usr/local/include" (for <ft2build.h>) and "-I/usr/local/include/freetype2" (for <freetype/*.h>). The Xpdf configure script doesn't provide any way of setting two different include directories for FT2.

It gets worse... If you also have FreeType 1 installed in (for example) /usr/local, the /usr/local/include/freetype2 directory must be searched before /usr/local/include (because FT1 installs /usr/local/include/freetype/*.h, and has many file names in common with FT 2 - these get loaded instead of the FT2 files).

You may also have FreeType 1 or an older version of FreeType 2 installed somewhere else on the standard include search path (typically /usr/X11R6/include on Linux systems). This can cause the same sort of problems.

I haven't come up with a clean solution for this. There are two kludges:

1. You can create a link for ft2build.h:

    cd /usr/local/include/freetype2
    ln -s ../ft2build.h

2. You can set CXXFLAGS on the command line before you run configure:

    export CXXFLAGS="-I/usr/local/include/freetype2 -I/usr/local/include"
    ./configure
    make

(If you're running sh/bash/etc. use "export CXXFLAGS=..." instead of "setenv CXXFLAGS ...".)

You'll need to adjust those paths to match your FreeType 2 installation. "

Regards,

Mark

Revision history for this message
rrevo (rahulrevo) said :
#5

ft2build.h exists within /usr/include on my machine.
Also freetype2 headers are in /usr/include/freetype2/freetype/*.h

Both solutions of linking the file and setting the CXXFLAGS did not work though.

The ft2build.h contained the following code-
"#include <freetype/config/ftheader.h>"

I changed that line to-
"#include <freetype2/freetype/config/ftheader.h>"

And the rest worked.

Thanks, especially Mark

Revision history for this message
rrevo (rahulrevo) said :
#6

Changing the ft2build.h file to contain
"#include <freetype2/freetype/config/ftheader.h>" caused the xpdf target to work but it breaks the splash target.

This file was reverted to
"#include <freetype/config/ftheader.h>"

And instead I made a link to /usr/include/freetype2/freetype in /usr/include
/usr/include$ sudo ln -s freetype2/freetype

/usr/include$ ls -l freetype
lrwxrwxrwx 1 root root 18 2008-10-03 21:15 freetype -> freetype2/freetype

Revision history for this message
Curtis Porter (cporter-spillman) said :
#7

Thank you very much, your solution also worked for me on Solaris 9.

Revision history for this message
Javier (algspd) said :
#8

# ln -sf /usr/include/freetype2/freetype/ /usr/include/freetype

Worked for me

Revision history for this message
wangke (1527835267-n) said :
#9

the code of #8 slove my a big problem,thank you!