Sampas / bm3dcl

OpenCL implementation of BM3D image denoising algorithm
MIT License
11 stars 5 forks source link

Compilation error #5

Open trougnouf opened 1 month ago

trougnouf commented 1 month ago

Dear Sampas, I tried compiling your project (on Arch Linux) but got the following error:

[trougnouf@bd tmp]$ git clone https://github.com/Sampas/bm3dcl.git
Cloning into 'bm3dcl'...
remote: Enumerating objects: 51, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 51 (delta 1), reused 6 (delta 0), pack-reused 42 (from 1)
Receiving objects: 100% (51/51), 135.62 KiB | 1.52 MiB/s, done.
Resolving deltas: 100% (14/14), done.
[trougnouf@bd tmp]$ cd bm3dcl/
[trougnouf@bd bm3dcl]$ mkdir build
[trougnouf@bd bm3dcl]$ cd build/
[trougnouf@bd build]$ cmake ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 14.2.1
-- The CXX compiler identification is GNU 14.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for CL_VERSION_3_0
-- Looking for CL_VERSION_3_0 - found
-- Found OpenCL: /usr/lib/libOpenCL.so (found version "3.0")
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/trougnouf/tmp/bm3dcl/build/googletest-download/googletest-download
[ 11%] Creating directories for 'googletest'
[ 22%] Performing download step (git clone) for 'googletest'
Cloning into 'googletest-src'...
HEAD is now at dea0216d Merge pull request #2083 from hugolm84/v1.8.x
[ 33%] Performing update step for 'googletest'
-- Fetching latest from the remote origin
HEAD is now at dea0216d Merge pull request #2083 from hugolm84/v1.8.x
[ 44%] No patch step for 'googletest'
[ 55%] No configure step for 'googletest'
[ 66%] No build step for 'googletest'
[ 77%] No install step for 'googletest'
[ 88%] No test step for 'googletest'
[100%] Completed 'googletest'
[100%] Built target googletest
CMake Deprecation Warning at build/googletest-download/googletest-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at build/googletest-download/googletest-src/googlemock/CMakeLists.txt:42 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at build/googletest-download/googletest-src/googletest/CMakeLists.txt:49 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Warning (dev) at build/googletest-download/googletest-src/googletest/cmake/internal_utils.cmake:241 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  build/googletest-download/googletest-src/googletest/CMakeLists.txt:84 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: /usr/bin/python (found version "3.12.6")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (7.5s)
-- Generating done (0.0s)
-- Build files have been written to: /home/trougnouf/tmp/bm3dcl/build
[trougnouf@bd build]$ make
[ 10%] Building CXX object CMakeFiles/bm3dcl.dir/src/main.cpp.o
In file included from /usr/include/CL/cl.h:20,
                 from /home/trougnouf/tmp/bm3dcl/src/utils.h:10,
                 from /home/trougnouf/tmp/bm3dcl/src/main.cpp:14:
/usr/include/CL/cl_version.h:22:104: note: ‘#pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)’
   22 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)")
      |                                                                                                        ^
