Skip to content

RISC-V: error message in the toolchain file when compiler is not found#26898

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
mshabunin:fix-riscv-toolchain
Feb 14, 2025
Merged

RISC-V: error message in the toolchain file when compiler is not found#26898
asmorkalov merged 1 commit intoopencv:4.xfrom
mshabunin:fix-riscv-toolchain

Conversation

@mshabunin
Copy link
Copy Markdown
Contributor

When compiler couldn't be found, user got the following cryptic message:

CMake Error at platforms/linux/riscv-gnu.toolchain.cmake:50 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  platforms/linux/riscv64-gcc.toolchain.cmake:11 (include)
  /usr/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake:124 (include)
  CMakeLists.txt:134 (project)

Also simplified find_program - it should not rewrite existing cache variables anyways.

set(TOOLCHAIN_COMPILER_LOCATION_HINT PATHS /opt/riscv/bin ENV PATH)
endif()

if(NOT DEFINED CMAKE_C_COMPILER)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is check removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that find_program already incorporates such check (https://cmake.org/cmake/help/latest/command/find_program.html). I.e. it will only work if its target variable has not been set. There might be difference in behavior when variable has been defined to some specific values (OFF? FALSE?), but I think it wouldn't be critical.

@asmorkalov asmorkalov added this to the 4.12.0 milestone Feb 14, 2025
@asmorkalov asmorkalov merged commit b44b30b into opencv:4.x Feb 14, 2025
27 of 28 checks passed
@mshabunin mshabunin deleted the fix-riscv-toolchain branch February 15, 2025 08:03
@asmorkalov asmorkalov mentioned this pull request Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants