Skip to content

[BUG] Disabling OpenCL has no effect, it is still forced and breaks the build when OpenCL is unsupported #939

@barracuda156

Description

@barracuda156

Passing -DENABLE_OPENCL=OFF to CMake is ignored: OpenCL is still used, which breaks the build whenever OpenCL is not actually supported by the OS:

In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:5:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:19:23: error: 'clGetPlatformIDs' undeclared here (not in a function); did you mean 'clGetPlatformInfo'?
   19 |     FF_LIBRARY_SYMBOL(clGetPlatformIDs)
      |                       ^~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/common/library.h:32:17: note: in definition of macro 'FF_LIBRARY_SYMBOL'
   32 |     __typeof__(&symbolName) ff ## symbolName;
      |                 ^~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c: In function 'openCLHandleData':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:26:5: error: unknown type name 'cl_platform_id'; did you mean 'cl_platform_info'?
   26 |     cl_platform_id platformID = NULL;
      |     ^~~~~~~~~~~~~~
      |     cl_platform_info
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:26:33: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Werror=int-conversion]
   26 |     cl_platform_id platformID = NULL;
      |                                 ^~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:28:5: error: called object is not a function or function pointer
   28 |     data->ffclGetPlatformIDs(1, &platformID, &numPlatforms);
      |     ^~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:35:28: warning: conversion to 'cl_device_type' {aka 'unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
   35 |     data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_GPU, 1, &deviceID, &numDevices);
      |                            ^~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:35:60: error: passing argument 3 of 'data->ffclGetDeviceIDs' makes pointer from integer without a cast [-Werror=int-conversion]
   35 |     data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_GPU, 1, &deviceID, &numDevices);
      |                                                            ^
      |                                                            |
      |                                                            int
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:35:60: note: expected 'struct _cl_device_id **' but argument is of type 'int'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:35:63: error: passing argument 4 of 'data->ffclGetDeviceIDs' from incompatible pointer type [-Werror=incompatible-pointer-types]
   35 |     data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_GPU, 1, &deviceID, &numDevices);
      |                                                               ^~~~~~~~~
      |                                                               |
      |                                                               struct _cl_device_id **
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:35:63: note: expected 'cl_uint *' {aka 'unsigned int *'} but argument is of type 'struct _cl_device_id **'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:35:5: error: too many arguments to function 'data->ffclGetDeviceIDs'
   35 |     data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_GPU, 1, &deviceID, &numDevices);
      |     ^~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:38:32: warning: conversion to 'cl_device_type' {aka 'unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
   38 |         data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_ALL, 1, &deviceID, &numDevices);
      |                                ^~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:38:64: error: passing argument 3 of 'data->ffclGetDeviceIDs' makes pointer from integer without a cast [-Werror=int-conversion]
   38 |         data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_ALL, 1, &deviceID, &numDevices);
      |                                                                ^
      |                                                                |
      |                                                                int
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:38:64: note: expected 'struct _cl_device_id **' but argument is of type 'int'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:38:67: error: passing argument 4 of 'data->ffclGetDeviceIDs' from incompatible pointer type [-Werror=incompatible-pointer-types]
   38 |         data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_ALL, 1, &deviceID, &numDevices);
      |                                                                   ^~~~~~~~~
      |                                                                   |
      |                                                                   struct _cl_device_id **
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:38:67: note: expected 'cl_uint *' {aka 'unsigned int *'} but argument is of type 'struct _cl_device_id **'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_fastfetch/fastfetch/work/fastfetch-2.12.0/src/detection/opencl/opencl.c:38:9: error: too many arguments to function 'data->ffclGetDeviceIDs'
   38 |         data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_ALL, 1, &deviceID, &numDevices);
      |         ^~~~
cc1: some warnings being treated as errors
make[2]: *** [CMakeFiles/libfastfetch.dir/src/detection/opencl/opencl.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions