Closed Bug 310338 Opened 19 years ago Closed 19 years ago

Fails to build on alpha due to improperly defined NS_FT2_OFFSET in nsFreeType.cpp

Categories

(Core Graveyard :: GFX, defect)

Other
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 247629

People

(Reporter: micah, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050802 Galeon/1.3.21 (Debian package 1.3.21-6)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050802 Galeon/1.3.21 (Debian package 1.3.21-6)

Thunderbird fails to build on alpha due to invalid code defining NS_FT2_OFFSET
in nsFreeType.cpp. 

The following patch fixes this:

diff -ur mozilla/gfs/src/freetype/nsFreeType.cpp.orig
mozilla/gfs/src/freetype/nsFreeType.cpp
--- mozilla/gfx/src/freetype/nsFreeType.cpp.orig        2005-09-28
13:22:12.248804162 -0400
+++ mozilla/gfx/src/freetype/nsFreeType.cpp     2005-09-28 13:22:25.270424091 -0400
@@ -96,7 +96,7 @@
 // Define the FreeType2 functions we resolve at run time.
 // see the comment near nsFreeType2::DoneFace() for more info
 //
-#define NS_FT2_OFFSET(f) (int)&((nsFreeType2*)0)->f
+#define NS_FT2_OFFSET(f) __builtin_offsetof (nsFreeType2, f)
 FtFuncList nsFreeType2::FtFuncs [] = {
   {"FT_Done_Face",            NS_FT2_OFFSET(nsFT_Done_Face),            PR_TRUE},
   {"FT_Done_FreeType",        NS_FT2_OFFSET(nsFT_Done_FreeType),        PR_TRUE},


Reproducible: Always

Steps to Reproduce:
1. Try to build thunderbird on alpha
2. Wait
3. Recoil in horror at errors

Actual Results:  
make[5]: Entering directory
`/build/buildd/mozilla-thunderbird-1.0.6/build-dir/mozilla/gfx/src/freetype'
nsFreeType.cpp
c++ -o nsFreeType.o -c -DOSTYPE=\"Linux2.4\" -DOSARCH=\"Linux\" -I../..
-I../../../dist/include/xpcom -I../../../dist/include/string
-I../../../dist/include/pref -I../../../dist/include/uconv
-I../../../dist/include/unicharutil -I../../../dist/include/gfx
-I../../../dist/include
-I/build/buildd/mozilla-thunderbird-1.0.6/build-dir/mozilla/dist/include/nspr  
 -I/usr/include -I/usr/include/freetype2    -fPIC   -fno-rtti -fno-exceptions
-Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth
-Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -mieee
-fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -O2   -DMOZILLA_CLIENT -include
../../../mozilla-config.h -Wp,-MD,.deps/nsFreeType.pp nsFreeType.cpp
nsFreeType.cpp:101: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Done_Face' of NULL object
nsFreeType.cpp:101: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:101: error: cast from 'FT_Error (**)(FT_FaceRec_*)' to 'int'
loses precision
nsFreeType.cpp:102: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Done_FreeType' of NULL object
nsFreeType.cpp:102: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:102: error: cast from 'FT_Error (**)(FT_LibraryRec_*)' to 'int'
loses precision
nsFreeType.cpp:103: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Done_Glyph' of NULL object
nsFreeType.cpp:103: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:103: error: cast from 'FT_Error (**)(FT_GlyphRec_*)' to 'int'
loses precision
nsFreeType.cpp:104: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Get_Char_Index' of NULL object
nsFreeType.cpp:104: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:104: error: cast from 'FT_Error (**)(FT_FaceRec_*, FT_ULong)' to
'int' loses precision
nsFreeType.cpp:105: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Get_Glyph' of NULL object
nsFreeType.cpp:105: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:105: error: cast from 'FT_Error (**)(FT_GlyphSlotRec_*,
FT_GlyphRec_**)' to 'int' loses precision
nsFreeType.cpp:106: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Get_Sfnt_Table' of NULL object
nsFreeType.cpp:106: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:106: error: cast from 'void* (**)(FT_FaceRec_*, FT_Sfnt_Tag)' to
'int' loses precision
nsFreeType.cpp:107: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Glyph_Get_CBox' of NULL object
nsFreeType.cpp:107: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:107: error: cast from 'FT_Error (**)(FT_GlyphRec_*, FT_UInt,
FT_BBox*)' to 'int' loses precision
nsFreeType.cpp:108: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Init_FreeType' of NULL object
nsFreeType.cpp:108: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:108: error: cast from 'FT_Error (**)(FT_LibraryRec_**)' to 'int'
loses precision
nsFreeType.cpp:109: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Load_Glyph' of NULL object
nsFreeType.cpp:109: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:109: error: cast from 'FT_Error (**)(FT_FaceRec_*, FT_UInt,
FT_Int)' to 'int' loses precision
nsFreeType.cpp:110: warning: invalid access to non-static data member
'nsFreeType2::nsFT_New_Face' of NULL object
nsFreeType.cpp:110: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:110: error: cast from 'FT_Error (**)(FT_LibraryRec_*, const
char*, FT_Long, FT_FaceRec_**)' to 'int' loses precision
nsFreeType.cpp:111: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Outline_Decompose' of NULL object
nsFreeType.cpp:111: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:111: error: cast from 'FT_Error (**)(FT_Outline*, const
FT_Outline_Funcs*, void*)' to 'int' loses precision
nsFreeType.cpp:112: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Set_Charmap' of NULL object
nsFreeType.cpp:112: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:112: error: cast from 'FT_Error (**)(FT_FaceRec_*,
FT_CharMapRec_*)' to 'int' loses precision
nsFreeType.cpp:113: warning: invalid access to non-static data member
'nsFreeType2::nsFTC_Image_Cache_Lookup' of NULL object
nsFreeType.cpp:113: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:113: error: cast from 'FT_Error (**)(FTC_ImageCacheRec_*,
FTC_Image_Desc*, FT_UInt, FT_GlyphRec_**)' to 'int' loses precision
nsFreeType.cpp:114: warning: invalid access to non-static data member
'nsFreeType2::nsFTC_Manager_Lookup_Size' of NULL object
nsFreeType.cpp:114: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:114: error: cast from 'FT_Error (**)(FTC_ManagerRec_*,
FTC_FontRec*, FT_FaceRec_**, FT_SizeRec_**)' to 'int' loses precision
nsFreeType.cpp:115: warning: invalid access to non-static data member
'nsFreeType2::nsFTC_Manager_Done' of NULL object
nsFreeType.cpp:115: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:115: error: cast from 'FT_Error (**)(FTC_ManagerRec_*)' to 'int'
loses precision
nsFreeType.cpp:116: warning: invalid access to non-static data member
'nsFreeType2::nsFTC_Manager_New' of NULL object
nsFreeType.cpp:116: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:116: error: cast from 'FT_Error (**)(FT_LibraryRec_*, FT_UInt,
FT_UInt, FT_ULong, FT_Error (*)(void*, FT_LibraryRec_*, void*, FT_FaceRec_**),
void*, FTC_ManagerRec_**)' to 'int' loses precision
nsFreeType.cpp:117: warning: invalid access to non-static data member
'nsFreeType2::nsFTC_Image_Cache_New' of NULL object
nsFreeType.cpp:117: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:117: error: cast from 'FT_Error (**)(FTC_ManagerRec_*,
FTC_ImageCacheRec_**)' to 'int' loses precision
nsFreeType.cpp:119: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Glyph_Transform' of NULL object
nsFreeType.cpp:119: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:119: error: cast from 'FT_Error (**)(FT_GlyphRec_*, FT_Matrix*,
FT_Vector*)' to 'int' loses precision
nsFreeType.cpp:120: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Get_Kerning' of NULL object
nsFreeType.cpp:120: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:120: error: cast from 'FT_Error (**)(FT_FaceRec_*, FT_UInt,
FT_UInt, FT_UInt, FT_Vector*)' to 'int' loses precision
nsFreeType.cpp:121: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Glyph_Copy' of NULL object
nsFreeType.cpp:121: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:121: error: cast from 'FT_Error (**)(FT_GlyphRec_*,
FT_GlyphRec_**)' to 'int' loses precision
nsFreeType.cpp:122: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Glyph_To_Bitmap' of NULL object
nsFreeType.cpp:122: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:122: error: cast from 'FT_Error (**)(FT_GlyphRec_**,
FT_Render_Mode, FT_Vector*, FT_Bool)' to 'int' loses precision
nsFreeType.cpp:124: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Get_First_Char' of NULL object
nsFreeType.cpp:124: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:124: error: cast from 'FT_ULong (**)(FT_FaceRec_*, FT_UInt*)' to
'int' loses precision
nsFreeType.cpp:125: warning: invalid access to non-static data member
'nsFreeType2::nsFT_Get_Next_Char' of NULL object
nsFreeType.cpp:125: warning: (perhaps the 'offsetof' macro was used incorrectly)
nsFreeType.cpp:125: error: cast from 'FT_ULong (**)(FT_FaceRec_*, FT_ULong,
FT_UInt*)' to 'int' loses precision
nsFreeType.cpp: In member function 'void nsFreeType2::ClearFunctions()':
nsFreeType.cpp:418: warning: cast from 'char*' to 'void (**)()' increases
required alignment of target type
nsFreeType.cpp: In member function 'PRBool nsFreeType2::LoadSharedLib()':
nsFreeType.cpp:712: warning: cast from 'char*' to 'void (**)()' increases
required alignment of target type
make[5]: *** [nsFreeType.o] Error 1

Expected Results:  
Should compile properly

A complete build log is available here:

http://experimental.debian.net/fetch.php?&pkg=mozilla-thunderbird&ver=1.0.6-3etch2&arch=alpha&stamp=1127923737&file=log&as=raw
Assignee: mscott → general
Status: UNCONFIRMED → NEW
Component: Build Config → GFX
Ever confirmed: true
Product: Thunderbird → Core
QA Contact: chase → ian
Version: unspecified → Trunk
Fixed in bug 247629 (not perfectly, but well enough, and the code is going away soon anyway).

*** This bug has been marked as a duplicate of 247629 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.