Error compiling computecpp samples

Hello, I am trying to compile computecpp samples from guide in codeplay page. I did download and extract ComputeCpp-1.2.0-CentOS-x86_64 version from the official codeplay page

My installation environment:

Centos 7
Cmake 3.10.3
Gcc 7.3.0
OpenCl version 1.2

OpenCL is working great without computecpp

./computecpp_info
ComputeCpp Info (CE 1.2.0)

SYCL 1.2.1 revision 3


Toolchain information:

GLIBC version: 2.17
GLIBCXX: 20150623
This version of libstdc++ is supported.


Device Info:

Discovered 1 devices matching:
platform :
device type :


Device 0:

Device is supported : YES - Tested internally by Codeplay Software Ltd.
Bitcode targets : spir64
CL_DEVICE_NAME : Intel(R) Core™ i7-3770 CPU @ 3.40GHz
CL_DEVICE_VENDOR : Intel(R) Corporation
CL_DRIVER_VERSION : 1.2.0.475
CL_DEVICE_TYPE : CL_DEVICE_TYPE_CPU

If you encounter problems when using any of these OpenCL devices, please consult
this website for known issues:

cmake works well:

cmake …/ -DComputeCpp_DIR=/share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64 -DOpenCL_INCLUDE_DIR=/share/apps/devel/intel-opencl-SRB5.0/include/CL -DOpenCL_LIBRARY=/share/apps/devel/intel-opencl-SRB5.0/lib/libOpenCL.so

– The C compiler identification is GNU 7.3.0
– The CXX compiler identification is GNU 7.3.0
– Check for working C compiler: /share/apps/compilers/gcc-7.3.0/bin/gcc
– Check for working C compiler: /share/apps/compilers/gcc-7.3.0/bin/gcc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /share/apps/compilers/gcc-7.3.0/bin/g++
– Check for working CXX compiler: /share/apps/compilers/gcc-7.3.0/bin/g++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Looking for CL_VERSION_2_2
– Looking for CL_VERSION_2_2 - not found
– Looking for CL_VERSION_2_1
– Looking for CL_VERSION_2_1 - not found
– Looking for CL_VERSION_2_0
– Looking for CL_VERSION_2_0 - not found
– Looking for CL_VERSION_1_2
– Looking for CL_VERSION_1_2 - not found
– Looking for CL_VERSION_1_1
– Looking for CL_VERSION_1_1 - not found
– Looking for CL_VERSION_1_0
– Looking for CL_VERSION_1_0 - not found
– Found OpenCL: /share/apps/devel/intel-opencl-SRB5.0/lib/libOpenCL.so
– platform - your system can support ComputeCpp
– Found ComputeCpp: /share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64 (found version “CE 1.2.0”)
– compute++ flags - -O2;-mllvm;-inline-threshold=1000;-intelspirmetadata;-sycl-target;spir64
– Configuring done
– Generating done
– Build files have been written to: /home/edvinas/computecpp-sdk/build

But problem happens when I run make command:

make

Scanning dependencies of target vptr_vptr.cpp_0_ih
[ 1%] Building ComputeCpp integration header file /home/edvinas/computecpp-sdk/build/samples/vptr_vptr.cpp.sycl
remark: [Computecpp:CC0027]: Some memcpy/memset intrinsics added by the llvm optimizer were replaced by serial
functions. This is a workaround for OpenCL drivers that do not support those intrinsics. This may impact
performance, consider using -no-serial-memop. [-Rsycl-serial-memop]
[ 1%] Built target vptr_vptr.cpp_0_ih
Scanning dependencies of target vptr
[ 2%] Building CXX object samples/CMakeFiles/vptr.dir/vptr.cpp.o
In file included from /home/edvinas/computecpp-sdk/samples/vptr.cpp:33:0:
/home/edvinas/computecpp-sdk/include/vptr/virtual_ptr.hpp: In member function ‘cl::sycl::buffer<buffer_data_type, 1> cl::sycl::codeplay::PointerMapper::get_buffer(cl::sycl::codeplay::PointerMapper::virtual_pointer_t)’:
/home/edvinas/computecpp-sdk/include/vptr/virtual_ptr.hpp:238:64: warning: typedef ‘using sycl_buffer_t = class cl::sycl::buffer<buffer_data_type, 1>’ locally defined but not used [-Wunused-local-typedefs]
using sycl_buffer_t = cl::sycl::buffer<buffer_data_type, 1>;
^
[ 3%] Linking CXX executable vptr
CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::program cl::sycl::program::create_program_for_kernel<init_a>(cl::sycl::context)': vptr.cpp:(.text._ZN2cl4sycl7program25create_program_for_kernelI6init_aEES1_NS0_7contextE[_ZN2cl4sycl7program25create_program_for_kernelI6init_aEES1_NS0_7contextE]+0x2a0): undefined reference to cl::sycl::program::create_program_for_kernel_impl(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, unsigned char const*, int, char const* const*, std::shared_ptrcl::sycl::detail::context, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)’
CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::kernel cl::sycl::program::get_kernel<init_a>() const': vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI6init_aEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI6init_aEENS0_6kernelEv]+0x59): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) const’
vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI6init_aEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI6init_aEENS0_6kernelEv]+0xae): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) const' CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::program cl::sycl::program::create_program_for_kernel<init_b>(cl::sycl::context)‘:
vptr.cpp:(.text._ZN2cl4sycl7program25create_program_for_kernelI6init_bEES1_NS0_7contextE[_ZN2cl4sycl7program25create_program_for_kernelI6init_bEES1_NS0_7contextE]+0x2a0): undefined reference to cl::sycl::program::create_program_for_kernel_impl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned char const*, int, char const* const*, std::shared_ptr<cl::sycl::detail::context>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::kernel cl::sycl::program::get_kernel<init_b>() const’:
vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI6init_bEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI6init_bEENS0_6kernelEv]+0x59): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) const' vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI6init_bEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI6init_bEENS0_6kernelEv]+0xae): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) const’
CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::program cl::sycl::program::create_program_for_kernel<matrix_add>(cl::sycl::context)': vptr.cpp:(.text._ZN2cl4sycl7program25create_program_for_kernelI10matrix_addEES1_NS0_7contextE[_ZN2cl4sycl7program25create_program_for_kernelI10matrix_addEES1_NS0_7contextE]+0x2a0): undefined reference to cl::sycl::program::create_program_for_kernel_impl(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, unsigned char const*, int, char const* const*, std::shared_ptrcl::sycl::detail::context, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)’
CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::kernel cl::sycl::program::get_kernel<matrix_add>() const': vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI10matrix_addEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI10matrix_addEENS0_6kernelEv]+0x59): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) const’
vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI10matrix_addEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI10matrix_addEENS0_6kernelEv]+0xae): undefined reference to `cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) const’
collect2: error: ld returned 1 exit status
make[2]: *** [samples/vptr] Error 1
make[1]: *** [samples/CMakeFiles/vptr.dir/all] Error 2
make: *** [all] Error 2

I tried different versions with no luck. Will be happy to get some ideas. Thank you :slight_smile:

Hi and welcome,
This looks like an ABI mismatch that we have seen before. See the previous report.
Can you try setting -D_GLIBCXX_USE_CXX11_ABI=1 in CMake?
Let me know how you get on,
Rod

Thank for your quick response although what I changed wasnt used:

cmake …/ -DComputeCpp_DIR=/share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64 -DOpenCL_INCLUDE_DIR=/share/apps/devel/intel-opencl-SRB5.0/include/CL -DOpenCL_LIBRARY=/share/apps/devel/intel-opencl-SRB5.0/lib/libOpenCL.so -D_GLIBCXX_USE_CXX11_ABI=1

– The C compiler identification is GNU 7.3.0
– The CXX compiler identification is GNU 7.3.0
– Check for working C compiler: /share/apps/compilers/gcc-7.3.0/bin/gcc
– Check for working C compiler: /share/apps/compilers/gcc-7.3.0/bin/gcc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /share/apps/compilers/gcc-7.3.0/bin/g++
– Check for working CXX compiler: /share/apps/compilers/gcc-7.3.0/bin/g++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Looking for CL_VERSION_2_2
– Looking for CL_VERSION_2_2 - not found
– Looking for CL_VERSION_2_1
– Looking for CL_VERSION_2_1 - not found
– Looking for CL_VERSION_2_0
– Looking for CL_VERSION_2_0 - not found
– Looking for CL_VERSION_1_2
– Looking for CL_VERSION_1_2 - not found
– Looking for CL_VERSION_1_1
– Looking for CL_VERSION_1_1 - not found
– Looking for CL_VERSION_1_0
– Looking for CL_VERSION_1_0 - not found
– Found OpenCL: /share/apps/devel/intel-opencl-SRB5.0/lib/libOpenCL.so
– platform - your system can support ComputeCpp
– Found ComputeCpp: /share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64 (found version “CE 1.2.0”)
– compute++ flags - -O2;-mllvm;-inline-threshold=1000;-intelspirmetadata;-sycl-target;spir64
– Configuring done
– Generating done
CMake Warning:
Manually-specified variables were not used by the project:

_GLIBCXX_USE_CXX11_ABI

And make returns same error :frowning:

Okay. I changed cmake line one more time:

cmake …/ -DComputeCpp_DIR=/share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64 -DOpenCL_INCLUDE_DIR=/share/apps/devel/intel-opencl-SRB5.0/include/CL -DOpenCL_LIBRARY=/share/apps/devel/intel-opencl-SRB5.0/lib/libOpenCL.so -DCMAKE_CXX_FLAGS=’-D_GLIBCXX_USE_CXX11_ABI=1’

and now it looks like flag was used, but unfortunately it didnt let make pass this error:

Scanning dependencies of target vptr_vptr.cpp_0_ih
[ 1%] Building ComputeCpp integration header file /home/edvinas/computecpp-sdk/build/samples/vptr_vptr.cpp.sycl
remark: [Computecpp:CC0027]: Some memcpy/memset intrinsics added by the llvm optimizer were replaced by serial
functions. This is a workaround for OpenCL drivers that do not support those intrinsics. This may impact
performance, consider using -no-serial-memop. [-Rsycl-serial-memop]
[ 1%] Built target vptr_vptr.cpp_0_ih
Scanning dependencies of target vptr
[ 2%] Building CXX object samples/CMakeFiles/vptr.dir/vptr.cpp.o
In file included from /home/edvinas/computecpp-sdk/samples/vptr.cpp:33:0:
/home/edvinas/computecpp-sdk/include/vptr/virtual_ptr.hpp: In member function ‘cl::sycl::buffer<buffer_data_type, 1> cl::sycl::codeplay::PointerMapper::get_buffer(cl::sycl::codeplay::PointerMapper::virtual_pointer_t)’:
/home/edvinas/computecpp-sdk/include/vptr/virtual_ptr.hpp:238:64: warning: typedef ‘using sycl_buffer_t = class cl::sycl::buffer<buffer_data_type, 1>’ locally defined but not used [-Wunused-local-typedefs]
using sycl_buffer_t = cl::sycl::buffer<buffer_data_type, 1>;
^
[ 3%] Linking CXX executable vptr
CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::program cl::sycl::program::create_program_for_kernel<init_a>(cl::sycl::context)': vptr.cpp:(.text._ZN2cl4sycl7program25create_program_for_kernelI6init_aEES1_NS0_7contextE[_ZN2cl4sycl7program25create_program_for_kernelI6init_aEES1_NS0_7contextE]+0x2a0): undefined reference to cl::sycl::program::create_program_for_kernel_impl(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, unsigned char const*, int, char const* const*, std::shared_ptrcl::sycl::detail::context, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)’
CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::kernel cl::sycl::program::get_kernel<init_a>() const': vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI6init_aEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI6init_aEENS0_6kernelEv]+0x59): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) const’
vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI6init_aEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI6init_aEENS0_6kernelEv]+0xae): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) const' CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::program cl::sycl::program::create_program_for_kernel<init_b>(cl::sycl::context)’:
vptr.cpp:(.text._ZN2cl4sycl7program25create_program_for_kernelI6init_bEES1_NS0_7contextE[_ZN2cl4sycl7program25create_program_for_kernelI6init_bEES1_NS0_7contextE]+0x2a0): undefined reference to cl::sycl::program::create_program_for_kernel_impl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned char const*, int, char const* const*, std::shared_ptr<cl::sycl::detail::context>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::kernel cl::sycl::program::get_kernel<init_b>() const’:
vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI6init_bEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI6init_bEENS0_6kernelEv]+0x59): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) const' vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI6init_bEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI6init_bEENS0_6kernelEv]+0xae): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) const’
CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::program cl::sycl::program::create_program_for_kernel<matrix_add>(cl::sycl::context)': vptr.cpp:(.text._ZN2cl4sycl7program25create_program_for_kernelI10matrix_addEES1_NS0_7contextE[_ZN2cl4sycl7program25create_program_for_kernelI10matrix_addEES1_NS0_7contextE]+0x2a0): undefined reference to cl::sycl::program::create_program_for_kernel_impl(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, unsigned char const*, int, char const* const*, std::shared_ptrcl::sycl::detail::context, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)’
CMakeFiles/vptr.dir/vptr.cpp.o: In function cl::sycl::kernel cl::sycl::program::get_kernel<matrix_add>() const': vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI10matrix_addEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI10matrix_addEENS0_6kernelEv]+0x59): undefined reference to cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) const’
vptr.cpp:(.text._ZNK2cl4sycl7program10get_kernelI10matrix_addEENS0_6kernelEv[_ZNK2cl4sycl7program10get_kernelI10matrix_addEENS0_6kernelEv]+0xae): undefined reference to `cl::sycl::program::get_kernel(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) const’
collect2: error: ld returned 1 exit status
make[2]: *** [samples/vptr] Error 1
make[1]: *** [samples/CMakeFiles/vptr.dir/all] Error 2
make: *** [all] Error 2

Apologies, my information was not totally correct.The solutions available can be found in my colleague’s post Can't build samples w/ ptx64 backend

The variable I specified needs to be passed to the compiler rather than CMake so needs to be set using

target_compile_definitions(simple-vector-add PRIVATE _GLIBCXX_USE_CXX11_ABI=0)

for example

I should put target_compile_definitions(simple-vector-add PRIVATE _GLIBCXX_USE_CXX11_ABI=1) line in computecpp-sdk/CMakeLists.txt file?

cmake_minimum_required(VERSION 3.4.3)

project(ComputeCpp-SDK)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
find_package(ComputeCpp REQUIRED)

option(COMPUTECPP_SDK_USE_OPENMP “Enable OpenMP support in samples” OFF)
option(COMPUTECPP_SDK_BUILD_TESTS “Build the tests for the header utilities in include/” OFF)
target_compile_definitions(simple-vector-add PRIVATE _GLIBCXX_USE_CXX11_ABI=0)

set(CMAKE_CXX_STANDARD 14)
enable_testing()

add_subdirectory(samples)
if(COMPUTECPP_SDK_BUILD_TESTS)
add_subdirectory(tests)
endif()

Yes adding that command to the CMakeLists.txt file should do it.

Hmmm. No matter where I put your mentioned line I get same problem

This is my output now
" cmake …/ -DComputeCpp_DIR=/share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64 -DOpenCL_INCLUDE_DIR=/share/apps/devel/intel-opencl-SRB5.0/include/CL -DOpenCL_LIBRARY=/share/apps/devel/intel-opencl-SRB5.0/lib/libOpenCL.so"

CMake Error at CMakeLists.txt:8 (target_compile_definitions):
  Cannot specify compile definitions for target "simple-vector-add" which is
  not built by this project.

My CMakeLists.txt file looks like this:

cmake_minimum_required(VERSION 3.4.3)

project(ComputeCpp-SDK)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
find_package(ComputeCpp REQUIRED)

target_compile_definitions(simple-vector-add PRIVATE _GLIBCXX_USE_CXX11_ABI=0)

option(COMPUTECPP_SDK_USE_OPENMP "Enable OpenMP support in samples" OFF)
option(COMPUTECPP_SDK_BUILD_TESTS "Build the tests for the header utilities in include/" OFF)


set(CMAKE_CXX_STANDARD 14)
enable_testing()

add_subdirectory(samples)
if(COMPUTECPP_SDK_BUILD_TESTS)
  add_subdirectory(tests)
endif()

Ok I see, you are adding this to the top level CMakeLists in the samples. So in that top level file you need to replace your new command with this one on the same line:

add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)

So to be clear in the post I linked to there are three options, the one you tried to do there is adding to a specific target CMakeLists file. The other two options are to do what I suggest in this post or add this to the CMake toolchain file.

Thank you!!! It went through, but now I have another issue:

Building ComputeCpp integration header file /home/edvinas/computecpp-sdk/build/samples/ivka_ivka.cpp.sycl
In file included from /home/edvinas/computecpp-sdk/samples/ivka.cpp:29:
/home/edvinas/computecpp-sdk/include/ivka/ivka.hpp:62:49: error: no member named 'is_trivially_copyable' in
      namespace 'std'
      std::is_standard_layout<T>::value && std::is_trivially_copyable<T>::value;
                                           ~~~~~^
/home/edvinas/computecpp-sdk/include/ivka/ivka.hpp:62:71: error: 'T' does not refer to a value
      std::is_standard_layout<T>::value && std::is_trivially_copyable<T>::value;
                                                                      ^
/home/edvinas/computecpp-sdk/include/ivka/ivka.hpp:59:20: note: declared here
template <typename T, typename U = void>
                   ^
/home/edvinas/computecpp-sdk/include/ivka/ivka.hpp:62:75: error: no member named 'value' in the global namespace
      std::is_standard_layout<T>::value && std::is_trivially_copyable<T>::value;
                                                                        ~~^
/home/edvinas/computecpp-sdk/samples/ivka.cpp:47:15: error: value of type 'const auto' is not contextually
      convertible to 'bool'
static_assert(is_valid_kernel_arg<double>::value, "");
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/edvinas/computecpp-sdk/samples/ivka.cpp:48:15: error: value of type 'const auto' is not contextually
      convertible to 'bool'
static_assert(is_valid_kernel_arg<Foo>::value, "");
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/edvinas/computecpp-sdk/samples/ivka.cpp:49:15: error: invalid argument type 'auto' to unary expression
static_assert(!is_valid_kernel_arg<Bar>::value, "");
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/edvinas/computecpp-sdk/samples/ivka.cpp:50:15: error: invalid argument type 'auto' to unary expression
static_assert(!is_valid_kernel_arg<cl::sycl::queue>::value, "");
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 errors generated.

All in all, I ignored ivka.cpp by using make -k command and ran simple-vector-add binary in sample directory. So as far as I understand I am good to go. Command make fails only on ivka. Do you think it will not be a problem in a future?

Hi,
The sample you reference is using C++11 features and the compiler you have installed doesn’t support C++11. So you can run the rest of the samples, but this one will fail to compile.
You could upgrade your version of gcc to ensure your compiler supports the C++11 features needed for SYCL code. This would mean the other sample will compile.
So yes you may come across this again in compiling code if it uses C++11 features.
Thanks.

That is interesting, because in the post you linked to user had the same problem as I do even if using gcc 8.2 version (which is newer than my 7.3.0 obviously). The answer from earlier mentioned post was to try to use ubuntu computecpp source. Do you have any clue which version of gcc is tested to properly support C++11 features needed by SYCL code?

Hi @edvinas31, the feature was added in GCC 5 as far as I remember. It appears, however, that compute++ is only seeing an older version of the standard library. Is your GCC installed to a non-standard location? You can find out where compute++ is looking for headers by running something like echo "" | compute++ -x c++ -v -. Then we can see if it is unable to locate the more recent GCC that you are using for host compilation.

Hello, @duncan :slight_smile: My gcc 7.3.0 compiler is installed to a non-standart location (/share/apps/compilers/gcc-7.3.0). I ran echo "" | compute++ -x c++ -v - and as far I understand it is really using default gcc 4.8.5 headers from command output:

Codeplay ComputeCpp - CE 1.2.0 Device Compiler - clang version 7.0.0  (based on LLVM 7.0.0svn)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64/bin/compute++" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64/lib/clang/7.0.0 -I/share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64/include -I/share/apps/devel/intel-opencl-SRB5.0/include -I/share/apps/compilers/gcc-7.3.0/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward -internal-isystem /usr/local/include -internal-isystem /share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64/lib/clang/7.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/edvinas -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/--3a0b3d.o -x c++ - -faddrsig
clang -cc1 version 7.0.0 based upon LLVM 7.0.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64/include
 /share/apps/devel/intel-opencl-SRB5.0/include
 /share/apps/compilers/gcc-7.3.0/include
 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5
 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward
 /usr/local/include
 /share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64/lib/clang/7.0.0/include
 /usr/include
End of search list.
 "/usr/bin/ld" --hash-style=gnu --no-add-needed --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. -L/share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64/bin/../lib -L/lib -L/usr/lib /tmp/--3a0b3d.o -L/share/apps/devel/ComputeCpp-CE-1.2.0-CentOS-x86_64/lib -L/share/apps/devel/intel-opencl-SRB5.0/aditional -L/share/apps/devel/intel-opencl-SRB5.0/lib -L/share/apps/compilers/gcc-7.3.0/lib64 -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
compute++: error: linker command failed with exit code 1 (use -v to see invocation

I did install gcc 7.3.0 and set environment paths like PATH, CPATH (headers), LD_LIBRARY_PATH, LIBRARY_PATH, CFLAGS, LDFLAGS, CC, CXX and gcc is working with no issues at all.
What should I change that computecpp++ whould use headers of gcc 7.3.0 instead of gcc 4.8.5?

So you should be able to tell compute++ to use your preferred GCC toolchain with the flag --gcc-toolchain. The easiest way to do this is through CMake, there is a variable called COMPUTECPP_USER_FLAGS which is designed to allow users to set their own custom arguments. It might look something like:
cmake -DCOMPUTECPP_USER_FLAGS="--gcc-toolchain=/share/apps/compilers/gcc-7.3.0"

Let me know if that doesn’t work.

Everything is working fine now. Thank you :slight_smile: