Last Comment Bug 594418 - [Meego] GLDefs.h GLsizeiptr, GLintptr gl types definition conflicts with khronos gl types
: [Meego] GLDefs.h GLsizeiptr, GLintptr gl types definition conflicts with khro...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: Trunk
: Other MeeGo
: -- major (vote)
: ---
Assigned To: Oleg Romashin (:romaxa)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-08 09:21 PDT by Lokesh Goel
Modified: 2012-08-08 07:55 PDT (History)
9 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Build Log (267.08 KB, application/vnd.oasis.opendocument.text)
2010-09-08 09:26 PDT, Lokesh Goel
no flags Details
Mozconfig file (2.45 KB, text/plain)
2010-09-08 09:31 PDT, Lokesh Goel
no flags Details
Spec file used to build the rpm (4.19 KB, text/x-rpm-spec)
2010-09-08 09:31 PDT, Lokesh Goel
no flags Details
Patch that fixes the problem (1.42 KB, patch)
2010-09-20 08:49 PDT, Lokesh Goel
no flags Details | Diff | Review
don't typedef GLsizeintptr GLintptr if gl2.h included (741 bytes, patch)
2011-06-05 10:03 PDT, Oleg Romashin (:romaxa)
jacob.benoit.1: review+
Details | Diff | Review

Description Lokesh Goel 2010-09-08 09:21:36 PDT
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
Comment 1 Lokesh Goel 2010-09-08 09:26:31 PDT
Created attachment 473085 [details]
Build Log

Attaching build log.
Comment 2 Lokesh Goel 2010-09-08 09:31:30 PDT
Created attachment 473091 [details]
Mozconfig file

Attaching mozconfig file.Other changes added to this file can be seen in my next attachment. fennec-qt.spec
Comment 3 Lokesh Goel 2010-09-08 09:31:56 PDT
Created attachment 473092 [details]
Spec file used to build the rpm
Comment 4 Oleg Romashin (:romaxa) 2010-09-17 00:42:36 PDT
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?
Comment 5 Lokesh Goel 2010-09-17 01:59:37 PDT
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)
"
Comment 6 Vladimir Vukicevic [:vlad] [:vladv] 2010-09-17 12:27:34 PDT
The first patch looks fine, but I can't comment on the second... what compiler version are we talking about here?
Comment 7 Lokesh Goel 2010-09-17 13:17:10 PDT
(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.
Comment 8 Lokesh Goel 2010-09-17 14:07:38 PDT
(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;;
Comment 9 Lokesh Goel 2010-09-20 08:49:14 PDT
Created attachment 476818 [details] [diff] [review]
Patch that fixes the problem

Please review this. If this is not proper, please fix this ASAP, as it is a blocker for fennec deliveries on Meego platform.
Comment 10 Lokesh Goel 2010-09-20 08:50:08 PDT
(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 ?
Comment 11 Oleg Romashin (:romaxa) 2011-06-05 10:03:16 PDT
Created attachment 537460 [details] [diff] [review]
don't typedef GLsizeintptr GLintptr if gl2.h included

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;
Comment 12 Benoit Jacob [:bjacob] (mostly away) 2011-06-05 15:44:24 PDT
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).
Comment 13 Benoit Jacob [:bjacob] (mostly away) 2011-06-05 15:45:12 PDT
...or, why not put all that in namespace mozilla::gl.
Comment 14 Oleg Romashin (:romaxa) 2011-06-05 20:50:35 PDT
(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.
Comment 15 Oleg Romashin (:romaxa) 2011-06-06 14:08:32 PDT
Ok, current version seems to build and works fine, Maemo/Android also good
http://tbpl.mozilla.org/?tree=Try&rev=7d6ca01aab56
Comment 16 Oleg Romashin (:romaxa) 2011-06-07 11:57:12 PDT
http://hg.mozilla.org/mozilla-central/rev/d076126a9325
Comment 17 Rakesh Sadhu 2012-08-08 01:46:17 PDT
I am still facing this issue 
http://pastebin.com/NfTejaMt
Comment 18 Rakesh Sadhu 2012-08-08 01:47:17 PDT
I cloned mozilla latest and building for mer platform for Qt .
Comment 19 Benoit Jacob [:bjacob] (mostly away) 2012-08-08 03:59:50 PDT
Maybe we need to namespace our types in namespace mozilla?
Comment 20 Rakesh Sadhu 2012-08-08 04:12:39 PDT
@Beniot: Requesting for a temporary work around as of now.
Comment 21 Oleg Romashin (:romaxa) 2012-08-08 07:55:18 PDT
Take patch from bug 779726, it practically isolates qgl includes out of GLDefs.h scope

Note You need to log in before you can comment on or make changes to this bug.