You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only a subset of the CMake targets in rocprofiler-sdk and rocprofiler-sdk-roctx are guarded against multiple inclusions. The other ROCm packages do not have this issue.
You will see that having twofind_package(hiprtc) is OK, but having twofind_package(rocprofiler_sdk) gives you this error:
CMake Error at /opt/rocm/lib/cmake/rocprofiler-sdk/rocprofiler-sdk-config.cmake:61 (add_library):
add_library cannot create imported target
"rocprofiler-sdk::rocprofiler-sdk" because another target with the same
name already exists.
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
CMake Error at /opt/rocm/lib/cmake/rocprofiler-sdk/rocprofiler-sdk-config.cmake:124 (add_library):
add_library cannot create imported target
"rocprofiler-sdk::rocprofiler-sdk-external-nolink" because another target
with the same name already exists.
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
CMake Error at /opt/rocm/lib/cmake/rocprofiler-sdk/rocprofiler-sdk-config.cmake:158 (add_executable):
add_executable cannot create imported target "rocprofiler-sdk::rocprofv3"
because another target with the same name already exists.
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
I believe the problem are these lines in rocprofiler-sdk-targets.cmake:
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_cmake_targets_defined "")
set(_cmake_targets_not_defined "")
set(_cmake_expected_targets "")
foreach(_cmake_expected_target IN ITEMS rocprofiler-sdk::rocprofiler-headers rocprofiler-sdk::rocprofiler-shared-library)
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
if(TARGET "${_cmake_expected_target}")
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
else()
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
endif()
endforeach()
There are similar issues with the CMake module for rocprofiler-sdk-roctx. You can reproduce the issue by doing find_package(find_package(rocprofiler-sdk-roctx) twice in CMakeLists.txt
Operating System
Ubuntu 22.04.4 LTS (Jammy Jellyfish)
CPU
AMD EPYC 7713 64-Core Processor
GPU
AMD Instinct MI250
ROCm Version
ROCm 6.2.0
ROCm Component
No response
Steps to Reproduce
No response
(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Thanks for the ticket. This is easily fixed by adding an include_guard(DIRECTORY) to the top of the *-config.cmake files. I’ll get that taken care of.
Will the fixed CMake module make it into ROCm 6.2.3 (if there is such a thing) or will it go into ROCm 6.3? Do you want make to create an internal Jira for this?
Problem Description
Only a subset of the CMake targets in rocprofiler-sdk and rocprofiler-sdk-roctx are guarded against multiple inclusions. The other ROCm packages do not have this issue.
Here is a simple reproducer (CMakeLists.txt):
You will see that having two
find_package(hiprtc)
is OK, but having twofind_package(rocprofiler_sdk)
gives you this error:I believe the problem are these lines in rocprofiler-sdk-targets.cmake:
There are similar issues with the CMake module for rocprofiler-sdk-roctx. You can reproduce the issue by doing
find_package(find_package(rocprofiler-sdk-roctx)
twice in CMakeLists.txtOperating System
Ubuntu 22.04.4 LTS (Jammy Jellyfish)
CPU
AMD EPYC 7713 64-Core Processor
GPU
AMD Instinct MI250
ROCm Version
ROCm 6.2.0
ROCm Component
No response
Steps to Reproduce
No response
(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: