Closed Bug 594418 Opened 14 years ago Closed 13 years ago

[Meego] GLDefs.h GLsizeiptr, GLintptr gl types definition conflicts with khronos gl types

Categories

(Core :: Graphics, defect)

Other
MeeGo
defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: lokesh.kumar.goel, Assigned: romaxa)

Details

Attachments

(4 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8
Build Identifier: mozilla-central 75d2145d1bd3 + mobile-browser 078449f88da5

Build fails on Meego armel platform.

Reproducible: Always

Steps to Reproduce:
I am trying to build mozilla-central 75d2145d1bd3 + mobile-browser 078449f88da5 over Meego(rpmbuild) platform for armel architecture. Build fails with the following error : 

c++ -o GLContextProviderEGL.o -c   -fvisibility=hidden -DIMPL_THEBES -DWOFF_MOZILLA_CLIENT  -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API  -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET  -DIMPL_THEBES -DSTATIC_EXPORTABLE_JS_API -DOSTYPE=\"Linux2.6.31.12-0\"  -DOSARCH=Linux -DEXCLUDE_SKIA_DEPENDENCIES -DCHROMIUM_MOZILLA_BUILD  -DOS_LINUX=1 -DOS_POSIX=1  -I/home/abuild/rpmbuild/BUILD/mozilla-central/ipc/chromium/src  -I/home/abuild/rpmbuild/BUILD/mozilla-central/ipc/glue  -I../../ipc/ipdl/_ipdlheaders   -I/home/abuild/rpmbuild/BUILD/mozilla-central/gfx/thebes -I.  -I../../dist/include -I../../dist/include/nsprpub   -I/home/abuild/rpmbuild/BUILD/release/dist/include/nspr  -I/home/abuild/rpmbuild/BUILD/release/dist/include/nss       -fPIC  -fno-exceptions -frtti -fexceptions -Wall -Wpointer-arith  -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy  -Wno-non-virtual-dtor -Wno-invalid-offsetof -Wno-variadic-macros  -Werror=return-type -Wno-long-long -O2 -g -pipe -Wall  -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -fno-omit-frame-pointer  --param=ssp-buffer-size=4 -fmessage-length=0 -march=armv7-a  -mtune=cortex-a8 -mlittle-endian -mfpu=vfpv3 -mfloat-abi=softfp  -D__SOFTFP__ -fno-strict-aliasing -fshort-wchar -pthread -pipe -DNDEBUG  -DTRIMMED -Os -freorder-blocks -fomit-frame-pointer -finline-limit=50  -I/home/abuild/rpmbuild/BUILD/release/dist/include/cairo -DQT_SHARED  -I/usr/include/meegotouch -I/usr/include/qt4 -I/usr/include/qt4/QtGui  -I/usr/include/qt4/QtCore   -DQT_SHARED -I/usr/include/qt4  -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore  -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtOpenGL    -I/usr/include/freetype2 -pthread -I/usr/include/pango-1.0  -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -I/usr/include/freetype2    -fno-exceptions -DMOZILLA_CLIENT -include  ../../mozilla-config.h -MD -MF .deps/GLContextProviderEGL.pp  /home/abuild/rpmbuild/BUILD/mozilla-central/gfx/thebes/GLContextProviderEGL.cpp
In file included from /home/abuild/rpmbuild/BUILD/mozilla-central/gfx/thebes/GLContext.h:50:0,
                 from /home/abuild/rpmbuild/BUILD/mozilla-central/gfx/thebes/GLContextProvider.h:40,
                 from /home/abuild/rpmbuild/BUILD/mozilla-central/gfx/thebes/GLContextProviderEGL.cpp:143:
/home/abuild/rpmbuild/BUILD/mozilla-central/gfx/thebes/GLDefs.h:68:19:  error: conflicting declaration 'typedef ptrdiff_t GLsizeiptr'
//usr/include/GLES2/gl2.h:39:26: error: 'GLsizeiptr' has a previous declaration as 'typedef khronos_ssize_t GLsizeiptr'
/home/abuild/rpmbuild/BUILD/mozilla-central/gfx/thebes/GLDefs.h:70:19:  error: conflicting declaration 'typedef ptrdiff_t GLintptr'
//usr/include/GLES2/gl2.h:38:26: error: 'GLintptr' has a previous declaration as 'typedef khronos_intptr_t GLintptr'
make[5]: *** [GLContextProviderEGL.o] Error 1
make[5]: Leaving directory `/home/abuild/rpmbuild/BUILD/release/gfx/thebes'
make[4]: *** [libs] Error 2
make[4]: Leaving directory `/home/abuild/rpmbuild/BUILD/release/gfx'
make[3]: *** [libs_tier_platform] Error 2
make[3]: Leaving directory `/home/abuild/rpmbuild/BUILD/release'
make[2]: *** [tier_platform] Error 2
make[2]: Leaving directory `/home/abuild/rpmbuild/BUILD/release'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/home/abuild/rpmbuild/BUILD/release'
make: *** [build] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.xWaD7g (%build)


All gl and gles related version libraries and dev packages in the build: libqtopengl4-4.7.0~rc1-3.1
mesa-dri-i965-driver-7.8.99.1~gitb018ea19a3-3.2
mesa-libGLESv2-7.8.99.1~gitb018ea19a3-3.2
mesa-libEGL-7.8.99.1~gitb018ea19a3-3.2
mesa-libEGL-devel-7.8.99.1~gitb018ea19a3-3.2
mesa-libGLESv2-compat-7.8.99.1~gitb018ea19a3-3.2
mesa-libGLESv2-devel-7.8.99.1~gitb018ea19a3-3.2

Also find the full build log attached, which has details of the other package versions and build options.

Also find the mozconfig file attached.

I tried this but didn't work, still fails:
diff --git a/gfx/thebes/GLDefs.h b/gfx/thebes/GLDefs.h
--- a/gfx/thebes/GLDefs.h
+++ b/gfx/thebes/GLDefs.h
@@ -59,18 +59,22 @@ typedef float GLfloat;
 typedef float GLclampf;
 #ifndef GLdouble_defined
 typedef double GLdouble;
 #endif
 typedef double GLclampd;
 typedef void GLvoid;

 typedef char GLchar;
+#ifndef GLsizeiptr_defined
 typedef ptrdiff_t GLsizeiptr;
+#endif
+#ifndef GLintptr_defined
 typedef ptrdiff_t GLintptr;
+#endif

 #ifndef GLAPIENTRY
 # ifdef WIN32
 #  define GLAPIENTRY APIENTRY
 #  define GLAPI
 # else
 #  define GLAPIENTRY
 #  define GLAPI
OS: Linux → MeeGo
Version: unspecified → Trunk
Attached file Build Log
Attaching build log.
Attached file Mozconfig file
Attaching mozconfig file.Other changes added to this file can be seen in my next attachment. fennec-qt.spec
Component: Build Config → Graphics
QA Contact: build-config → thebes
Attachment #473091 - Attachment mime type: application/octet-stream → text/plain
this stuff compiling on N900, HArmattan, ... and I guess something wrong with meego headers...

could you try to compare harmattan and meego EGL headers? and find the difference?
By applying the following two patches, arm build succeeds in Meego:
1) 
diff --git a/gfx/thebes/GLDefs.h b/gfx/thebes/GLDefs.h
--- a/gfx/thebes/GLDefs.h
+++ b/gfx/thebes/GLDefs.h
@@ -59,18 +59,20 @@ typedef float GLfloat;
 typedef float GLclampf;
 #ifndef GLdouble_defined
 typedef double GLdouble;
 #endif
 typedef double GLclampd;
 typedef void GLvoid;

 typedef char GLchar;
