ROCm / ROCm/rocPyDecode

CMake install: no COMPONENT grouping, Python modules install to lib/ instead of site-packages

Open
#285 2 comments 0 reactions 1 assignee View on GitHub

@essamROCm is already working on this.

Since Sep 12, 2026.

bug enhancement
Dominant language
C++
Stars
8
Forks
13
Avg merge
2d 1h
Merged PRs (30d)
6

Description

Summary

Audit of all install() directives in rocPyDecode as part of the vision-pack aggregator work revealed two gaps: no CPack component grouping making packaging impossible to split, and Python extension modules installing to the wrong prefix.

Findings

1. No COMPONENT grouping on any install() directive

Every install() call in both jpegDecode/CMakeLists.txt and videoDecode/CMakeLists.txt is missing a COMPONENT specification:

# jpegDecode/CMakeLists.txt
install(TARGETS ${ROCPYJPEG_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY pyRocJpegDecode DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY samples/rocjpeg DESTINATION ${CMAKE_INSTALL_DATADIR}/rocpyjpegdecode/samples)
install(FILES LICENSE.txt DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/rocpyjpegdecode)

# videoDecode/CMakeLists.txt
install(TARGETS ${ROCPYVIDEO_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY pyRocVideoDecode DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY samples/rocdecode DESTINATION ${CMAKE_INSTALL_DATADIR}/rocpydecode/samples)
install(FILES LICENSE.txt DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/rocpydecode)

Without COMPONENT, CPack cannot produce separate runtime, dev, and test packages. Every install target lands in all packages indiscriminately. The sibling libraries (rocAL, MIVisionX, rocCV) all use a consistent 4-component scheme: runtime, dev, asan, test.

Fix: Annotate each install() call with the appropriate component:

  • Compiled .so targets → COMPONENT runtime
  • Python package directories (pyRocJpegDecode/, pyRocVideoDecode/) → COMPONENT runtime
  • Samples → COMPONENT dev
  • Tests → COMPONENT test
  • LICENSE → COMPONENT runtime
2. Python extension modules install to lib/ instead of site-packages

Both subprojects install compiled Python extension modules to ${CMAKE_INSTALL_LIBDIR} (/opt/rocm/lib/):

install(TARGETS ${ROCPYJPEG_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY pyRocJpegDecode DESTINATION ${CMAKE_INSTALL_LIBDIR})

This means import rocpyjpegdecode fails unless the user manually adds /opt/rocm/lib to PYTHONPATH. The correct destination is the Python interpreter's site-packages:

execute_process(
  COMMAND "${Python3_EXECUTABLE}" -c
    "import site; print(site.getsitepackages()[0])"
  OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
  OUTPUT_STRIP_TRAILING_WHITESPACE)

install(TARGETS ${ROCPYJPEG_TARGET}
        LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES}
        COMPONENT runtime)
install(DIRECTORY pyRocJpegDecode
        DESTINATION ${PYTHON_SITE_PACKAGES}
        COMPONENT runtime)

Context

Found during vision-pack aggregator repo audit. rocAL has the same Python install path issue (filed as ROCm/rocAL#514). A coordinated fix across both would be ideal so that all ROCm CV Python bindings are importable out of the box without PYTHONPATH changes.

References

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.