oneAPI-samples icon indicating copy to clipboard operation
oneAPI-samples copied to clipboard

Fix the bug of compiler wrong set in sample cmakelists

Open Martin-HZK opened this issue 4 months ago • 0 comments

Existing Sample Changes

Description

In the DirectProgramming/C++/StructuredGrids/iso3dfd_omp_offload/src/CMakeLists.txt, the default cmake instructions shown in the official guidance cmake -DVERIFY_RESULTS=0 .. cannot really successfully make-build the project successfully and report the below messages, indicating that the compiler is not set properly.

~/Documents/oneAPI-samples/DirectProgramming/C++/StructuredGrids/iso3dfd_omp_offload/src/build$ make -j [ 25%] Building CXX object CMakeFiles/iso3dfd.dir/utils.o [ 50%] Building CXX object CMakeFiles/iso3dfd.dir/iso3dfd.o [ 75%] Building CXX object CMakeFiles/iso3dfd.dir/iso3dfd_verify.o c++: error: unrecognized command-line option ‘-fiopenmp’; did you mean ‘-fopenmp’? c++: error: unrecognized command-line option ‘-fiopenmp’; did you mean ‘-fopenmp’? c++: error: unrecognized command-line option ‘-fiopenmp’; did you mean ‘-fopenmp’? c++: error: unrecognized command-line option ‘-fopenmp-targets=spir64’ make[2]: *** [CMakeFiles/iso3dfd.dir/build.make:90: CMakeFiles/iso3dfd.dir/utils.o] Error 1 make[2]: *** Waiting for unfinished jobs.... c++: error: unrecognized command-line option ‘-fopenmp-targets=spir64’ c++: error: unrecognized command-line option ‘-fopenmp-targets=spir64’ make[2]: *** [CMakeFiles/iso3dfd.dir/build.make:76: CMakeFiles/iso3dfd.dir/iso3dfd.o] Error 1 make[2]: *** [CMakeFiles/iso3dfd.dir/build.make:104: CMakeFiles/iso3dfd.dir/iso3dfd_verify.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:84: CMakeFiles/iso3dfd.dir/all] Error 2 make: *** [Makefile:91: all] Error 2 In the CMakeLists file, the 3rd line should be changed from set(CMAKE_CXX_COMPILER "icpx") to set(CMAKE_CXX_COMPILER icpx). Or we should explicitly declare the compiler options.

Fixes Issue#

External Dependencies

List any external dependencies created as a result of this change.

Type of change

Please delete options that are not relevant. Add a 'X' to the one that is applicable.

  • [x ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Implement fixes for ONSAM Jiras

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [x ] Command Line
  • [ ] oneapi-cli
  • [ ] Visual Studio
  • [ ] Eclipse IDE
  • [ ] VSCode
  • [ ] When compiling the compliler flag "-Wall -Wformat-security -Werror=format-security" was used

Martin-HZK avatar Oct 24 '24 03:10 Martin-HZK