Opened 4 years ago
Last modified 3 years ago
#62203 closed defect
mesa @19.0.8: build fails on < 10.7 with glext.h:303:15: error: typedef redefinition with different types — at Version 14
Reported by: | kencu (Ken) | Owned by: | jeremyhu (Jeremy Huddleston Sequoia) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | snowleopard | Cc: | |
Port: | mesa |
Description (last modified by kencu (Ken))
There is a longstanding issue going back some years with types in mesa, I read. Jeremy has been involved in this issue for a long time. There are some workarounds in mesa for OSX.
mesa @17.x built on 10.6 and other older systems without any trouble, and still does. mesa @19.x is failing due to this:
In file included from apple_glx_drawable.c:37: In file included from ./apple_glx_context.h:37: In file included from /System/Library/Frameworks/OpenGL.framework/Headers/CGLContext.h:9: In file included from /System/Library/Frameworks/OpenGL.framework/Headers/gliDispatch.h:9: /System/Library/Frameworks/OpenGL.framework/Headers/glext.h:303:15: error: typedef redefinition with different types ('void *' vs 'unsigned long') typedef void *GLhandleARB; ^ ../../../include/GL/glext.h:4094:23: note: previous definition is here typedef unsigned long GLhandleARB; ^ 1 error generated. make[4]: *** [apple_glx_drawable.lo] Error 1 In file included from apple_glx_context.c:52: In file included from ./apple_glx_context.h:37: In file included from /System/Library/Frameworks/OpenGL.framework/Headers/CGLContext.h:9: In file included from /System/Library/Frameworks/OpenGL.framework/Headers/gliDispatch.h:9: /System/Library/Frameworks/OpenGL.framework/Headers/glext.h:303:15: error: typedef redefinition with different types ('void *' vs 'unsigned long') typedef void *GLhandleARB; ^ ../../../include/GL/glext.h:4094:23: note: previous definition is here typedef unsigned long GLhandleARB; ^
It is not obvious to me, after several hours of poking around in the guts of the GL headers, comparing 10.6 (where it fails) to 10.7 (where it succeeds) etc what the issue is, exactly.
Change History (16)
Changed 4 years ago by kencu (Ken)
Attachment: | mesa-1908-fail-SL.log added |
---|
comment:1 Changed 4 years ago by kencu (Ken)
I'll put up another virgin log with clang-9.0 (the default compiler) but the error was the same.
Building mesa with clang-9.0 on Catalina works fine.
I don't think (at present) this is a compiler thing. I think, somehow, it's a header thing.
comment:2 Changed 4 years ago by kencu (Ken)
Here's the log from the buildbot showing the same error I saw:
comment:3 Changed 4 years ago by kencu (Ken)
The exact same error happens with mesa @18.3.6
, so that is not a solution at present.
comment:4 Changed 4 years ago by kencu (Ken)
comment:6 Changed 4 years ago by kencu (Ken)
Jeremy weighed in <https://bugs.freedesktop.org/show_bug.cgi?id=66346>
comment:7 Changed 4 years ago by kencu (Ken)
mesa @17.1.6_2
builds fine on 10.6, even with PortGroup legacysupport 1.0
added, so it doesn't seem to be related to that.
comment:8 Changed 4 years ago by kencu (Ken)
The succeeding (top, mesa 17) and failing (bottom, mesa 18) compile lines look very similar, but are not identical:
mesa 17 - succeeds (1st) mesa 18 - fails (2nd) libtool: compile: /opt/local/bin/clang-mp-9.0 -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"17.1.6\" "-DPACKAGE_STRING=\"Mesa 17.1.6\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"17.1.6\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DHAVE___BUILTIN_BSWAP32=1 -DHAVE___BUILTIN_BSWAP64=1 -DHAVE___BUILTIN_CLZ=1 -DHAVE___BUILTIN_CLZLL=1 -DHAVE___BUILTIN_CTZ=1 -DHAVE___BUILTIN_EXPECT=1 -DHAVE___BUILTIN_FFS=1 -DHAVE___BUILTIN_FFSLL=1 -DHAVE___BUILTIN_POPCOUNT=1 -DHAVE___BUILTIN_POPCOUNTLL=1 -DHAVE___BUILTIN_UNREACHABLE=1 -DHAVE_FUNC_ATTRIBUTE_CONST=1 -DHAVE_FUNC_ATTRIBUTE_FLATTEN=1 -DHAVE_FUNC_ATTRIBUTE_FORMAT=1 -DHAVE_FUNC_ATTRIBUTE_MALLOC=1 -DHAVE_FUNC_ATTRIBUTE_PACKED=1 -DHAVE_FUNC_ATTRIBUTE_PURE=1 -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL=1 -DHAVE_FUNC_ATTRIBUTE_UNUSED=1 -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1 -DHAVE_FUNC_ATTRIBUTE_WEAK=1 -DHAVE_DLADDR=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -I. -I/opt/local/include/LegacySupport -I../../../src -I../../../include -I../../../src/glx -I../../../src/mesa -I../../../src/mesa -I../../../src/mapi -I../../../src/mapi/glapi -I../../../src/mapi/glapi -fvisibility=hidden -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DNDEBUG -DHAVE_XLOCALE_H -DHAVE_SYS_SYSCTL_H -DHAVE_DLOPEN -DHAVE_STRTOF -DHAVE_POSIX_MEMALIGN -DGLX_USE_APPLEGL -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DHAVE_X11_PLATFORM -DBUILDING_MESA -pipe -Os -I/opt/local/include/LegacySupport -arch x86_64 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-math-errno -fno-trapping-math -Qunused-arguments -MT apple_glx_context.lo -MD -MP -MF .deps/apple_glx_context.Tpo -c apple_glx_context.c -fno-common -DPIC -o .libs/apple_glx_context.o libtool: compile: /opt/local/bin/clang-mp-9.0 -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"18.3.6\" "-DPACKAGE_STRING=\"Mesa 18.3.6\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"18.3.6\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DHAVE___BUILTIN_BSWAP32=1 -DHAVE___BUILTIN_BSWAP64=1 -DHAVE___BUILTIN_CLZ=1 -DHAVE___BUILTIN_CLZLL=1 -DHAVE___BUILTIN_CTZ=1 -DHAVE___BUILTIN_EXPECT=1 -DHAVE___BUILTIN_FFS=1 -DHAVE___BUILTIN_FFSLL=1 -DHAVE___BUILTIN_POPCOUNT=1 -DHAVE___BUILTIN_POPCOUNTLL=1 -DHAVE___BUILTIN_UNREACHABLE=1 -DHAVE_FUNC_ATTRIBUTE_CONST=1 -DHAVE_FUNC_ATTRIBUTE_FLATTEN=1 -DHAVE_FUNC_ATTRIBUTE_FORMAT=1 -DHAVE_FUNC_ATTRIBUTE_MALLOC=1 -DHAVE_FUNC_ATTRIBUTE_PACKED=1 -DHAVE_FUNC_ATTRIBUTE_PURE=1 -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL=1 -DHAVE_FUNC_ATTRIBUTE_UNUSED=1 -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1 -DHAVE_FUNC_ATTRIBUTE_WEAK=1 -DHAVE_FUNC_ATTRIBUTE_NORETURN=1 -DHAVE_DLADDR=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -I. -I/opt/local/include/LegacySupport -I../../../src -I../../../include -I../../../src/glx -I../../../src/mesa -I../../../src/mesa -I../../../src/mapi -I../../../src/mapi/glapi -I../../../src/mapi/glapi -fvisibility=hidden -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DNDEBUG -DHAVE_XLOCALE_H -DHAVE_SYS_SYSCTL_H -DHAVE_DLFCN_H -DHAVE_STRTOF -DHAVE_POSIX_MEMALIGN -DHAVE_ZLIB -DGLX_USE_APPLEGL -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DHAVE_X11_PLATFORM -DBUILDING_MESA -pipe -Os -I/opt/local/include/LegacySupport -arch x86_64 -std=c99 -Qunused-arguments -MT apple_glx_context.lo -MD -MP -MF .deps/apple_glx_context.Tpo -c apple_glx_context.c -fno-common -DPIC -o .libs/apple_glx_context.o
this looks like the only real difference that stands out there:
-DHAVE_FUNC_ATTRIBUTE_NORETURN=1
comment:9 Changed 4 years ago by kencu (Ken)
That NORETURN thing might actually be relevant here...<http://git.hermesmesh.com/lymi_2771/mesa/commit/85377dc55c55d1c5536cdf9a86ce67ebb59b7e77>
-- edit -- well, can't immediately see how it would be...
comment:10 Changed 4 years ago by kencu (Ken)
apple_glx_context.c has not changed much:
$ diff -u /opt/SnowLeopardPorts/x11/mesa/work/mesa-17.1.6/src/glx/apple/apple_glx_context.c /opt/macports-ports/x11/mesa/work/mesa-18.3.6/src/glx/apple/apple_glx_context.c --- /opt/SnowLeopardPorts/x11/mesa/work/mesa-17.1.6/src/glx/apple/apple_glx_context.c 2017-08-07 05:04:30.000000000 -0700 +++ /opt/macports-ports/x11/mesa/work/mesa-18.3.6/src/glx/apple/apple_glx_context.c 2019-04-05 03:53:23.000000000 -0700 @@ -55,6 +55,8 @@ #include "apple_cgl.h" #include "apple_glx_drawable.h" +#include "util/debug.h" + static pthread_mutex_t context_lock = PTHREAD_MUTEX_INITIALIZER; /* @@ -181,7 +183,7 @@ *x11errorptr = false; } - if (getenv("LIBGL_DIAGNOSTIC")) + if (env_var_as_boolean("LIBGL_DIAGNOSTIC", false)) fprintf(stderr, "error: %s\n", apple_cgl.error_string(error)); return true;
comment:11 Changed 4 years ago by kencu (Ken)
and the header has not changed a bit:
$ diff -u /opt/SnowLeopardPorts/x11/mesa/work/mesa-17.1.6/src/glx/apple/apple_glx_context.h /opt/macports-ports/x11/mesa/work/mesa-18.3.6/src/glx/apple/apple_glx_context.h
comment:12 Changed 4 years ago by kencu (Ken)
the newly added util/debug.h
seems to have nothing sinister in it:
$ cat ./src/util/debug.h /* * Copyright © 2015 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef _UTIL_DEBUG_H #define _UTIL_DEBUG_H #include <stdint.h> #include <stdbool.h> #ifdef __cplusplus extern "C" { #endif struct debug_control { const char * string; uint64_t flag; }; uint64_t parse_debug_string(const char *debug, const struct debug_control *control); bool env_var_as_boolean(const char *var_name, bool default_value); #ifdef __cplusplus } /* extern C */ #endif #endif /* _UTIL_DEBUG_H */
comment:13 Changed 4 years ago by kencu (Ken)
here's a diff of the whole src/glx/apple
directory, and I just don't immediately see the problem here (attached).
Changed 4 years ago by kencu (Ken)
Attachment: | mesa-glx-apple-dir.diff added |
---|
comment:14 Changed 4 years ago by kencu (Ken)
Description: | modified (diff) |
---|
this attempt was with clang-5.0