Bug 97019

Summary: [clover] build failure in llvm/codegen/native.cpp:129:52
Product: Mesa Reporter: Iaroslav Andrusyak <pontostroy>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: clover-llvm-codegen-native.cpp.patch

Description Iaroslav Andrusyak 2016-07-21 11:21:10 UTC
Last 6-10 days i can not build mesa with opencl support
Mesa-git 2016.07.15-21
llvm 3.9-4.0 2016.07.15-21

[  287s] virgl_vtest_winsys.c: In function 'virgl_vtest_winsys_resource_cache_create':
[  287s] virgl_vtest_winsys.c:361:20: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
[  287s]     if (!res && ret != -1) {
[  287s]                     ^
[  287s]   CCLD     libvirglvtest.la
[  287s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/winsys/virgl/vtest'
[  287s] Making all in winsys/sw/null
[  287s] make[4]: Entering directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/winsys/sw/null'
[  287s]   CC       null_sw_winsys.lo
[  287s]   CCLD     libws_null.la
[  287s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/winsys/sw/null'
[  287s] Making all in winsys/sw/dri
[  287s] make[4]: Entering directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/winsys/sw/dri'
[  287s]   CC       dri_sw_winsys.lo
[  287s]   CCLD     libswdri.la
[  287s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/winsys/sw/dri'
[  287s] Making all in winsys/sw/kms-dri
[  287s] make[4]: Entering directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/winsys/sw/kms-dri'
[  287s]   CC       kms_dri_sw_winsys.lo
[  287s]   CCLD     libswkmsdri.la
[  287s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/winsys/sw/kms-dri'
[  287s] Making all in winsys/sw/wrapper
[  287s] make[4]: Entering directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/winsys/sw/wrapper'
[  287s]   CC       wrapper_sw_winsys.lo
[  288s]   CCLD     libwsw.la
[  288s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/winsys/sw/wrapper'
[  288s] Making all in targets/pipe-loader
[  288s] make[4]: Entering directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/targets/pipe-loader'
[  288s]   CC       pipe_i965.lo
[  288s]   CC       pipe_nouveau.lo
[  288s]   CC       pipe_r300.lo
[  288s]   CC       pipe_r600.lo
[  288s]   CC       pipe_radeonsi.lo
[  288s]   CC       pipe_vmwgfx.lo
[  288s]   CC       pipe_swrast.lo
[  288s]   CXXLD    pipe_i965.la
[  288s]   CXXLD    pipe_nouveau.la
[  288s]   CXXLD    pipe_r300.la
[  288s]   CXXLD    pipe_r600.la
[  288s]   CXXLD    pipe_radeonsi.la
[  289s]   CXXLD    pipe_vmwgfx.la
[  289s]   CXXLD    pipe_swrast.la
[  289s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/targets/pipe-loader'
[  289s] Making all in state_trackers/clover
[  289s] make[4]: Entering directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/state_trackers/clover'
[  289s]   CXX      api/libclover_la-device.lo
[  289s]   CXX      api/libclover_la-event.lo
[  289s]   CXX      api/libclover_la-context.lo
[  289s]   CXX      api/libclover_la-interop.lo
[  289s]   CXX      api/libclover_la-dispatch.lo
[  290s]   CXX      api/libclover_la-kernel.lo
[  290s]   CXX      api/libclover_la-memory.lo
[  291s]   CXX      api/libclover_la-platform.lo
[  291s]   CXX      api/libclover_la-program.lo
[  292s]   CXX      api/libclover_la-queue.lo
[  292s]   CXX      api/libclover_la-sampler.lo
[  292s]   CXX      api/libclover_la-transfer.lo
[  294s]   CXX      core/libclover_la-context.lo
[  294s]   CXX      core/libclover_la-device.lo
[  294s]   CXX      core/libclover_la-event.lo
[  295s]   CXX      core/libclover_la-format.lo
[  295s]   CXX      core/libclover_la-kernel.lo
[  296s]   CXX      core/libclover_la-memory.lo
[  296s]   CXX      core/libclover_la-module.lo
[  297s]   CXX      core/libclover_la-platform.lo
[  298s]   CXX      core/libclover_la-program.lo
[  298s]   CXX      core/libclover_la-queue.lo
[  299s]   CXX      core/libclover_la-resource.lo
[  299s]   CXX      core/libclover_la-sampler.lo
[  299s]   CXX      core/libclover_la-timestamp.lo
[  300s]   CXX      tgsi/libcltgsi_la-compiler.lo
[  300s]   CXX      llvm/codegen/libclllvm_la-bitcode.lo
[  300s]   CXX      llvm/codegen/libclllvm_la-common.lo
[  300s]   CXX      llvm/codegen/libclllvm_la-native.lo
[  301s]   CXX      llvm/libclllvm_la-invocation.lo
[  302s]   CXXLD    libcltgsi.la
[  303s] llvm/codegen/native.cpp: In function 'std::vector<char> {anonymous}::emit_code(llvm::Module&, const clover::llvm::target&, llvm::TargetMachine::CodeGenFileType, std::string&)':
[  303s] llvm/codegen/native.cpp:129:52: error: invalid initialization of non-const reference of type 'clover::llvm::compat::raw_ostream_to_emit_file {aka llvm::raw_svector_ostream&}' from an rvalue of type '<brace-enclosed initializer list>'
[  303s]           compat::raw_ostream_to_emit_file fos { os };
[  303s]                                                     ^
[  304s] Makefile:918: recipe for target 'llvm/codegen/libclllvm_la-native.lo' failed
[  304s] make[4]: *** [llvm/codegen/libclllvm_la-native.lo] Error 1
[  304s] make[4]: *** Waiting for unfinished jobs....
[  307s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium/state_trackers/clover'
[  307s] Makefile:594: recipe for target 'all-recursive' failed
[  307s] make[3]: *** [all-recursive] Error 1
[  307s] make[3]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src/gallium'
[  307s] Makefile:696: recipe for target 'all-recursive' failed
[  307s] make[2]: *** [all-recursive] Error 1
[  307s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src'
[  307s] Makefile:573: recipe for target 'all' failed
[  307s] make[1]: *** [all] Error 2
[  307s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/mesa/src'
[  307s] Makefile:640: recipe for target 'all-recursive' failed
[  307s] make: *** [all-recursive] Error 1
[  307s] error: Bad exit status from /var/tmp/rpm-tmp.2KUyBs (%build)
[  307s] 
[  307s] 
[  307s] RPM build errors:
[  307s]     Bad exit status from /var/tmp/rpm-tmp.2KUyBs (%build)
Comment 1 Dieter Nützel 2016-07-24 18:15:10 UTC
I'm back from vacation and can second this with

LLVM 3.9.0svn and current (today)

LLVM 4.0.0svn

my post was titled:

clover: compilation error with former LLVM 3.9.0svn and current LLVM 4.0.0svn
Comment 2 Jan Vesely 2016-07-24 19:37:59 UTC
This looks like an old compiler (not fully c++11 capable). what version are you using?
Comment 3 Dieter Nützel 2016-07-24 20:22:05 UTC
c++ (SUSE Linux) 4.8.3

openSUSE 13.2 system version (worked for ages)

Iaroslav is on openSUSE Leap 42.1+ (4.8.5) or updated to 5.x, I think.
Comment 4 Jan Vesely 2016-07-24 21:18:12 UTC
(In reply to Dieter Nützel from comment #3)
> c++ (SUSE Linux) 4.8.3
> 
> openSUSE 13.2 system version (worked for ages)
> 
> Iaroslav is on openSUSE Leap 42.1+ (4.8.5) or updated to 5.x, I think.

Clover was significantly rewritten few weeks ago. I'd guess this error does not happen before 600ac51448f0dc62808e962a206d11e1b179a32f 

It works OK with gcc-4.9.3.
The question is whether to bump clover reqs or avoid using the feature.
Comment 5 Francisco Jerez 2016-07-24 23:27:20 UTC
Seems like a GCC bug...  You may be able to work around the issue by using the old-fashioned constructor call syntax with parentheses instead of braces to initialize the "fos" variable.
Comment 6 Dieter Nützel 2016-07-25 03:15:58 UTC
(In reply to Francisco Jerez from comment #5)
> Seems like a GCC bug...  You may be able to work around the issue by using
> the old-fashioned constructor call syntax with parentheses instead of braces
> to initialize the "fos" variable.

This one worked (see attachment).
 
OpenGL renderer string: Gallium 0.4 on AMD TURKS (DRM 2.43.0 / 4.6.4-6.g684e9e1-default, LLVM 4.0.0)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.1.0-devel (git-e7b2ce5)

opencl-example / run_tests.sh

Passed
71 passes, 0 fails
Comment 7 Dieter Nützel 2016-07-25 03:16:31 UTC
Created attachment 125305 [details] [review]
clover-llvm-codegen-native.cpp.patch
Comment 8 Francisco Jerez 2016-07-25 22:04:52 UTC
(In reply to Dieter Nützel from comment #6)
> (In reply to Francisco Jerez from comment #5)
> > Seems like a GCC bug...  You may be able to work around the issue by using
> > the old-fashioned constructor call syntax with parentheses instead of braces
> > to initialize the "fos" variable.
> 
> This one worked (see attachment).
>  
> OpenGL renderer string: Gallium 0.4 on AMD TURKS (DRM 2.43.0 /
> 4.6.4-6.g684e9e1-default, LLVM 4.0.0)
> OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.1.0-devel
> (git-e7b2ce5)
> 
> opencl-example / run_tests.sh
> 
> Passed
> 71 passes, 0 fails

Seems reasonable, would you mind sending the patch for review to the mailing list? (feel free to add me to the CC list)
Comment 9 Dieter Nützel 2016-07-27 22:33:58 UTC
REOPENED

until commit lands in Mesa git.
Comment 10 Francisco Jerez 2016-07-28 03:44:40 UTC
Should be fixed in master now.

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.