Bug 107865

Summary: swr fail to build with llvm-libs 6.0.1
Product: Mesa Reporter: Laurent carlier <lordheavym>
Component: Drivers/Gallium/swrAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: blocker    
Priority: medium CC: steven, virtuousfox
Version: 18.2   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Laurent carlier 2018-09-08 07:34:12 UTC
[1803/2428] Compiling C++ object 'src/gallium/drivers/swr/src@gallium@drivers@swr@@swrAVX2@sha/rasterizer_memory_StoreTile_TileX.cpp.o'.
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/format_conversion.h:28,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/memory/StoreTile.h:34,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/memory/StoreTile_TileX.cpp:28:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/format_types.h: In lambda function:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/format_types.h:1416:26: warning: array subscript 4 is above array bounds of ‘const uint32_t [4]’ {aka ‘const unsigned int [4]’} [-Warray-bounds]
         return MyBpc[comp];
                          ^
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/format_types.h:1404:29: warning: array subscript 4 is above array bounds of ‘const SWR_TYPE [4]’ [-Warray-bounds]
         return CompType[comp];
                             ^
[1804/2428] Compiling C++ object 'src/gallium/drivers/swr/src@gallium@drivers@swr@@mesaswr@sta/meson-generated_.._rasterizer_core_backends_gen_rasterizer0.cpp.o'.
[1805/2428] Compiling C++ object 'src/gallium/drivers/swr/src@gallium@drivers@swr@@swrAVX2@sha/rasterizer_memory_StoreTile_TileY2.cpp.o'.
[1806/2428] Compiling C++ object 'src/gallium/drivers/swr/src@gallium@drivers@swr@@mesaswr@sta/swr_loader.cpp.o'.
[1807/2428] Compiling C++ object 'src/gallium/drivers/swr/src@gallium@drivers@swr@@mesaswr@sta/rasterizer_jitter_builder_mem.cpp.o'.
FAILED: src/gallium/drivers/swr/src@gallium@drivers@swr@@mesaswr@sta/rasterizer_jitter_builder_mem.cpp.o 
c++ -Isrc/gallium/drivers/swr/src@gallium@drivers@swr@@mesaswr@sta -Isrc/gallium/drivers/swr -I../mesa-18.2.0/src/gallium/drivers/swr -Isrc/../include -I../mesa-18.2.0/src/../include -Isrc -I../mesa-18.2.0/src -Isrc/mapi -I../mesa-18.2.0/src/mapi -Isrc/mesa -I../mesa-18.2.0/src/mesa -I../mesa-18.2.0/src/gallium/include -Isrc/gallium/auxiliary -I../mesa-18.2.0/src/gallium/auxiliary -Isrc/gallium/drivers/swr/rasterizer/codegen -I../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/codegen -Isrc/gallium/drivers/swr/rasterizer/core -I../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core -Isrc/gallium/drivers/swr/rasterizer/jitter -I../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter -I../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/archrast -Isrc/gallium/drivers/swr/rasterizer -I../mesa-18.2.0/src/gallium/drivers/swr/rasterizer -Isrc/gallium/drivers/swr/rasterizer/core/backends -I/usr/include -fdiagnostics-color=always -DNDEBUG -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++11 -O3 '-DVERSION="18.2.0"' -DPACKAGE_VERSION=VERSION '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"' -DGLX_USE_TLS -DHAVE_ST_VDPAU -DENABLE_ST_OMX_BELLAGIO=1 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_X11_PLATFORM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DHAVE_DRM_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_64_ASM -DMAJOR_IN_SYSMACROS -DHAVE_SYS_SYSCTL_H -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_POSIX_MEMALIGN -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_PTHREAD -DHAVE_LIBDRM -DHAVE_LLVM=0x0600 -DMESA_LLVM_VERSION_PATCH=1 -DUSE_LIBGLVND=1 -DHAVE_LIBUNWIND -DHAVE_WAYLAND_PLATFORM -DWL_HIDE_DEPRECATED -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -DHAVE_GALLIUM_EXTRA_HUD=1 -DHAVE_LIBSENSORS=1 -Wall -fno-math-errno -fno-trapping-math -Wno-non-virtual-dtor -Wno-missing-field-initializers -march=x86-64 -mtune=generic -O2 -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -pthread -fvisibility=hidden -fvisibility=hidden -fno-strict-aliasing -mavx -DHAVE_SWR_AVX -DHAVE_SWR_AVX2  -MD -MQ 'src/gallium/drivers/swr/src@gallium@drivers@swr@@mesaswr@sta/rasterizer_jitter_builder_mem.cpp.o' -MF 'src/gallium/drivers/swr/src@gallium@drivers@swr@@mesaswr@sta/rasterizer_jitter_builder_mem.cpp.o.d' -o 'src/gallium/drivers/swr/src@gallium@drivers@swr@@mesaswr@sta/rasterizer_jitter_builder_mem.cpp.o' -c ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder.h:157,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:31:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp: In member function ‘llvm::CallInst* SwrJit::Builder::ELEMENT_UNORDERED_ATOMIC_MEM_CPY(llvm::Value*, llvm::Value*, uint64_t, uint32_t, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*)’:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp:71:59: error: invalid conversion from ‘llvm::Value*’ to ‘unsigned int’ [-fpermissive]
     return IRB()->CreateElementUnorderedAtomicMemCpy(Dst, Src, Size, ElementSize, TBAATag, TBAAStructTag, ScopeTag, NoAliasTag);
                                                           ^~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp:46,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:30:
/usr/include/llvm/IR/IRBuilder.h:447:28: note:   initializing argument 2 of ‘llvm::CallInst* llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(llvm::Value*, unsigned int, llvm::Value*, unsigned int, uint64_t, uint32_t, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*)’
       Value *Dst, unsigned DstAlign, Value *Src, unsigned SrcAlign,
                   ~~~~~~~~~^~~~~~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder.h:157,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:31:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp:71:64: error: invalid conversion from ‘uint64_t’ {aka ‘long unsigned int’} to ‘llvm::Value*’ [-fpermissive]
     return IRB()->CreateElementUnorderedAtomicMemCpy(Dst, Src, Size, ElementSize, TBAATag, TBAAStructTag, ScopeTag, NoAliasTag);
                                                                ^~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp:46,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:30:
/usr/include/llvm/IR/IRBuilder.h:447:45: note:   initializing argument 3 of ‘llvm::CallInst* llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(llvm::Value*, unsigned int, llvm::Value*, unsigned int, uint64_t, uint32_t, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*)’
       Value *Dst, unsigned DstAlign, Value *Src, unsigned SrcAlign,
                                      ~~~~~~~^~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder.h:157,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:31:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp:71:83: error: invalid conversion from ‘llvm::MDNode*’ to ‘uint64_t’ {aka ‘long unsigned int’} [-fpermissive]
     return IRB()->CreateElementUnorderedAtomicMemCpy(Dst, Src, Size, ElementSize, TBAATag, TBAAStructTag, ScopeTag, NoAliasTag);
                                                                                   ^~~~~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp:46,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:30:
/usr/include/llvm/IR/IRBuilder.h:448:16: note:   initializing argument 5 of ‘llvm::CallInst* llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(llvm::Value*, unsigned int, llvm::Value*, unsigned int, uint64_t, uint32_t, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*)’
       uint64_t Size, uint32_t ElementSize, MDNode *TBAATag = nullptr,
       ~~~~~~~~~^~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder.h:157,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:31:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp:71:92: error: invalid conversion from ‘llvm::MDNode*’ to ‘uint32_t’ {aka ‘unsigned int’} [-fpermissive]
     return IRB()->CreateElementUnorderedAtomicMemCpy(Dst, Src, Size, ElementSize, TBAATag, TBAAStructTag, ScopeTag, NoAliasTag);
                                                                                            ^~~~~~~~~~~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp:46,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:30:
/usr/include/llvm/IR/IRBuilder.h:448:31: note:   initializing argument 6 of ‘llvm::CallInst* llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(llvm::Value*, unsigned int, llvm::Value*, unsigned int, uint64_t, uint32_t, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*)’
       uint64_t Size, uint32_t ElementSize, MDNode *TBAATag = nullptr,
                      ~~~~~~~~~^~~~~~~~~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder.h:157,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:31:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp: In member function ‘llvm::CallInst* SwrJit::Builder::ELEMENT_UNORDERED_ATOMIC_MEM_CPY(llvm::Value*, llvm::Value*, llvm::Value*, uint32_t, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*)’:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp:76:59: error: invalid conversion from ‘llvm::Value*’ to ‘unsigned int’ [-fpermissive]
     return IRB()->CreateElementUnorderedAtomicMemCpy(Dst, Src, Size, ElementSize, TBAATag, TBAAStructTag, ScopeTag, NoAliasTag);
                                                           ^~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp:46,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:30:
