Bug 100028 - Mesa 17+llvm 4.0.0rc2 fail to compile
Summary: Mesa 17+llvm 4.0.0rc2 fail to compile
Status: RESOLVED INVALID
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 17.0
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-02 02:49 UTC by higuita
Modified: 2017-03-03 00:00 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description higuita 2017-03-02 02:49:57 UTC
Hi

I have a strange problem, having compiled llvm 4.0.0rc2 and then tried to compile mesa 17.0, it fails with this:

make[3]: Entering directory '/tmp/mesa-17.0.0/src/amd'
make  all-am
make[4]: Entering directory '/tmp/mesa-17.0.0/src/amd'
/bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"17.0.0\" -DPACKAGE_STRING=\"Mesa\ 17.0.0\" -DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi\?product=Mesa\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"17.0.0\" -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_VISIBILITY=1 -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1 -DHAVE_FUNC_ATTRIBUTE_WEAK=1 -DHAVE_FUNC_ATTRIBUTE_ALIAS=1 -DMAJOR_IN_SYSMACROS=1 -DHAVE_DLADDR=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD=1 -DHAVE_VALGRIND=1 -I.  -I/usr/include/valgrind -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DDEBUG -DTEXTURE_FLOAT_ENABLED -DUSE_X86_64_ASM -DHAVE_XLOCALE_H -DHAVE_SYS_SYSCTL_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -DHAVE_LIBDRM -DGLX_USE_DRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_DRI3 -DENABLE_SHADER_CACHE -DHAVE_MINCORE -DHAVE_ST_VDPAU -DHAVE_LLVM=0x0400 -DMESA_LLVM_VERSION_PATCH=0 -I../../include -I../../src -I../../src -I../../src/amd/common -I../../src/amd/common -I../../src/compiler -I../../src/compiler/nir -I../../src/compiler -I../../src/mapi -I../../src/mesa -I../../src/mesa/drivers/dri/common -I../../src/gallium/auxiliary -I../../src/gallium/include  -fvisibility=hidden -I/usr/include     -isystem /usr/lib64/clang/4.0.0/include/    -W -Wno-unused-parameter -Wwrite-strings  -Wmissing-field-initializers  -Wno-long-long  -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -std=c++11       -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fPIC -march=native -mtune=native -Wall -fno-math-errno -fno-trapping-math -g  -MT common/common_libamd_common_la-ac_llvm_helper.lo -MD -MP -MF common/.deps/common_libamd_common_la-ac_llvm_helper.Tpo -c -o common/common_libamd_common_la-ac_llvm_helper.lo `test -f 'common/ac_llvm_helper.cpp' || echo './'`common/ac_llvm_helper.cpp
libtool: compile:  g++ -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"17.0.0\" "-DPACKAGE_STRING=\"Mesa 17.0.0\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"17.0.0\" -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_VISIBILITY=1 -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1 -DHAVE_FUNC_ATTRIBUTE_WEAK=1 -DHAVE_FUNC_ATTRIBUTE_ALIAS=1 -DMAJOR_IN_SYSMACROS=1 -DHAVE_DLADDR=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD=1 -DHAVE_VALGRIND=1 -I. -I/usr/include/valgrind -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DDEBUG -DTEXTURE_FLOAT_ENABLED -DUSE_X86_64_ASM -DHAVE_XLOCALE_H -DHAVE_SYS_SYSCTL_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -DHAVE_LIBDRM -DGLX_USE_DRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_DRI3 -DENABLE_SHADER_CACHE -DHAVE_MINCORE -DHAVE_ST_VDPAU -DHAVE_LLVM=0x0400 -DMESA_LLVM_VERSION_PATCH=0 -I../../include -I../../src -I../../src -I../../src/amd/common -I../../src/amd/common -I../../src/compiler -I../../src/compiler/nir -I../../src/compiler -I../../src/mapi -I../../src/mesa -I../../src/mesa/drivers/dri/common -I../../src/gallium/auxiliary -I../../src/gallium/include -fvisibility=hidden -I/usr/include -isystem /usr/lib64/clang/4.0.0/include/ -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -Wno-long-long -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -std=c++11 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fPIC -march=native -mtune=native -Wall -fno-math-errno -fno-trapping-math -g -MT common/common_libamd_common_la-ac_llvm_helper.lo -MD -MP -MF common/.deps/common_libamd_common_la-ac_llvm_helper.Tpo -c common/ac_llvm_helper.cpp  -fPIC -DPIC -o common/.libs/common_libamd_common_la-ac_llvm_helper.o
g++: error: unrecognized command line option ‘-Wstring-conversion’
make[4]: *** [Makefile:956: common/common_libamd_common_la-ac_llvm_helper.lo] Error 1
make[4]: Leaving directory '/tmp/mesa-17.0.0/src/amd'
make[3]: *** [Makefile:697: all] Error 2
make[3]: Leaving directory '/tmp/mesa-17.0.0/src/amd'
make[2]: *** [Makefile:856: all-recursive] Error 1
make[2]: Leaving directory '/tmp/mesa-17.0.0/src'
make[1]: *** [Makefile:647: all] Error 2
make[1]: Leaving directory '/tmp/mesa-17.0.0/src'
make: *** [Makefile:644: all-recursive] Error 1

