Unable to compile ROOT because of freetype2 error

Hi all,
I am trying to compile root on System76 Gazelle Professional laptop running Arch linux. I did git clone root.cern.ch/git/root.git, cd’d into the root directory, and did ./configure.

When execute make, I get the following error,

[code]make[1]: Entering directory '/home/raphael/root/graf2d/asimage/src/libAfterImage’
gcc -m64 -O3 -DNO_DEBUG_OUTPUT -fPIC -I/usr/include/freetype2 -c asfont.c -o asfont.o
asfont.c:67:33: fatal error: freetype/freetype.h: No such file or directory

include <freetype/freetype.h>

                             ^

compilation terminated.
Makefile:372: recipe for target ‘asfont.o’ failed
make[1]: *** [asfont.o] Error 1
make[1]: Leaving directory ‘/home/raphael/root/graf2d/asimage/src/libAfterImage’
/home/raphael/root/graf2d/asimage/Module.mk:211: recipe for target ‘graf2d/asimage/src/libAfterImage/libAfterImage.a’ failed
make: *** [graf2d/asimage/src/libAfterImage/libAfterImage.a] Error 2[/code]

I’m not sure what I should do. I searched the internet, but I didn’t find a solution to this. Can someone help me?

Thank you in advance.

It looks like you do not have freetype installed on your machine. You can use the one coming with ROOT.
Redo the configure command with the option --enable-builtin-freetype

I do have them installed. I very recently installed the infinality fonts bundle, but that still has the freetype fonts. I also ran into the same compilation error before I installed the bundle.

Anyways, I tried

and then make, but I still get the same error. So now I’m really lost.

I’m having the same trouble compiling 5.34.13 on ArchLinux x86_64. I have configured the build without internal freetype:

Checking for freetype-config ... 
Checking for libfreetype version >= 9.3.0
Result: ok
Checking whether to build included libfreetype6
Result: no

In my system, the freetype headers are in /usr/include/freetype2/ and the build system correctly finds this path, but then I get:

gcc -m64 -O3 -DNO_DEBUG_OUTPUT -fPIC    -I/usr/include/freetype2    -c asfont.c -o asfont.o
asfont.c:67:33: fatal error: freetype/freetype.h: No such file or directory
 #  include <freetype/freetype.h>

So the path is correctly passed to the compiler, but then in asfont.c the header is included as freetype/freetype.h rather than freetype.h, and I guess this where the error is generated. I think it can be a problem with preprocessor flags since inside asfont.c I read:

# ifdef HAVE_FREETYPE_FREETYPE
#  include <freetype/freetype.h>
# else
#  include <freetype.h>
# endif

I don’t know what is the purpose of HAVE_FREETYPE_FREETYPE but it seems that in this case it has been wrongly defined while it should be left undefined.

By the way, I had no problem in compiling Root 5.34.10 (didn’t try with 5.34.11 and 5.34.12).

So why doesn’t

work? Why does it return the same error?

Yes the new freetype has change we have issue openned here:
sft.its.cern.ch/jira/browse/ROOT-5817?filter=-1
I am looking at it.

I tried to compile v5-34-10, because it Nicola was able to compile it. I tried:

I then ran configure and make again, but obtained the same freetype compile error.

I also pulled the latest changes from the master branch, but still no luck. Has anyone been able to compile it?

I have been able to work around this error. Going by what Nicola said, I created a freetype directory in /usr/include/freetype2 and made a symbolic link back to /usr/include/freetype2/freetype.h

[quote=“Nicola_Mori”]
In my system, the freetype headers are in /usr/include/freetype2/ and the build system correctly finds this path, but then I get:

gcc -m64 -O3 -DNO_DEBUG_OUTPUT -fPIC    -I/usr/include/freetype2    -c asfont.c -o asfont.o
asfont.c:67:33: fatal error: freetype/freetype.h: No such file or directory
 #  include <freetype/freetype.h>

So the path is correctly passed to the compiler, but then in asfont.c the header is included as freetype/freetype.h rather than freetype.h, and I guess this where the error is generated. [/quote]

[quote=“jazzax”]I have been able to work around this error. Going by what Nicola said, I created a freetype directory in /usr/include/freetype2 and made a symbolic link back to /usr/include/freetype2/freetype.h

[/quote]

Hi, AFAIK you do not need workarounds anymore - this problem was fixed recently. Can you, please, try v5-34-00-patches or ROOT 6 (trunk)? Or do you have to work with some fixed release?

I am trying to compile the trunk. I got it using

However, I’m still getting the same compile error. I did git pull to make sure it was up to date. Am I missing something?

[quote=“shadeless”]I am trying to compile the trunk. I got it using

However, I’m still getting the same compile error. I did git pull to make sure it was up to date. Am I missing something?[/quote]

No, it should work. Probably, I’ve misunderstood something, I’ve seen this (it’s also related to the “new” freetype’s sources layout) : Mac OS X 10.9 / macport - compile issue so I was quite sure everything is ok with freetype now.

./configure --enable-builtin-freetype

with that it should be fine if you do not have freetype installed.( I have done in fix in trunk and 5.34)
you do not need and special link.

If you have freetype installed which version do you have ?

The flag HAVE_FREETYPE_FREETYPE

Is define in:

$ROOTSYS/graf2d/asimage/src/libAfterImage/config.h

the file is created thanks to:

$ROOTSYS/graf2d/asimage/src/libAfterImage/configure.in

Could it be that. on your machine, HAVE_FREETYPE_FREETYPE is wrongly defined (or not) ?

I have freetype2-infinality-ultimate 2.5.2-3 installed. Due to dependency issues, I haven’t figured out how to replace this patched version of freetype2 with the standard version.

When I try to compile, it looks for freetype.h in the a freetype directory. I have freetype.h in /usr/include/freetype2. That’s when it gives me the compile error.

I tried using configure --enable-builtin-freetype, but it still gives me the same error message. It’s odd that it’s still looking for that header.

In $ROOTSYS/graf2d/asimage/src/libAfterImage/config.h, I have

/* Define if libFreeType is available */
#define HAVE_FREETYPE 1

/* Define if libFreeType has freetype.h in freetype/ */
#define HAVE_FREETYPE_FREETYPE

/* Define to 1 if you have the <ft2build.h> header file. */
#define HAVE_FT2BUILD_H

what about if in config.h you remove

#define HAVE_FREETYPE_FREETYPE

It finally compiled after I commented out

After I did it, i just did ./configure without having to specify the --enable-builtin-freetype. That seems a little weird to me. Does it still think that freetype.h is in /usr/include/freetype instead of /usr/include/freetype2?

In principle configure tells you where freetype has been found.

I have the same problem and I bypass it by making a link
ln -s /usr/include/freetype2 /usr/include/freetype
(yes you need to be root)
code tries to include “freetype/freetype.h”

I suppose configure doesn’t deal correctly these new freetype version.

This is actually a packaging bug.

In asimage/src/libAfterImage/config.h.in

#define HAVE_FREETYPE_FREETYPE

is incorrectly set.

If you run “autoheader” in asimage/src/libAfterImage again it will create the correct config.h.in. “autoconf” and “configure” will create the correct defines to be able to compile…

I simply change the code of graf2d/asimage/src/libAfterImage/asfont.c
find “freetype/freetype.h”, change it with “freetype2/freetype.h”