[SOLVED] Unable to compile GIT verion with freetype-2.5.4

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Message
Author
User avatar
asm64
Space Floater
Posts: 27
Joined: Fri Jan 31, 2014 6:57 am

[SOLVED] Unable to compile GIT verion with freetype-2.5.4

#1 Post by asm64 »

Hello.
I use Gentoo 64bit and tried to build current (today) version with two versions of freetype - 2.5.3-r1 and 2.5.4-r1.
And I can't finish compilation with freetype-2.5.4. But with freetype-2.5.3 everything compiles okay. Something need to edit in sources. Compiler prints compilation error on ./GG/src/Font.cpp with freetype-2.5.4-r1.

I congratulate on the coming New Year of all project participants from developers to fans of the game.
Sorry for my boozy english )) please.
Last edited by asm64 on Tue Dec 30, 2014 3:46 pm, edited 1 time in total.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Unable to compile GIT verion with freetype-2.5.4

#2 Post by Geoff the Medio »

asm64 wrote:Compiler prints compilation error on ./GG/src/Font.cpp with freetype-2.5.4-r1.
Which is?

User avatar
asm64
Space Floater
Posts: 27
Joined: Fri Jan 31, 2014 6:57 am

Re: Unable to compile GIT verion with freetype-2.5.4

#3 Post by asm64 »

Geoff the Medio wrote:Which is?
first error is:

Code: Select all

/home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:1514:29: error: ambiguous overload for 'operator+' (operand types are 'GG::X' and 'const unsigned int')
                 if (Value(x + glyph_bitmap.width) >= TEX_MAX_SIZE) { // start a new row of glyph images
/home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:1514:29: note: candidates are:

In file included from /home/pvv/GIT/freeorion/FreeOrion/GG/GG/PtRect.h:32:0,
                 from /home/pvv/GIT/freeorion/FreeOrion/GG/GG/Base.h:56,
                 from /home/pvv/GIT/freeorion/FreeOrion/GG/GG/AlignmentFlags.h:32,
                 from /home/pvv/GIT/freeorion/FreeOrion/GG/GG/Font.h:35,
                 from /home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:25:
/home/pvv/GIT/freeorion/FreeOrion/GG/GG/StrongTypedef.h:120:22: note: GG::X GG::operator+(GG::X, int)
     inline self_type operator op (self_type lhs, rhs_type rhs)  \
and so several times.

then next error:

Code: Select all

GG/src/CMakeFiles/GiGi.dir/build.make:330: recipe for target 'GG/src/CMakeFiles/GiGi.dir/Font.cpp.o' failed
make[2]: *** [GG/src/CMakeFiles/GiGi.dir/Font.cpp.o] Error 1
next error caused because previous occured:

Code: Select all

CMakeFiles/Makefile2:127: recipe for target 'GG/src/CMakeFiles/GiGi.dir/all' failed
make[1]: *** [GG/src/CMakeFiles/GiGi.dir/all] Error 2
and last error because unable to link not existing files:

Code: Select all

Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2
BUT! If I set previous version of freetype, all compiles fine.
Attachments
freeorion-freetype-2.5.4-build-error.log
build log with freetype-2.5.4
(57.84 KiB) Downloaded 190 times

User avatar
asm64
Space Floater
Posts: 27
Joined: Fri Jan 31, 2014 6:57 am

Re: Unable to compile GIT verion with freetype-2.5.4

#4 Post by asm64 »

I may help with test of a patch.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Unable to compile GIT verion with freetype-2.5.4

#5 Post by Vezzra »

I guess our Linux folks will have to look into that one...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Unable to compile GIT verion with freetype-2.5.4

#6 Post by Geoff the Medio »

Since you didn't list all the errors, I can't make a comprehensive patch, but the necessary changes should probably be something like

Code: Select all

Index: GG/src/Font.cpp
===================================================================
--- GG/src/Font.cpp	(revision 7806)
+++ GG/src/Font.cpp	(working copy)
@@ -1511,12 +1511,12 @@
                     ThrowBadGlyph("GG::Font::Init : Glyph too large for buffer'%1%'", c); // catch broken fonts
                 }
 
