Bug 7175

Summary: compile fails in glu/libutil/mipmap.c on Mac OS X 10.4
Product: Mesa Reporter: Benjamin Reed <ranger>
Component: GLUAssignee: mesa-dev
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: high    
Version: 6.5   
Hardware: PowerPC   
OS: Mac OS X (All)   
Whiteboard:
i915 platform: i915 features:

Description Benjamin Reed 2006-06-10 07:57:14 UTC
mipmap.c in Mesa 6.5 fails with the following error:

Disco-Volante:/tmp/Mesa-6.5-new/src/glu ranger$ make -j1
c++ -c -I../../../include -Iinclude -Iinternals -Ilibnurbs/internals
-Ilibnurbs/interface -Ilibnurbs/nurbtess -I/sw/X11/include -O3 -fPIC -fno-common
-ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic
-Ddarwin -DNDEBUG -DLIBRARYBUILD libutil/mipmap.c -o libutil/mipmap.o
libutil/mipmap.c: In function 'GLint gluScaleImage(GLenum, GLsizei, GLsizei,
GLenum, const void*, GLsizei, GLsizei, GLenum, void*)':
libutil/mipmap.c:3504: error: invalid conversion from 'void*' to 'GLushort*'
libutil/mipmap.c:3506: error: invalid conversion from 'void*' to 'GLushort*'
libutil/mipmap.c: In function 'int gluScaleImage3D(GLenum, GLint, GLint, GLint,
GLenum, const void*, GLint, GLint, GLint, GLenum, void*)':
libutil/mipmap.c:7358: error: invalid conversion from 'void*' to 'GLushort*'
libutil/mipmap.c:7360: error: invalid conversion from 'void*' to 'GLushort*'
libutil/mipmap.c: In function 'int gluBuild3DMipmapLevelsCore(GLenum, GLint,
GLsizei, GLsizei, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLint,
GLint, GLint, const void*)':
libutil/mipmap.c:7867: error: invalid conversion from 'const void*' to 'const
GLubyte*'
libutil/mipmap.c:7867: error:   initializing argument 4 of 'void
halveImage_ubyte(GLint, GLuint, GLuint, const GLubyte*, GLubyte*, GLint, GLint,
GLint)'
libutil/mipmap.c:7867: error: invalid conversion from 'void*' to 'GLubyte*'
libutil/mipmap.c:7867: error:   initializing argument 5 of 'void
halveImage_ubyte(GLint, GLuint, GLuint, const GLubyte*, GLubyte*, GLint, GLint,
GLint)'
libutil/mipmap.c:7879: error: invalid conversion from 'const void*' to 'const
GLbyte*'
libutil/mipmap.c:7879: error:   initializing argument 4 of 'void
halveImage_byte(GLint, GLuint, GLuint, const GLbyte*, GLbyte*, GLint, GLint, GLint)'
libutil/mipmap.c:7879: error: invalid conversion from 'void*' to 'GLbyte*'
libutil/mipmap.c:7879: error:   initializing argument 5 of 'void
halveImage_byte(GLint, GLuint, GLuint, const GLbyte*, GLbyte*, GLint, GLint, GLint)'
libutil/mipmap.c:7891: error: invalid conversion from 'const void*' to 'const
GLushort*'
libutil/mipmap.c:7891: error:   initializing argument 4 of 'void
halveImage_ushort(GLint, GLuint, GLuint, const GLushort*, GLushort*, GLint,
GLint, GLint, GLint)'
libutil/mipmap.c:7891: error: invalid conversion from 'void*' to 'GLushort*'
libutil/mipmap.c:7891: error:   initializing argument 5 of 'void
halveImage_ushort(GLint, GLuint, GLuint, const GLushort*, GLushort*, GLint,
GLint, GLint, GLint)'
libutil/mipmap.c:7903: error: invalid conversion from 'const void*' to 'const
GLshort*'
libutil/mipmap.c:7903: error:   initializing argument 4 of 'void
halveImage_short(GLint, GLuint, GLuint, const GLshort*, GLshort*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:7903: error: invalid conversion from 'void*' to 'GLshort*'
libutil/mipmap.c:7903: error:   initializing argument 5 of 'void
halveImage_short(GLint, GLuint, GLuint, const GLshort*, GLshort*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:7915: error: invalid conversion from 'const void*' to 'const
GLuint*'
libutil/mipmap.c:7915: error:   initializing argument 4 of 'void
halveImage_uint(GLint, GLuint, GLuint, const GLuint*, GLuint*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:7915: error: invalid conversion from 'void*' to 'GLuint*'
libutil/mipmap.c:7915: error:   initializing argument 5 of 'void
halveImage_uint(GLint, GLuint, GLuint, const GLuint*, GLuint*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:7927: error: invalid conversion from 'const void*' to 'const
GLint*'
libutil/mipmap.c:7927: error:   initializing argument 4 of 'void
halveImage_int(GLint, GLuint, GLuint, const GLint*, GLint*, GLint, GLint, GLint,
GLint)'
libutil/mipmap.c:7927: error: invalid conversion from 'void*' to 'GLint*'
libutil/mipmap.c:7927: error:   initializing argument 5 of 'void
halveImage_int(GLint, GLuint, GLuint, const GLint*, GLint*, GLint, GLint, GLint,
GLint)'
libutil/mipmap.c:7939: error: invalid conversion from 'const void*' to 'const
GLfloat*'
libutil/mipmap.c:7939: error:   initializing argument 4 of 'void
halveImage_float(GLint, GLuint, GLuint, const GLfloat*, GLfloat*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:7939: error: invalid conversion from 'void*' to 'GLfloat*'
libutil/mipmap.c:7939: error:   initializing argument 5 of 'void
halveImage_float(GLint, GLuint, GLuint, const GLfloat*, GLfloat*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:8231: error: invalid conversion from 'void*' to 'const GLubyte*'
libutil/mipmap.c:8231: error:   initializing argument 4 of 'void
halveImage_ubyte(GLint, GLuint, GLuint, const GLubyte*, GLubyte*, GLint, GLint,
GLint)'
libutil/mipmap.c:8231: error: invalid conversion from 'void*' to 'GLubyte*'
libutil/mipmap.c:8231: error:   initializing argument 5 of 'void
halveImage_ubyte(GLint, GLuint, GLuint, const GLubyte*, GLubyte*, GLint, GLint,
GLint)'
libutil/mipmap.c:8243: error: invalid conversion from 'void*' to 'const GLbyte*'
libutil/mipmap.c:8243: error:   initializing argument 4 of 'void
halveImage_byte(GLint, GLuint, GLuint, const GLbyte*, GLbyte*, GLint, GLint, GLint)'
libutil/mipmap.c:8243: error: invalid conversion from 'void*' to 'GLbyte*'
libutil/mipmap.c:8243: error:   initializing argument 5 of 'void
halveImage_byte(GLint, GLuint, GLuint, const GLbyte*, GLbyte*, GLint, GLint, GLint)'
libutil/mipmap.c:8255: error: invalid conversion from 'void*' to 'const GLushort*'
libutil/mipmap.c:8255: error:   initializing argument 4 of 'void
halveImage_ushort(GLint, GLuint, GLuint, const GLushort*, GLushort*, GLint,
GLint, GLint, GLint)'
libutil/mipmap.c:8255: error: invalid conversion from 'void*' to 'GLushort*'
libutil/mipmap.c:8255: error:   initializing argument 5 of 'void
halveImage_ushort(GLint, GLuint, GLuint, const GLushort*, GLushort*, GLint,
GLint, GLint, GLint)'
libutil/mipmap.c:8267: error: invalid conversion from 'void*' to 'const GLshort*'
libutil/mipmap.c:8267: error:   initializing argument 4 of 'void
halveImage_short(GLint, GLuint, GLuint, const GLshort*, GLshort*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:8267: error: invalid conversion from 'void*' to 'GLshort*'
libutil/mipmap.c:8267: error:   initializing argument 5 of 'void
halveImage_short(GLint, GLuint, GLuint, const GLshort*, GLshort*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:8279: error: invalid conversion from 'void*' to 'const GLuint*'
libutil/mipmap.c:8279: error:   initializing argument 4 of 'void
halveImage_uint(GLint, GLuint, GLuint, const GLuint*, GLuint*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:8279: error: invalid conversion from 'void*' to 'GLuint*'
libutil/mipmap.c:8279: error:   initializing argument 5 of 'void
halveImage_uint(GLint, GLuint, GLuint, const GLuint*, GLuint*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:8291: error: invalid conversion from 'void*' to 'const GLint*'
libutil/mipmap.c:8291: error:   initializing argument 4 of 'void
halveImage_int(GLint, GLuint, GLuint, const GLint*, GLint*, GLint, GLint, GLint,
GLint)'
libutil/mipmap.c:8291: error: invalid conversion from 'void*' to 'GLint*'
libutil/mipmap.c:8291: error:   initializing argument 5 of 'void
halveImage_int(GLint, GLuint, GLuint, const GLint*, GLint*, GLint, GLint, GLint,
GLint)'
libutil/mipmap.c:8303: error: invalid conversion from 'void*' to 'const GLfloat*'
libutil/mipmap.c:8303: error:   initializing argument 4 of 'void
halveImage_float(GLint, GLuint, GLuint, const GLfloat*, GLfloat*, GLint, GLint,
GLint, GLint)'
libutil/mipmap.c:8303: error: invalid conversion from 'void*' to 'GLfloat*'
libutil/mipmap.c:8303: error:   initializing argument 5 of 'void
halveImage_float(GLint, GLuint, GLuint, const GLfloat*, GLfloat*, GLint, GLint,
GLint, GLint)'
make[2]: *** [libutil/mipmap.o] Error 1
make[1]: *** [default] Error 2
make: *** [default] Error 2

the errors all seem to be related to malloc issues.  This code is the first error:

    beforeImage =
        malloc(image_size(widthin, heightin, format, GL_UNSIGNED_SHORT));

It appears that darwin and/or gcc 4.0.1 really don't like converting the
unsigned short* to a void* but I'm not sure how to go about fixing it.
Comment 1 Benjamin Reed 2006-06-10 08:09:01 UTC
OK, it looks like the issue is the C code is being compiled with C++

Darwin is the only platform with "CC = c++" and I *suspect* it's because at some
time in the past someone did that because of issues linking c++ libraries.

However, it appears that's not necessary, as the mklib call makes sure that CXX
is called for the linker:

$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
   $(TOP)/bin/mklib -o $(GLU_LIB) -linker '$(CXX)' \
      -major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \
      -cplusplus $(MKLIB_OPTIONS) -install $(LIB_DIR) \
      $(GLU_LIB_DEPS) $(OBJECTS)


I'm testing right now, but I bet that's the issue.
Comment 2 Tilman Sauerbeck 2006-06-10 08:30:21 UTC
Yes, same issue as #7174, please put additional comments there.

*** This bug has been marked as a duplicate of 7174 ***

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.