/usr/include/llvm/IR/IRBuilder.h:447:28: note:   initializing argument 2 of ‘llvm::CallInst* llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(llvm::Value*, unsigned int, llvm::Value*, unsigned int, uint64_t, uint32_t, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*)’
       Value *Dst, unsigned DstAlign, Value *Src, unsigned SrcAlign,
                   ~~~~~~~~~^~~~~~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder.h:157,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:31:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp:76:83: error: invalid conversion from ‘llvm::MDNode*’ to ‘uint64_t’ {aka ‘long unsigned int’} [-fpermissive]
     return IRB()->CreateElementUnorderedAtomicMemCpy(Dst, Src, Size, ElementSize, TBAATag, TBAAStructTag, ScopeTag, NoAliasTag);
                                                                                   ^~~~~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp:46,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:30:
/usr/include/llvm/IR/IRBuilder.h:448:16: note:   initializing argument 5 of ‘llvm::CallInst* llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(llvm::Value*, unsigned int, llvm::Value*, unsigned int, uint64_t, uint32_t, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*)’
       uint64_t Size, uint32_t ElementSize, MDNode *TBAATag = nullptr,
       ~~~~~~~~~^~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder.h:157,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:31:
../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp:76:92: error: invalid conversion from ‘llvm::MDNode*’ to ‘uint32_t’ {aka ‘unsigned int’} [-fpermissive]
     return IRB()->CreateElementUnorderedAtomicMemCpy(Dst, Src, Size, ElementSize, TBAATag, TBAAStructTag, ScopeTag, NoAliasTag);
                                                                                            ^~~~~~~~~~~~~
In file included from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp:46,
                 from ../mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:30:
/usr/include/llvm/IR/IRBuilder.h:448:31: note:   initializing argument 6 of ‘llvm::CallInst* llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(llvm::Value*, unsigned int, llvm::Value*, unsigned int, uint64_t, uint32_t, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*)’
       uint64_t Size, uint32_t ElementSize, MDNode *TBAATag = nullptr,
                      ~~~~~~~~~^~~~~~~~~~~
[1808/2428] Compiling C++ object 'src/gallium/drivers/swr/src@gallium@drivers@swr@@mesaswr@sta/swr_clear.cpp.o'.
Comment 1 Steven Noonan 2018-09-15 16:08:45 UTC
I found out that this build apparently only fails when building from the release tarball, presumably because of these differences (recursive diff between git tree and release tarball follows):

Only in mesa-18.2.0/src/gallium/drivers/swr: Makefile.in
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/archrast: gen_ar_event.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/archrast: gen_ar_eventhandlerfile.hpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/archrast: gen_ar_eventhandler.hpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/archrast: gen_ar_event.hpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/codegen: gen_knobs.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/codegen: gen_knobs.h
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_BackendPixelRate0.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_BackendPixelRate1.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_BackendPixelRate2.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_BackendPixelRate3.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_BackendPixelRate.hpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_rasterizer0.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_rasterizer1.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_rasterizer2.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_rasterizer3.cpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/core/backends: gen_rasterizer.hpp
Only in mesa/src/gallium/drivers/swr/rasterizer: .dir-locals.el
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter: gen_builder.hpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter: gen_builder_intrin.hpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter: gen_builder_meta.hpp
Only in mesa-18.2.0/src/gallium/drivers/swr/rasterizer/jitter: gen_state_llvm.h

So it looks like there are a bunch of pregenerated source files that were generated using a *different* LLVM version, and that's what's causing the build break.

I changed my arch PKGBUILD to build from the git tree, and it built successfully.
Comment 2 Bruce Cherniak 2018-09-15 16:59:46 UTC
Thank you for tracking this down!  That helps a lot!
Comment 3 Alok Hota 2018-10-22 13:09:25 UTC
This patch is to fix this issue: https://patchwork.freedesktop.org/series/51133/

It should make its way to the stable branch, hopefully in the next dot release.

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.