From that command and error, it looks like Make is trying to compile this with g++ instead of clang++ and if i manually replace it (and in another places), i can compile mesa 17.0.

So what is failing here? it is using the LLVM_CXXFLAGS and the gcc g++.
I had the mesa 17.0rc3 compiled just fine with llvm 3.9.1.


i'm using slackware64-current, kernel 4.10.0, gcc 5.4.0, automake 1.15


Thanks
Comment 2 higuita 2017-03-02 23:07:00 UTC
Ok, thanks... but building mesa-git i get this, that is similar to what i get just by removing the bad llvm flag:


Making all in amd
make[3]: Entering directory '/tmp/mesa-d7d64f1091006fb6faa48705c53f19ff5c657bc8/src/amd'
make  all-am
make[4]: Entering directory '/tmp/mesa-d7d64f1091006fb6faa48705c53f19ff5c657bc8/src/amd'
  CXX      common/common_libamd_common_la-ac_llvm_helper.lo
In file included from /usr/include/sys/types.h:146:0,
                 from /usr/include/llvm/Support/DataTypes.h:69,
                 from /usr/include/llvm-c/Types.h:17,
                 from /usr/include/llvm-c/TargetMachine.h:22,
                 from common/ac_llvm_util.h:28,
                 from common/ac_llvm_helper.cpp:34:
/usr/lib64/clang/4.0.0/include/stddef.h:57:39: error: missing binary operator before token "("
 #if !defined(_SIZE_T) || __has_feature(modules)
                                       ^
In file included from /usr/include/wchar.h:51:0,
                 from /usr/include/c++/5.4.0/cwchar:44,
                 from /usr/include/c++/5.4.0/bits/postypes.h:40,
                 from /usr/include/c++/5.4.0/bits/char_traits.h:40,
                 from /usr/include/c++/5.4.0/string:40,
                 from /usr/include/llvm/MC/MCTargetOptions.h:13,
                 from /usr/include/llvm/Target/TargetOptions.h:18,
                 from common/ac_llvm_helper.cpp:36:
/usr/lib64/clang/4.0.0/include/stddef.h:57:39: error: missing binary operator before token "("
 #if !defined(_SIZE_T) || __has_feature(modules)
                                       ^
/usr/lib64/clang/4.0.0/include/stddef.h:128:39: error: missing binary operator before token "("
 #if !defined(_WINT_T) || __has_feature(modules)
                                       ^


i would say that something here do not like llvm 4.0 ... or i may have something broken in my system
Comment 3 Jan Vesely 2017-03-02 23:32:13 UTC
(In reply to higuita from comment #2)
> Ok, thanks... but building mesa-git i get this, that is similar to what i
> get just by removing the bad llvm flag:
> 
> 
> Making all in amd
> make[3]: Entering directory
> '/tmp/mesa-d7d64f1091006fb6faa48705c53f19ff5c657bc8/src/amd'
> make  all-am
> make[4]: Entering directory
> '/tmp/mesa-d7d64f1091006fb6faa48705c53f19ff5c657bc8/src/amd'
>   CXX      common/common_libamd_common_la-ac_llvm_helper.lo
> In file included from /usr/include/sys/types.h:146:0,
>                  from /usr/include/llvm/Support/DataTypes.h:69,
>                  from /usr/include/llvm-c/Types.h:17,
>                  from /usr/include/llvm-c/TargetMachine.h:22,
>                  from common/ac_llvm_util.h:28,
>                  from common/ac_llvm_helper.cpp:34:
> /usr/lib64/clang/4.0.0/include/stddef.h:57:39: error: missing binary
> operator before token "("
>  #if !defined(_SIZE_T) || __has_feature(modules)
>                                        ^
> In file included from /usr/include/wchar.h:51:0,
>                  from /usr/include/c++/5.4.0/cwchar:44,
>                  from /usr/include/c++/5.4.0/bits/postypes.h:40,
>                  from /usr/include/c++/5.4.0/bits/char_traits.h:40,
>                  from /usr/include/c++/5.4.0/string:40,
>                  from /usr/include/llvm/MC/MCTargetOptions.h:13,
>                  from /usr/include/llvm/Target/TargetOptions.h:18,
>                  from common/ac_llvm_helper.cpp:36:
> /usr/lib64/clang/4.0.0/include/stddef.h:57:39: error: missing binary
> operator before token "("
>  #if !defined(_SIZE_T) || __has_feature(modules)
>                                        ^
> /usr/lib64/clang/4.0.0/include/stddef.h:128:39: error: missing binary
> operator before token "("
>  #if !defined(_WINT_T) || __has_feature(modules)

This is mixing llvm standard headers while compiling with gcc.
I'd say "-isystem /usr/lib64/clang/4.0.0/include/" is the culprit here.
Not sure where it came from, maybe it needs to be stripped as well.
Comment 4 higuita 2017-03-03 00:00:48 UTC
humm... "-isystem /usr/lib64/clang/4.0.0/include/" you say... let me check...

yep, this is my fault! i had some problems with llvm 4.0.0rc1 and add that to try to workaround it... and forgot to remove it in rc2. Now the llvmconfig --cxxflags also have this flag.

As this was a "bad option", i think there is no need to remove more flags

So sorry, my bad, i will close this.

But thanks for the help and for mesa!


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.