Bug 66236

Summary: glext.h:4609: error: redefinition of typedef 'GLclampf'
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: blocker    
Priority: medium CC: brianp
Version: gitKeywords: regression
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Remove duplicated typedefs
Log with build error from glsl_compiler
Build fix

Description Vinson Lee 2013-06-27 05:26:59 UTC
mesa: 9f3cfe6aafc210906be85de065afff7503ef240b (master)

$ make
[...]
  CC       glapi_dispatch.lo
In file included from ../../../include/GL/gl.h:2085,
                 from ../../../src/mapi/glapi/glapi_priv.h:38,
                 from glapi_dispatch.c:40:
../../../include/GL/glext.h:4609: error: redefinition of typedef 'GLclampf'
../../../include/GL/gl.h:161: error: previous declaration of 'GLclampf' was here
../../../include/GL/glext.h:5805: error: redefinition of typedef 'GLclampd'
../../../include/GL/gl.h:163: error: previous declaration of 'GLclampd' was here
Comment 1 Vinson Lee 2013-06-27 05:58:53 UTC
9a14e412d6de93349a490a9c4534b52c3b524ee9 is the first bad commit
commit 9a14e412d6de93349a490a9c4534b52c3b524ee9
Author: Brian Paul <brianp@vmware.com>
Date:   Tue Jun 25 10:35:37 2013 -0600

    mesa: update glext.h to version 20130624
    
    In glapi_priv.h we always need the typedef for the GLclampx type
    since GL_OES_fixed_point is now defined in glext.h but the
    GLclampx type is not.  GLclampx is not used by anything in glext.h
    but we need it for GL ES dispatch.
    
    This is a huge patch because the structure of the file has been
    changed.
    
    The following extensions are new, however:
    
    GL_AMD_interleaved_elements
    GL_AMD_shader_trinary_minmax
    GL_IBM_static_data
    GL_INTEL_map_texture
    GL_NV_compute_program5
    GL_NV_deep_texture3D
    GL_NV_draw_texture
    GL_NV_shader_atomic_counters
    GL_NV_shader_storage_buffer_object
    GL_NVX_conditional_render
    GL_OES_byte_coordinates
    GL_OES_compressed_paletted_texture
    GL_OES_fixed_point
    GL_OES_query_matrix
    GL_OES_single_precision
    
    And these extensions were removed:
    
    GL_FfdMaskSGIX
    GL_INGR_palette_buffer
    GL_INTEL_texture_scissor
    GL_SGI_depth_pass_instrument
    GL_SGIX_fog_scale
    GL_SGIX_impact_pixel_texture
    GL_SGIX_texture_select
    
    Reviewed-by: José Fonseca <jfonseca@vmware.com>

:040000 040000 21827509bbb51f9f51169a637e659e120753c009 ebe3c6da083247c5663c496e587cf8034002f702 M	include
:040000 040000 9eae521b2b281ad6c23419d096afa1190f7604a3 b7658dcb83cfb7923a5621fb04a8bfab6e8e0833 M	src
Comment 2 Brian Paul 2013-06-27 14:22:06 UTC
Hi Vinson, what compiler/version are you using?  I've got gcc 4.7.2

I see that GLclampf and GLclampd are defined in both places, but I'm not seeing the error here.

I'll report the duplicated typedefs to the ARB.
Comment 3 Tom Stellard 2013-06-27 14:36:05 UTC
I'm getting the same error as Vinson.  I have gcc  4.5.3 (Gentoo 4.5.3-r1 p1.0, pie-0.4.5), and I'm using these configure flags:

CFLAGS=-g CC="gcc" CXX="g++" \
./autogen.sh \
--prefix=/usr/local \
--with-dri-drivers="" \
--enable-gallium-llvm \
--enable-r600-llvm-compiler \
--with-gallium-drivers=r300 \
--with-llvm-prefix=/usr/local/llvm/3.3/release
Comment 4 Brian Paul 2013-06-27 15:10:37 UTC
Tom, can you remove the GLclampf/GLclampd typedef lines from your glext.h and verify that clears things up?  If so, let's just do that for now.
Comment 5 Tom Stellard 2013-06-27 15:28:22 UTC
Created attachment 81568 [details] [review]
Remove duplicated typedefs

Here is the patch I'm using to remove the duplicate typedefs form glext.h  This patch does not fix the build as it causes a build error when building the glsl_compiler.

I think you might be able to reproduce this glsl_compiler error with this patch no matter what version of gcc you are using.  I will attach my build log as well.
Comment 6 Tom Stellard 2013-06-27 15:29:02 UTC
Created attachment 81569 [details]
Log with build error from glsl_compiler
Comment 7 Brian Paul 2013-06-27 15:33:04 UTC
You removed the typedef for GLfixed from glext.h

What if you put that back?
Comment 8 Tom Stellard 2013-06-27 15:40:45 UTC
(In reply to comment #7)
> You removed the typedef for GLfixed from glext.h
> 
> What if you put that back?

I had to remove that too because it was also causing redefinition errors:

gmake[4]: Entering directory `/home/steltho/mesa/src/mapi/shared-glapi'
  CC     table.lo
In file included from ../../../include/GL/gl.h:2085:0,
                 from ../../../src/mapi/shared-glapi/glapi_mapi_tmp.h:11,
                 from ../../../src/mapi/mapi_tmp.h:47,
                 from ../../../src/mapi/table.c:55:
../../../include/GL/glext.h:4379:15: error: redefinition of typedef 'GLfixed'
../../../src/mapi/shared-glapi/glapi_mapi_tmp.h:5:13: note: previous declaration of 'GLfixed' was here
Comment 9 Brian Paul 2013-06-27 15:54:25 UTC
OK, let's try removing line 731 from src/map/mapi_abi.py

<sigh> the Mesa dispatch code is such an incredibly convoluted mess </sigh>
Comment 10 Vinson Lee 2013-06-27 17:54:47 UTC
(In reply to comment #2)
> Hi Vinson, what compiler/version are you using?  I've got gcc 4.7.2
> 
> I see that GLclampf and GLclampd are defined in both places, but I'm not
> seeing the error here.
> 
> I'll report the duplicated typedefs to the ARB.

$ gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I do not see the error with GCC 4.6 and newer.
Comment 11 Tom Stellard 2013-06-27 18:06:37 UTC
Created attachment 81574 [details] [review]
Build fix

I had to remove GLfixed typedefs from a few other places, but Mesa now builds for me with this patch.
Comment 12 Brian Paul 2013-06-27 23:15:09 UTC
Your patch works for me and looks good, Tom.  But the comment in glheader.h about GL_FIXED should be updated/removed too.

Feel free to commit/push.

Reviewed-by: Brian Paul <brianp@vmware.com>

Thanks.
Comment 13 Brian Paul 2013-07-01 14:46:29 UTC
Fixed by Tom in commit bee49cb0ecbacb9fbc9dddc5e560874adacc518e

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.