-                if (Value(x + glyph_bitmap.width) >= TEX_MAX_SIZE) { // start a new row of glyph images
+                if (Value(x) + glyph_bitmap.width >= TEX_MAX_SIZE) { // start a new row of glyph images
                     if (x > max_x) max_x = x;
                     x = X0;
                     y = max_y;
                 }
-                if (Value(y + glyph_bitmap.rows) >= TEX_MAX_SIZE) {
+                if (Value(y) + glyph_bitmap.rows >= TEX_MAX_SIZE) {
                     // We cannot make the texture any larger. The font does not fit.
                     ThrowBadGlyph("GG::Font::Init : Face too large for buffer. First glyph to no longer fit: '%1%'", c);
                 }
Try making similar changes at every line the produces the error.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Unable to compile GIT verion with freetype-2.5.4

#7 Post by Vezzra »

Geoff the Medio wrote:Since you didn't list all the errors
Um, he did attach the full buildlog.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Unable to compile GIT verion with freetype-2.5.4

#8 Post by Geoff the Medio »

Vezzra wrote:Um, he did attach the full buildlog.
Hrm. OK / sorry. In that case, since I can't test it, please try making similar changes on all lines with similar errors and see if it fixes them.

User avatar
asm64
Space Floater
Posts: 27
Joined: Fri Jan 31, 2014 6:57 am

Re: Unable to compile GIT verion with freetype-2.5.4

#9 Post by asm64 »

Ok. I'm try to compile with changes. I don't understand what type of GG:Y?

Code: Select all

/home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:1523:50: error: ambiguous overload for 'operator>' (operand types are 'unsigned int' and 'GG::Y')
                 if (Value(y) + glyph_bitmap.rows > max_y) {
                                                  ^
/home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:1523:50: note: candidates are:
In file included from /home/pvv/GIT/freeorion/FreeOrion/GG/GG/PtRect.h:32:0,
                 from /home/pvv/GIT/freeorion/FreeOrion/GG/GG/Base.h:56,
                 from /home/pvv/GIT/freeorion/FreeOrion/GG/GG/AlignmentFlags.h:32,
                 from /home/pvv/GIT/freeorion/FreeOrion/GG/GG/Font.h:35,
                 from /home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:25:
/home/pvv/GIT/freeorion/FreeOrion/GG/GG/StrongTypedef.h:170:17: note: bool GG::operator>(int, GG::Y)
     inline bool operator>(lhs_type x, self_type y)              \
UPS.. I think max_y must be Value(max_y)
wait please. I will try
Last edited by asm64 on Mon Dec 29, 2014 6:59 pm, edited 1 time in total.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Unable to compile GIT verion with freetype-2.5.4

#10 Post by Geoff the Medio »

asm64 wrote:I don't understand what type of GG:Y?
I don't understand your question... are you asking what GG::Y is? It's a typedef of int.

Code: Select all

/home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:1523:50: error: ambiguous overload for 'operator>' (operand types are 'unsigned int' and 'GG::Y')
                 if (Value(y) + glyph_bitmap.rows > max_y) {
Try wrapping max_y in Value() as well.
In my ftimage.h, FT_Bitmap::rows and FT_Bitmap::width are int, and the comparisons should apparently work fine. Perhaps it's changed in the latest FreeType to unsigned int so that it can't do the comparison / automatic conversion? Dunno, but wrapping in Value() should get back the int value of the GG::Y or GG::X variables so the compiler is happy and the comparison can be done. If that doesn't work, try static_cast<int>(glyph_bitmap.rows)

User avatar
asm64
Space Floater
Posts: 27
Joined: Fri Jan 31, 2014 6:57 am

Re: Unable to compile GIT verion with freetype-2.5.4

#11 Post by asm64 »

Ok, previous error was solved, but we have several another errors. I wrote in C++ but I weak in it.

Code: Select all

/home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:1524:31: error: ambiguous overload for 'operator+' (operand types are 'GG::Y' and 'const unsigned int')
                     max_y = y + glyph_bitmap.rows +1; //Leave a one pixel gap between glyphs
...
/home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:1552:19: error: ambiguous overload for 'operator+=' (operand types are 'GG::X' and 'unsigned int')
                 x += glyph_bitmap.width + 1; //Leave a one pixel gap between glyphs
I think here it is necessary to perform the reverse conversion and I dont know how to do it.. (cuint -> GG:Y)

Code: Select all

/home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:1529:29: error: ambiguous overload for 'operator+' (operand types are 'GG::X' and 'const unsigned int')
                 buffer.at(x + glyph_bitmap.width, y + glyph_bitmap.rows) = 0;
Here I tried replace x to Value(x) but problem in buffer.at. Here we need do something with glyph_bitmap.*

Code: Select all

/home/pvv/GIT/freeorion/FreeOrion/GG/src/Font.cpp:1546:50: error: ambiguous overload for 'operator+' (operand types are 'GG::X' and 'const unsigned int')
                     TempGlyphData(Pt(x, y), Pt(x + glyph_bitmap.width, y + glyph_bitmap.rows),
And here is the same throube. We need glyph_bitmap.* variables conversation.

User avatar
asm64
Space Floater
Posts: 27
Joined: Fri Jan 31, 2014 6:57 am

Re: Unable to compile GIT verion with freetype-2.5.4

#12 Post by asm64 »

Geoff the Medio wrote:are you asking what GG::Y is? It's a typedef of int.
I'm so sorry that my english language is weak. Yes. If I understand correctly, for new freetype we need to convert the 'cons unsigned int' to just 'int' and conversely.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Unable to compile GIT verion with freetype-2.5.4

#13 Post by Geoff the Medio »

asm64 wrote:

Code: Select all

max_y = y + glyph_bitmap.rows +1; //Leave a one pixel gap between glyphs
I think here it is necessary to perform the reverse conversion and I dont know how to do it.. (cuint -> GG:Y)
Change to

Code: Select all

max_y = y + Y(glyph_bitmap.rows + 1);
If it doesn't like that, try

Code: Select all

max_y = y + Y(static_cast<int>(glyph_bitmap.rows) + 1);

Code: Select all

buffer.at(x + glyph_bitmap.width, y + glyph_bitmap.rows) = 0;
Here I tried replace x to Value(x) but problem in buffer.at. Here we need do something with glyph_bitmap.*
Also do Value(y)

Code: Select all

TempGlyphData(Pt(x, y), Pt(x + glyph_bitmap.width, y + glyph_bitmap.rows)
And here is the same throube. We need glyph_bitmap.* variables conversation.
Should be able to do Value(x) and Value(y), but then you'd need to wrap then in GG::X and GG::Y constructors to pass to the Pt constructor...

Code: Select all

TempGlyphData(Pt(x, y), Pt(X(Value(x) + glyph_bitmap.width), Y(Value(y) + glyph_bitmap.rows))

User avatar
asm64
Space Floater
Posts: 27
Joined: Fri Jan 31, 2014 6:57 am

Re: Unable to compile GIT verion with freetype-2.5.4

#14 Post by asm64 »

Geoff the Medio wrote:Change to

Code: Select all

max_y = y + Y(glyph_bitmap.rows + 1);
Yah! This works fine!
Geoff the Medio wrote:

Code: Select all

buffer.at(x + glyph_bitmap.width, y + glyph_bitmap.rows) = 0;
Here I tried replace x to Value(x) but problem in buffer.at. Here we need do something with glyph_bitmap.*
Also do Value(y)
I done just not wrote about it. But did not got result. Here is the same solution, I simple replace to:

Code: Select all

buffer.at(x + X(glyph_bitmap.width), y + Y(glyph_bitmap.rows)) = 0;
And it solved.
Geoff the Medio wrote:Should be able to do Value(x) and Value(y), but then you'd need to wrap then in GG::X and GG::Y constructors to pass to the Pt constructor...

Code: Select all

TempGlyphData(Pt(x, y), Pt(X(Value(x) + glyph_bitmap.width), Y(Value(y) + glyph_bitmap.rows))
Why the excess conversion? I simple has done

Code: Select all

TempGlyphData(Pt(x, y), Pt(x + X(glyph_bitmap.width), y + Y(glyph_bitmap.rows))
We solved. Now all compilled fine.
Thanks.

I attach the patch. But it my first patch and I may done something wrong.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]


User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [SOLVED] Unable to compile GIT verion with freetype-2.5.

#15 Post by Geoff the Medio »

I can't apply that patch using TortoiseSVN, but it's small enough I can copy-paste the updated lines by hand...

Edit: builds OK with the old version of FreeType.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]


Post Reply