[Mesa-dev] [PATCHES] clang compatibility

Eric Anholt eric at anholt.net
Sun Aug 22 12:05:54 PDT 2010

On Sun, 22 Aug 2010 05:35:19 -0400, nobled <nobled at dreamwidth.org> wrote:
> 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.)

From #llvm:

<anholt> is it intended that when linking a c++ app with clang that -lstdc++ has to be explicitly specified?
<aKor> anholt: link via clang++
<aKor> :)
<nicholas> yes, same as with gcc. try linking with clang++ instead.
<anholt> ah, my 2.7 clang packages don't come with a clang++ binary
<dgregor> anholt: don't use 2.7 for C++. For c++, you'll need to use
clang from Subversion
<dgregor> anholt: adding -lstdc++ is the wrong solution. clang++ is just
a symlink to clang, by the way. you can add it yourself
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100822/013b1543/attachment.pgp>

More information about the mesa-dev mailing list