/home/trougnouf/tmp/bm3dcl/src/main.cpp: In function ‘int main(int, char**)’:
/home/trougnouf/tmp/bm3dcl/src/main.cpp:50:12: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
   50 |     putenv("CUDA_CACHE_DISABLE=1");
      |            ^~~~~~~~~~~~~~~~~~~~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:204:50: warning: ‘_cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_queue_properties, cl_int*)’ is deprecated [-Wdeprecated-declarations]
  204 |     cl_command_queue queue = clCreateCommandQueue(context, device, CL_QUEUE_PROFILING_ENABLE, &error);
      |                              ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/CL/cl.h:1914:1: note: declared here
 1914 | clCreateCommandQueue(cl_context                     context,
      | ^~~~~~~~~~~~~~~~~~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:210:43: warning: narrowing conversion of ‘noisy.PGM::width’ from ‘int’ to ‘size_t’ {aka ‘long unsigned int’} [-Wnarrowing]
  210 |     const size_t image_region[3] = {noisy.width, noisy.height, 1};
      |                                     ~~~~~~^~~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:210:56: warning: narrowing conversion of ‘noisy.PGM::height’ from ‘int’ to ‘size_t’ {aka ‘long unsigned int’} [-Wnarrowing]
  210 |     const size_t image_region[3] = {noisy.width, noisy.height, 1};
      |                                                  ~~~~~~^~~~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:213:48: warning: ‘_cl_mem* clCreateImage2D(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, void*, cl_int*)’ is deprecated [-Wdeprecated-declarations]
  213 |     cl_mem noisy_image_buffer = clCreateImage2D(context, CL_MEM_READ_ONLY, &image_format_in, noisy.width, noisy.height, 0, NULL, &error);
      |                                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/CL/cl.h:1873:1: note: declared here
 1873 | clCreateImage2D(cl_context              context,
      | ^~~~~~~~~~~~~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:215:48: warning: ‘_cl_mem* clCreateImage2D(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, void*, cl_int*)’ is deprecated [-Wdeprecated-declarations]
  215 |     cl_mem basic_image_buffer = clCreateImage2D(context, CL_MEM_READ_WRITE, &image_format_out, noisy.width, noisy.height, 0, NULL, &error);
      |                                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/CL/cl.h:1873:1: note: declared here
 1873 | clCreateImage2D(cl_context              context,
      | ^~~~~~~~~~~~~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:217:49: warning: ‘_cl_mem* clCreateImage2D(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, void*, cl_int*)’ is deprecated [-Wdeprecated-declarations]
  217 |     cl_mem wiener_image_buffer = clCreateImage2D(context, CL_MEM_WRITE_ONLY, &image_format_out, noisy.width, noisy.height, 0, NULL, &error);
      |                                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/CL/cl.h:1873:1: note: declared here
 1873 | clCreateImage2D(cl_context              context,
      | ^~~~~~~~~~~~~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:315:31: warning: narrowing conversion of ‘(int)gx_d’ from ‘int’ to ‘size_t’ {aka ‘long unsigned int’} [-Wnarrowing]
  315 |             size_t gs_d[2] = {gx_d, gy_d};
      |                               ^~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:315:37: warning: narrowing conversion of ‘(int)gy_d’ from ‘int’ to ‘size_t’ {aka ‘long unsigned int’} [-Wnarrowing]
  315 |             size_t gs_d[2] = {gx_d, gy_d};
      |                                     ^~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:376:31: warning: narrowing conversion of ‘(int)gx_d’ from ‘int’ to ‘size_t’ {aka ‘long unsigned int’} [-Wnarrowing]
  376 |             size_t gs_d[2] = {gx_d, gy_d};
      |                               ^~~~
/home/trougnouf/tmp/bm3dcl/src/main.cpp:376:37: warning: narrowing conversion of ‘(int)gy_d’ from ‘int’ to ‘size_t’ {aka ‘long unsigned int’} [-Wnarrowing]
  376 |             size_t gs_d[2] = {gx_d, gy_d};
      |                                     ^~~~
[ 20%] Building CXX object CMakeFiles/bm3dcl.dir/src/PGM.cpp.o
[ 30%] Building CXX object CMakeFiles/bm3dcl.dir/src/utils.cpp.o
In file included from /usr/include/CL/cl.h:20,
                 from /home/trougnouf/tmp/bm3dcl/src/utils.h:10,
                 from /home/trougnouf/tmp/bm3dcl/src/utils.cpp:1:
/usr/include/CL/cl_version.h:22:104: note: ‘#pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)’
   22 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)")
      |                                                                                                        ^
[ 40%] Linking CXX executable runtime/bm3dcl
[ 40%] Built target bm3dcl
[ 50%] Building CXX object googletest-download/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /home/trougnouf/tmp/bm3dcl/build/googletest-download/googletest-src/googletest/src/gtest-all.cc:42:
/home/trougnouf/tmp/bm3dcl/build/googletest-download/googletest-src/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/trougnouf/tmp/bm3dcl/build/googletest-download/googletest-src/googletest/src/gtest-death-test.cc:1224:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
 1224 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/trougnouf/tmp/bm3dcl/build/googletest-download/googletest-src/googletest/src/gtest-death-test.cc:1214:13: note: by argument 1 of type ‘const void*’ to ‘void testing::internal::StackLowerThanAddress(const void*, bool*)’ declared here
 1214 | static void StackLowerThanAddress(const void* ptr, bool* result) {
      |             ^~~~~~~~~~~~~~~~~~~~~
/home/trougnouf/tmp/bm3dcl/build/googletest-download/googletest-src/googletest/src/gtest-death-test.cc:1222:7: note: ‘dummy’ declared here
 1222 |   int dummy;
      |       ^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [googletest-download/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/build.make:76: googletest-download/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:248: googletest-download/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
trougnouf commented 1 month ago

I got it to compile by removing the two test directories and their reference in CMakeLists.txt, although I can't run the program because I run into Failed to load noisy image: /home/trougnouf/tmp/moo.jpg

trougnouf commented 1 month ago

I got a bit further by converting the image from png/jpg to pgm, but I run into the following errors:

[trougnouf@bd runtime]$ ./bm3dcl '/home/trougnouf/tmp/moo.jpg.pgm'  95
CWD: /home/trougnouf/tmp/bm3dcl/build/runtime
Noisy image: /home/trougnouf/tmp/moo.jpg.pgm
Sigma: 95
Getting OpenCL platforms...
[0] Name: AMD Accelerated Parallel Processing
[1] Name: Intel(R) OpenCL
[2] Name: rusticl
Platform selected: 0
Available devices:
[0] Device name: gfx1100
Selected device: 0
Compute units: 48
Global mem size available: 25753026560
Starting kernel build with options:  -cl-nv-verbose -cl-std=CL1.1 -DWIDTH=3164 -DHEIGHT=4537 -DUSE_PLATFORM=0 -DSIGMA=95
OpenCL error code -33 at /home/trougnouf/tmp/bm3dcl/src/main.cpp [179]: clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size)