Bug 93687

Summary: ppc64el:Gallium / clover fails to compile
Product: Mesa Reporter: Timothy Pearson <kb9vqf>
Component: Drivers/Gallium/r600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED DUPLICATE QA Contact: Default DRI bug account <dri-devel>
Severity: major    
Priority: medium CC: currojerez
Version: 11.0   
Hardware: PowerPC   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: clover_workaround_altivec_madness.patch

Description Timothy Pearson 2016-01-13 01:49:20 UTC
Gallium fails to compile on ppc64el.  This prevens the use of the R600 OpenCL driver on the ppc64el platform.

Full log:
https://librarian.quickbuild.pearsoncomputing.net/7108453/buildlog_ubuntu-stretch-ppc64el.mesa_11.0.8-1~icd-ppc64el-enable1_FAILEDTOBUILD.txt.gz

Relevant snippet:
/bin/bash ../../../../libtool  --tag=CXX   --mode=compile g++ -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"11.0.8\" -DPACKAGE_STRING=\"Mesa\ 11.0.8\" -DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi\?product=Mesa\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"11.0.8\" -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_UNUSED=1 -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1 -DHAVE_DLADDR=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD=1 -I. -I../../../../../../src/gallium/state_trackers/clover  -DHAVE_PIPE_LOADER_DRI -DHAVE_PIPE_LOADER_DRM -DPIPE_SEARCH_DIR=\"/usr/lib/powerpc64le-linux-gnu/gallium-pipe\" -I../../../../../../include -I../../../../../../src -I../../../../../../src/gallium/include -I../../../../../../src/gallium/drivers -I../../../../../../src/gallium/auxiliary -I../../../../../../src/gallium/winsys -I../../../../../../src/gallium/state_trackers/clover -DHAVE_CLOVER_ICD -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++11 -fvisibility=hidden -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wall -fno-strict-aliasing -fno-builtin-memcmp  -MT api/libclover_la-program.lo -MD -MP -MF api/.deps/libclover_la-program.Tpo -c -o api/libclover_la-program.lo `test -f 'api/program.cpp' || echo '../../../../../../src/gallium/state_trackers/clover/'`api/program.cpp
libtool: compile:  g++ -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"11.0.8\" "-DPACKAGE_STRING=\"Mesa 11.0.8\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"11.0.8\" -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_UNUSED=1 -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1 -DHAVE_DLADDR=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD=1 -I. -I../../../../../../src/gallium/state_trackers/clover -DHAVE_PIPE_LOADER_DRI -DHAVE_PIPE_LOADER_DRM -DPIPE_SEARCH_DIR=\"/usr/lib/powerpc64le-linux-gnu/gallium-pipe\" -I../../../../../../include -I../../../../../../src -I../../../../../../src/gallium/include -I../../../../../../src/gallium/drivers -I../../../../../../src/gallium/auxiliary -I../../../../../../src/gallium/winsys -I../../../../../../src/gallium/state_trackers/clover -DHAVE_CLOVER_ICD -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++11 -fvisibility=hidden -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wall -fno-strict-aliasing -fno-builtin-memcmp -MT api/libclover_la-program.lo -MD -MP -MF api/.deps/libclover_la-program.Tpo -c ../../../../../../src/gallium/state_trackers/clover/api/program.cpp  -fPIC -DPIC -o api/.libs/libclover_la-program.o
In file included from /usr/include/c++/5/map:60:0,
                 from ../../../../../../src/gallium/state_trackers/clover/core/property.hpp:26,
                 from ../../../../../../src/gallium/state_trackers/clover/api/util.hpp:30,
                 from ../../../../../../src/gallium/state_trackers/clover/api/context.cpp:23:
/usr/include/c++/5/bits/stl_tree.h: In constructor 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Rb_tree(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&&, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Node_allocator&&)':
/usr/include/c++/5/bits/stl_tree.h:1332:76: error: '__vector(4) __bool int' is not a valid type for a template non-type parameter
       using __eq = integral_constant<bool, _Alloc_traits::_S_always_equal()>;
                                                                            ^
/usr/include/c++/5/bits/stl_tree.h:1334:25: error: there are no arguments to '__eq' that depend on a template parameter, so a declaration of '__eq' must be available [-fpermissive]
  _M_move_data(__x, __eq());
                         ^
/usr/include/c++/5/bits/stl_tree.h:1334:25: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
Comment 1 Francisco Jerez 2016-01-13 02:38:47 UTC
Created attachment 120997 [details] [review]
clover_workaround_altivec_madness.patch
Comment 2 Francisco Jerez 2016-01-13 02:39:16 UTC
The error is caused by the altivec.h system header (included on PPC systems by Khronos' CL headers we cannot change) which redefines standard C++ keywords.  You may be able to use the attached hack to work around the issue, sigh...
Comment 3 Timothy Pearson 2016-01-13 06:43:06 UTC
Since this is marked NOTOURBUG, is there somewhere I should be submitting a bug report to get this fixed?  I'd really like to see OpenCL on the OpenPOWER hardware without having to manually patch / build, and without having to get a downstream patch into Debian / RHEL.

Thanks!
Comment 4 Francisco Jerez 2016-01-14 03:17:39 UTC
(In reply to Timothy Pearson from comment #3)
> Since this is marked NOTOURBUG, is there somewhere I should be submitting a
> bug report to get this fixed?  I'd really like to see OpenCL on the
> OpenPOWER hardware without having to manually patch / build, and without
> having to get a downstream patch into Debian / RHEL.
> 
> Thanks!

Either GCC or Khronos -- I'd be inclined to blame GCC for this, since the altivec.h header is unusable from standard C++ code (assuming you don't hack around it by undef'ing "vector" and "bool" after inclusion or by preventing it from defining them in the first place somehow), however last time somebody reported this [1] the bug was closed as invalid, so apparently some people from the GCC community think that this is the (unfortunate) expected behaviour -- Assuming they're right, cl_platform.h should stop including altivec.h (or hack around it somehow) because it makes cl.h unusable from standard C++ code on PPC platforms.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58241
Comment 5 Timothy Pearson 2016-01-14 16:48:48 UTC
Bug reported here:
https://www.khronos.org/bugzilla/show_bug.cgi?id=1449

Thanks for the hint, and link to the GCC bug report!
Comment 6 Andreas Boll 2017-03-07 10:31:32 UTC

*** This bug has been marked as a duplicate of bug 68504 ***

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.