Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[unitrace] Build fails with -DBUILD_WITH_OMP=OFF

Open Beginner friendly
#121 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cmake, cpp

Research direction

The compile errors come from tools/unitrace/src/unitrace.cc at lines 481 and 495, where BUILD_WITH_OMP is used as a value, and from the set(BUILD_WITH_OMP ...) call near line 30 of tools/unitrace/CMakeLists.txt. Start by checking how CMake passes the value into the compile definition, then normalize OFF/ON/0/1/TRUE/FALSE to a numeric value before it reaches the source. Done means the build succeeds with -DBUILD_WITH_OMP=OFF, the other accepted spellings still work, and the printed OMP value is correct.

Written by the indexing model from the issue text.

Description

On:

Project compilation fails if build is configured with -DBUILD_WITH_OMP=OFF:

#8 14.38 /usr/bin/dpclang++ -DBUILD_WITH_ITT=0 -DBUILD_WITH_L0=1 -DBUILD_WITH_MPI=0 -DBUILD_WITH_OMP=OFF -DBUILD_WITH_OPENCL=1 -DBUILD_WITH_PERFETTO=1 -DBUILD_WITH_XPTI=1 -DCXX_STD_FILESYSTEM_EXPERIMENTAL=0 -DUNITRACE_INSTALL_LIBDIR=\"lib\" -I/opt/pti-gpu/_build -I/opt/pti-gpu/tools/unitrace/src -I/opt/pti-gpu/tools/unitrace/src/levelzero -I/opt/pti-gpu/tools/unitrace/src/utils -I/opt/pti-gpu/tools/unitrace/../utils -I/opt/pti-gpu/tools/unitrace/../../utils -fvisibility=hidden -DPTI_VERSION=1.0.0 -std=c++17 -fvisibility=default -O3 -DNDEBUG -MD -MT tools/unitrace/CMakeFiles/unitrace.dir/src/unitrace.cc.o -MF tools/unitrace/CMakeFiles/unitrace.dir/src/unitrace.cc.o.d -o tools/unitrace/CMakeFiles/unitrace.dir/src/unitrace.cc.o -c /opt/pti-gpu/tools/unitrace/src/unitrace.cc
#8 14.38 /opt/pti-gpu/tools/unitrace/src/unitrace.cc:481:44: error: use of undeclared identifier 'OFF'
#8 14.38   481 |   header += ", \"OMP\": " + std::to_string(BUILD_WITH_OMP);
#8 14.38       |                                            ^~~~~~~~~~~~~~
#8 14.38 <command line>:4:24: note: expanded from macro 'BUILD_WITH_OMP'
#8 14.38     4 | #define BUILD_WITH_OMP OFF
#8 14.38       |                        ^~~
#8 14.38 /opt/pti-gpu/tools/unitrace/src/unitrace.cc:495:37: error: use of undeclared identifier 'OFF'
#8 14.38   495 |   std::cout << "BUILD_WITH_OMP=" << BUILD_WITH_OMP << ", ";
#8 14.38       |                                     ^~~~~~~~~~~~~~
#8 14.38 <command line>:4:24: note: expanded from macro 'BUILD_WITH_OMP'
#8 14.38     4 | #define BUILD_WITH_OMP OFF
#8 14.38       |                        ^~~
#8 14.38 2 errors generated.

Please, fix the build assuming that BUILD_WITH_OMP can validly be specified as OFF|ON|1|0|TRUE|FALSE.

I also recommend to align the way how unitrace options are set, i.e. consider change set(BUILD_WITH_OMP ...) to option(BUILD_WITH_OMP ...). As of now that not uniformed:
https://github.com/intel/pti-gpu/blob/6c0d6b0b80c6dbac4b5902d9d5ade1c75b9e9033/tools/unitrace/CMakeLists.txt#L30
https://github.com/intel/pti-gpu/blob/6c0d6b0b80c6dbac4b5902d9d5ade1c75b9e9033/tools/unitrace/CMakeLists.txt#L58

Example of build setup (using dpclang open source compiler, but the issue should be reproducible with oneAPI DPC++ as well):

FROM ubuntu:26.10

RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    cmake \
    dpclang-7 \
    git \
    libxptifw-dev \
    libze-dev \
    ocl-icd-opencl-dev \
    pkg-config \
    python3 \
    python3-dev \
    ninja-build && \
  rm -rf /var/lib/apt/lists/*

RUN cd /opt && git clone https://github.com/intel/pti-gpu.git
RUN cd /opt/pti-gpu && git reset --hard 6c0d6b0b80c6dbac4b5902d9d5ade1c75b9e9033

RUN cd /opt/pti-gpu && cmake -B _build -S . -G Ninja \
    -DBUILD_WITH_ITT=0 \
    -DBUILD_WITH_OMP=OFF \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_C_COMPILER=dpclang \
    -DCMAKE_CXX_COMPILER=dpclang++ \
    -DCMAKE_INSTALL_PREFIX=/opt/install
RUN cd /opt/pti-gpu && cmake --build _build
RUN cd /opt/pti-gpu && cmake --install _build

CC: @mschilling0

Dominant language
C++
Stars
276
Forks
73
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from intel/pti-gpu

All issues in intel/pti-gpu

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.