+#ifndef GLdouble_defined
 typedef ptrdiff_t GLsizeiptr;
 typedef ptrdiff_t GLintptr;
+#endif

 #ifndef GLAPIENTRY
 # ifdef WIN32
 #  define GLAPIENTRY APIENTRY
 #  define GLAPI
 # else
 #  define GLAPIENTRY
 #  define GLAPI

2) 
--- a/layout/generic/nsFrame.h.orig     2010-06-22 17:13:17.000000000 +0300
+++ b/layout/generic/nsFrame.h  2010-06-22 17:13:33.000000000 +0300
@@ -151,7 +151,7 @@
   // Left undefined; nsFrame objects are never allocated from the heap.
   void* operator new(size_t sz) CPP_THROW_NEW;

-protected:
+public:
   // Overridden to prevent the global delete from being called, since
   // the memory came out of an arena instead of the heap.
   //

But if we don't apply the (2) patch, then the build fails with the error :
"
config.h -MD -MF .deps/nsBlockFrame.pp /home/abuild/rpmbuild/BUILD/mozilla-central/layout/generic/nsBlockFrame.cpp
/home/abuild/rpmbuild/BUILD/mozilla-central/layout/generic/nsBlockFrame.cpp:  In member function 'nsresult  nsBlockFrame::SplitFloat(nsBlockReflowState&, nsIFrame*,  nsReflowStatus)':
/home/abuild/rpmbuild/BUILD/mozilla-central/layout/generic/nsBlockFrame.cpp:3919:14: warning: unused variable 'rv'
/home/abuild/rpmbuild/BUILD/mozilla-central/layout/generic/nsFrame.h: In  member function 'virtual nsresult  nsBlockFrame::SetInitialChildList(nsIAtom*, nsFrameList&)':
/home/abuild/rpmbuild/BUILD/mozilla-central/layout/generic/nsFrame.h:165:8:  error: 'static void nsFrame::operator delete(void*, size_t)' is  protected
/home/abuild/rpmbuild/BUILD/mozilla-central/layout/generic/nsBlockFrame.cpp:6431:62: error: within this context
make[5]: *** [nsBlockFrame.o] Error 1
make[5]: Leaving directory `/home/abuild/rpmbuild/BUILD/release/layout/generic'
make[4]: *** [generic_libs] Error 2
make[4]: Leaving directory `/home/abuild/rpmbuild/BUILD/release/layout'
make[3]: *** [libs_tier_platform] Error 2
make[3]: Leaving directory `/home/abuild/rpmbuild/BUILD/release'
make[2]: *** [tier_platform] Error 2
make[2]: Leaving directory `/home/abuild/rpmbuild/BUILD/release'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/home/abuild/rpmbuild/BUILD/release'
make: *** [build] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.dgKeGv (%build)
"
The first patch looks fine, but I can't comment on the second... what compiler version are we talking about here?
(In reply to comment #6)
> The first patch looks fine, but I can't comment on the second... what compiler
> version are we talking about here?

gcc-c++-4.5.0-4.8

More details on the compiler and versions of other libraries, please see the attached build log.
(In reply to comment #4)
> this stuff compiling on N900, HArmattan, ... and I guess something wrong with
> meego headers...
> 
> could you try to compare harmattan and meego EGL headers? and find the
> difference?

Harmattan EGL headers:(opengles-sgx-img-common-dev)
gl.h:typedef int GLsizeiptr;

Meego EGL headers:(mesa-libEGL-devel)
gl.h:typedef khronos_ssize_t  GLsizeiptr;;
Attached patch Patch that fixes the problem (obsolete) — Splinter Review
Please review this. If this is not proper, please fix this ASAP, as it is a blocker for fennec deliveries on Meego platform.
Attachment #476818 - Flags: review?(vladimir)
(In reply to comment #6)
> The first patch looks fine, but I can't comment on the second... what compiler
> version are we talking about here?

If (2) is bad, doesn't that mean that (1) is not correct ?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Mozilla Central fails to build over Meego Platform(rpmbuild) for armel architecture → GLDefs.h GLsizeiptr, GLintptr gl types definition conflicts with khronos gl types
http://www.khronos.org/registry/gles/api/2.0/gl2.h, defines 
/* GL types for handling large vertex buffer objects */
typedef khronos_intptr_t GLintptr;
typedef khronos_ssize_t  GLsizeiptr;
Assignee: nobody → romaxa
Attachment #476818 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #537460 - Flags: review?(bjacob)
Attachment #476818 - Flags: review?(vladimir)
Summary: GLDefs.h GLsizeiptr, GLintptr gl types definition conflicts with khronos gl types → [Meego] GLDefs.h GLsizeiptr, GLintptr gl types definition conflicts with khronos gl types
Comment on attachment 537460 [details] [diff] [review]
don't typedef GLsizeintptr GLintptr if gl2.h included

OK to push this change, but I'm not sure how safe the #ifndef __gl2_h_ check is (what if some platform uses a different include guard for that).

I think the much safer solution would be to use different names for the GL typedefs, e.g. local_GLintptr, just like we do for the constants (e.g. LOCAL_GL_TEXTURE).
Attachment #537460 - Flags: review?(bjacob) → review+
...or, why not put all that in namespace mozilla::gl.
(In reply to comment #13)
> ...or, why not put all that in namespace mozilla::gl.

Then we need to change bunch of other things..., I would like to do it in separate bug.
Ok, current version seems to build and works fine, Maemo/Android also good
http://tbpl.mozilla.org/?tree=Try&rev=7d6ca01aab56
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/d076126a9325
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
I am still facing this issue 
http://pastebin.com/NfTejaMt
I cloned mozilla latest and building for mer platform for Qt .
Maybe we need to namespace our types in namespace mozilla?
@Beniot: Requesting for a temporary work around as of now.
Take patch from bug 779726, it practically isolates qgl includes out of GLDefs.h scope
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: