One laptop stopped compiling c++/opencl code. Not just one project, but multiple different c++/opencl projects.
The code itself compiles without issues on multiple other computers, and used to compile on this machine. Now it produces errors of the following kind when trying to compile c++/opencl programs:
<code>:~/Programming/OpenCL/OpenCLPractice/build$ make
Consolidate compiler generated dependencies of target juliaset
[ 50%] Building CXX object CMakeFiles/juliaset.dir/main.cpp.o
In file included from /home/nick/Programming/OpenCL/OpenCLPractice/main.cpp:1:
/usr/include/CL/opencl.hpp:437:112: note: ‘#pragma message: opencl.hpp: CL_HPP_TARGET_OPENCL_VERSION is not defined. It will default to 300 (OpenCL 3.0)’
437 | # pragma message("opencl.hpp: CL_HPP_TARGET_OPENCL_VERSION is not defined. It will default to 300 (OpenCL 3.0)")
| ^
In file included from /usr/include/c++/11/tr1/stdint.h:32,
from /usr/local/cuda/include/CL/cl_platform.h:252,
from /usr/local/cuda/include/CL/cl.h:23,
from /usr/local/cuda/include/CL/opencl.h:30,
from /usr/include/CL/opencl.hpp:530,
from /home/nick/Programming/OpenCL/OpenCLPractice/main.cpp:1:
/usr/include/c++/11/tr1/cstdint:64:11: error: ‘int8_t’ has not been declared in ‘::’
64 | using ::int8_t;
| ^~~~~~
/usr/include/c++/11/tr1/cstdint:65:11: error: ‘int16_t’ has not been declared in ‘::’
65 | using ::int16_t;
| ^~~~~~~
/usr/include/c++/11/tr1/cstdint:66:11: error: ‘int32_t’ has not been declared in ‘::’
66 | using ::int32_t;
| ^~~~~~~
</code>
<code>:~/Programming/OpenCL/OpenCLPractice/build$ make
Consolidate compiler generated dependencies of target juliaset
[ 50%] Building CXX object CMakeFiles/juliaset.dir/main.cpp.o
In file included from /home/nick/Programming/OpenCL/OpenCLPractice/main.cpp:1:
/usr/include/CL/opencl.hpp:437:112: note: ‘#pragma message: opencl.hpp: CL_HPP_TARGET_OPENCL_VERSION is not defined. It will default to 300 (OpenCL 3.0)’
437 | # pragma message("opencl.hpp: CL_HPP_TARGET_OPENCL_VERSION is not defined. It will default to 300 (OpenCL 3.0)")
| ^
In file included from /usr/include/c++/11/tr1/stdint.h:32,
from /usr/local/cuda/include/CL/cl_platform.h:252,
from /usr/local/cuda/include/CL/cl.h:23,
from /usr/local/cuda/include/CL/opencl.h:30,
from /usr/include/CL/opencl.hpp:530,
from /home/nick/Programming/OpenCL/OpenCLPractice/main.cpp:1:
/usr/include/c++/11/tr1/cstdint:64:11: error: ‘int8_t’ has not been declared in ‘::’
64 | using ::int8_t;
| ^~~~~~
/usr/include/c++/11/tr1/cstdint:65:11: error: ‘int16_t’ has not been declared in ‘::’
65 | using ::int16_t;
| ^~~~~~~
/usr/include/c++/11/tr1/cstdint:66:11: error: ‘int32_t’ has not been declared in ‘::’
66 | using ::int32_t;
| ^~~~~~~
</code>
:~/Programming/OpenCL/OpenCLPractice/build$ make
Consolidate compiler generated dependencies of target juliaset
[ 50%] Building CXX object CMakeFiles/juliaset.dir/main.cpp.o
In file included from /home/nick/Programming/OpenCL/OpenCLPractice/main.cpp:1:
/usr/include/CL/opencl.hpp:437:112: note: ‘#pragma message: opencl.hpp: CL_HPP_TARGET_OPENCL_VERSION is not defined. It will default to 300 (OpenCL 3.0)’
437 | # pragma message("opencl.hpp: CL_HPP_TARGET_OPENCL_VERSION is not defined. It will default to 300 (OpenCL 3.0)")
| ^
In file included from /usr/include/c++/11/tr1/stdint.h:32,
from /usr/local/cuda/include/CL/cl_platform.h:252,
from /usr/local/cuda/include/CL/cl.h:23,
from /usr/local/cuda/include/CL/opencl.h:30,
from /usr/include/CL/opencl.hpp:530,
from /home/nick/Programming/OpenCL/OpenCLPractice/main.cpp:1:
/usr/include/c++/11/tr1/cstdint:64:11: error: ‘int8_t’ has not been declared in ‘::’
64 | using ::int8_t;
| ^~~~~~
/usr/include/c++/11/tr1/cstdint:65:11: error: ‘int16_t’ has not been declared in ‘::’
65 | using ::int16_t;
| ^~~~~~~
/usr/include/c++/11/tr1/cstdint:66:11: error: ‘int32_t’ has not been declared in ‘::’
66 | using ::int32_t;
| ^~~~~~~
This example comes from building the small demo.
Here are the current g++ settings :
<code>$ echo | g++ -E -x c++ --verbose
Using built-in specs.
COLLECT_GCC=g++
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
</code>
<code>$ echo | g++ -E -x c++ --verbose
Using built-in specs.
COLLECT_GCC=g++
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
</code>
$ echo | g++ -E -x c++ --verbose
Using built-in specs.
COLLECT_GCC=g++
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
Can anyone suggest what might be causing this problem? and how to fix it?