[Mesa-dev] [PATCHES] clang compatibility

nobled nobled at dreamwidth.org
Sun Aug 22 02:35:19 PDT 2010


The first three attached patches make it possible to compile Mesa with
LLVM/Clang:
1. Add -lstdc++ when linking glsl_compiler and glcpp
2. Move -lstdc++ from the Gallium-specific Makefile.dri to
DRI_LIB_DEPS in configure (fixes linking classic Mesa drivers)
3. Since autoconf gives GCC=yes even when using clang (since it just
tests for the __GNUC__ macro), don't check for a minimum version of
3.3 if $(CC) points to a clang executable. (unfortunately I'm not sure
how to properly detect clang, short of test-compiling a file that
contains #ifdef __clang__. I.e. if $(CC) = 'cc', and 'cc' is an
alternatives symlink to llvm-clang, this doesn't detect that case.)

The rest are just fixes to compiler warnings:
4. dri: Fix implicit declaration
5. program: Fix struct/class confusion
6. dr/radeon: Fix printf format
7. llvmpipe: Fix memory leak

With the first three patches, I can compile Mesa with clang 2.7 in
Ubuntu Lucid if I export three variables before configure:
export CC=llvm-clang
export CXX=llvm-clang
export CPPFLAGS=/usr/lib/clang/1.1/include
./configure
(Yeah, the third one is really prone to breakage with new versions and
I'm still trying to figure out how to not need it; it should also get
passed as part of MKDEP_OPTIONS in configure.ac, TBH.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-glsl-Add-lstdc-linkage.patch
Type: text/x-patch
Size: 1141 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100822/f5c5de83/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Move-lstdc-to-DRI_LIB_DEPS.patch
Type: text/x-patch
Size: 1427 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100822/f5c5de83/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Make-configure-work-with-clang.patch
Type: text/x-patch
Size: 1023 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100822/f5c5de83/attachment-0009.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-dri-Fix-implicit-declaration.patch
Type: text/x-patch
Size: 883 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100822/f5c5de83/attachment-0010.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-program-Fix-struct-class-confusion.patch
Type: text/x-patch
Size: 874 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100822/f5c5de83/attachment-0011.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-dri-radeon-Fix-printf-format.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100822/f5c5de83/attachment-0012.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-llvmpipe-Fix-memory-leak.patch
Type: text/x-patch
Size: 1130 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100822/f5c5de83/attachment-0013.bin>


More information about the mesa-dev mailing list