Bug 56140

Summary: [Mesa-current] [clover] build failure in clvover/api/transfer.cpp
Product: Mesa Reporter: Dmitry Cherkassov <dcherkassov>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: clover_simplify_is_zero.patch

Description Dmitry Cherkassov 2012-10-18 14:19:08 UTC
Mesa-current fails to build.

with HEAD at aa2067c757506e8f3418ef11333382a1fa45ad6e
( gallivm: Hide AVX support when requested by LP_NATIVE_VECTOR_WIDTH or unsupported by LLVM. )

build log:
============================================================================

make[3]: Entering directory `/home/dc/src/mesa-cur/src/gallium/targets/opencl'
  CXXLD  libOpenCL.la

*** Warning: Linking the shared library libOpenCL.la against the
*** static library ../../../../src/gallium/auxiliary/libgallium.a is not portable!

*** Warning: Linking the shared library libOpenCL.la against the
*** static library ../../../../src/gallium/auxiliary/pipe-loader/libpipe_loader.a is not portable!

*** Warning: Linking the shared library libOpenCL.la against the
*** static library ../../../../src/gallium/winsys/sw/null/libws_null.a is not portable!
../../../../src/gallium/state_trackers/clover/.libs/libclover.a(lt8-libclover_la-kernel.o): In function `operator()':
/home/dc/src/mesa-cur/src/gallium/state_trackers/clover/./core/base.hpp:280: multiple definition of `std::function<bool (_cl_event* const&)> clover::is_zero<_cl_event*>()::{lambda(_cl_event* const&)#1}::_FUN(_cl_event* const&)'
../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclover_la-transfer.o):/home/dc/src/mesa-cur/src/gallium/state_trackers/clover/./core/base.hpp:280: first defined here
../../../../src/gallium/state_trackers/clover/.libs/libclover.a(lt8-libclover_la-kernel.o): In function `std::function<bool (_cl_event* const&)> clover::is_zero<_cl_event*>()::{lambda(_cl_event* const&)#1}::operator bool (*)(_cl_event* const&)() const':
/home/dc/src/mesa-cur/src/gallium/state_trackers/clover/./core/base.hpp:278: multiple definition of `std::function<bool (_cl_event* const&)> clover::is_zero<_cl_event*>()::{lambda(_cl_event* const&)#1}::operator bool (*)(_cl_event* const&)() const'
../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclover_la-transfer.o):/home/dc/src/mesa-cur/src/gallium/state_trackers/clover/./core/base.hpp:278: first defined here
collect2: error: ld returned 1 exit status
make[3]: *** [libOpenCL.la] Error 1
make[3]: Leaving directory `/home/dc/src/mesa-cur/src/gallium/targets/opencl'
make[2]: *** [default] Error 1
make[2]: Leaving directory `/home/dc/src/mesa-cur/src/gallium/targets'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dc/src/mesa-cur/src'
make: *** [all-recursive] Error 1

Additional info:
===============================

$ uname -a:

Linux radeondevel 3.6.0-rc4+ #3 SMP Tue Sep 18 20:12:37 MSK 2012 x86_64 GNU/Linux

$ gcc -v:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.1-2' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.1 (Debian 4.7.1-2) 

./configure invocation:

PKG_CONFIG_PATH=/opt/lib/pkgconfig ./autogen.sh --with-dri-drivers=""
--prefix=/opt --with-gallium-drivers=r600 --with-llvm-prefix=/opt
--enable-opencl --with-libclc-path=/opt 

./configure output:

>         prefix:          /opt
>         exec_prefix:     ${prefix}
>         libdir:          ${exec_prefix}/lib
>         includedir:      ${prefix}/include
>
>         OpenGL:          yes (ES1: no ES2: no)
>         OpenVG:          no
>
>         OSMesa:          no
>         DRI drivers:     no
>         DRI driver dir:  ${libdir}/dri
>         GLX:             DRI-based
>
>         EGL:             yes
>         EGL platforms:   x11
>         EGL drivers:     builtin:egl_glx builtin:egl_dri2
>
>         llvm:            yes
>         llvm-config:     /opt/bin/llvm-config
>         llvm-version:    3.2
>
>         Gallium:         yes
>         Gallium dirs:    auxiliary drivers state_trackers
>         Target dirs:     dri-r600 opencl
>         Winsys dirs:     radeon/drm sw sw/dri sw/null
>         Driver dirs:     galahad identity noop r600 rbug trace
>         Trackers dirs:   clover dri
>
>         Shared libs:     yes
>         Static libs:     no
>         Shared-glapi:    yes
>
>         CFLAGS:          -g -O2 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -fPIC
>         CXXFLAGS:        -g -O2 -Wall -fno-strict-aliasing -fno-builtin-memcmp -fPIC
>         Macros:          -D_GNU_SOURCE -DUSE_X86_64_ASM -DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -DIN_DRI_DRIVER -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_LLVM=0x0302
>
>         PYTHON2:         python
>
>         Run 'make' to build Mesa
>

Thanks.
Comment 1 Dmitry Cherkassov 2012-10-18 14:45:55 UTC
that dirty patch makes it at least compile

diff --git a/src/gallium/state_trackers/clover/api/transfer.cpp b/src/gallium/state_trackers/clover/api/transfer.cpp
index 8ea8f86..10b454b 100644
--- a/src/gallium/state_trackers/clover/api/transfer.cpp
+++ b/src/gallium/state_trackers/clover/api/transfer.cpp
@@ -39,8 +39,7 @@ namespace {
       if (!q)
          throw error(CL_INVALID_COMMAND_QUEUE);
 
-      if (bool(num_deps) != bool(deps) ||
-          any_of(is_zero<cl_event>(), deps, deps + num_deps))
+      if (bool(num_deps) != bool(deps))
          throw error(CL_INVALID_EVENT_WAIT_LIST);
 
       if (any_of([&](const cl_event ev) {
Comment 2 Francisco Jerez 2012-10-19 09:29:16 UTC
Created attachment 68790 [details] [review]
clover_simplify_is_zero.patch

(In reply to comment #0)
> ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(lt8-
> libclover_la-kernel.o): In function `operator()':
> /home/dc/src/mesa-cur/src/gallium/state_trackers/clover/./core/base.hpp:280:
> multiple definition of `std::function<bool (_cl_event* const&)>
> clover::is_zero<_cl_event*>()::{lambda(_cl_event*
> const&)#1}::_FUN(_cl_event* const&)'
> ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclover_la-
> transfer.o):/home/dc/src/mesa-cur/src/gallium/state_trackers/clover/./core/
> base.hpp:280: first defined here
> ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(lt8-
> libclover_la-kernel.o): In function `std::function<bool (_cl_event* const&)>
> clover::is_zero<_cl_event*>()::{lambda(_cl_event* const&)#1}::operator bool
> (*)(_cl_event* const&)() const':
> /home/dc/src/mesa-cur/src/gallium/state_trackers/clover/./core/base.hpp:278:
> multiple definition of `std::function<bool (_cl_event* const&)>
> clover::is_zero<_cl_event*>()::{lambda(_cl_event* const&)#1}::operator bool
> (*)(_cl_event* const&)() const'
> ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclover_la-
> transfer.o):/home/dc/src/mesa-cur/src/gallium/state_trackers/clover/./core/
> base.hpp:278: first defined here

This looks like a compiler bug.  Maybe [1]?  In any case the attached patch should work around it, can you try it out please?

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53821
Comment 3 Dmitry Cherkassov 2012-10-19 10:13:31 UTC
it compiles OK with your patch. thank you.
will it be commited?
Comment 4 Francisco Jerez 2012-10-19 10:42:57 UTC
(In reply to comment #3)
> it compiles OK with your patch. thank you.
> will it be commited?

OK, pushed.  Marking as fixed...

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.