From: FreeBSD U. <fr...@wa...> - 2023-12-17 11:47:37
|
Hello, tried to compile POCL-5.0-RC1 on top of the existing FreeBSD port lang/pocl (minor adaptions). On recent FreeBSD CURRENT (FreeBSD 15.0-CURRENT #11 main-n266974-6f3e9bac4d46: Sat Dec 16 17:40:52 CET 2023 amd64), with system compile llvm-17 (FreeBSD clang version 17.0.6 (https://github.com/llvm/llvm-project.git llvmorg-17.0.6-0-g6009708b4367)). The compilation bails out on the error: [...] [...] FAILED: lib/CL/devices/CMakeFiles/pocl-devices.dir/common.c.o /usr/bin/cc -DCL_HPP_TARGET_OPENCL_VERSION=300 -DCL_TARGET_OPENCL_VERSION=300 -DCL_USE_DEPRECATED_OPENCL_1_0_APIS -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_USE_DEPRECATED_OPENCL_2_0_APIS -DCL_USE_DEPRECATED_OPENCL_2_1_APIS -DCL_USE_DEPRECATED_OPENCL_2_2_APIS -I/usr/ports/lang/pocl/work/.build -I/usr/ports/lang/pocl/work/pocl-5.0-RC1/include -I/usr/ports/lang/pocl/work/pocl-5.0-RC1/include/hpp -I/usr/ports/lang/pocl/work/pocl-5.0-RC1/lib/CL/devices -I/usr/ports/lang/pocl/work/pocl-5.0-RC1/lib/CL/. -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -DNDEBUG -fPIC -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Wno-ignored-attributes -fvisibility=hidden -MD -MT lib/CL/devices/CMakeFiles/pocl-devices.dir/common.c.o -MF lib/CL/devices/CMakeFiles/pocl-devices.dir/common.c.o.d -o lib/CL/devices/CMakeFiles/pocl-devices.dir/common.c.o -c /usr/ports/lang/pocl/work/pocl-5.0-RC1/lib/CL/devices/common.c /usr/ports/lang/pocl/work/pocl-5.0-RC1/lib/CL/devices/common.c:1682:9: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] 1682 | char* kernellib_variant = pocl_get_distro_kernellib_variant (); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It seems (to me, non-developer) that the error occurs due to a missing const declaration in common.c, simply following the compiler's error message. The patch sketched below solves the problem for me on CURRENT. --- lib/CL/devices/common.c.orig 2023-12-15 17:48:18 UTC +++ lib/CL/devices/common.c @@ -1679,7 +1679,7 @@ pocl_init_default_device_infos (cl_device_id dev) strcat(kernellib, "-"); #ifdef KERNELLIB_HOST_DISTRO_VARIANTS - char* kernellib_variant = pocl_get_distro_kernellib_variant (); + const char* kernellib_variant = pocl_get_distro_kernellib_variant (); dev->llvm_cpu = pocl_get_distro_cpu_name (kernellib_variant); strcat(kernellib, kernellib_variant); if (!kernellib_variant) Thanks oh -- O. Hartmann |