Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Build] Missmatch between CMake config and folder structure of onnxruntime-linux-x64-1.21.0.tgz #24003

Open
Zyrin opened this issue Mar 12, 2025 · 0 comments
Labels
build build issues; typically submitted using template

Comments

@Zyrin
Copy link
Contributor

Zyrin commented Mar 12, 2025

Describe the issue

Just unpacking onnxruntime-linux-x64-1.21.0.tgz (the gpu tgz has the same problem) to where the system expects libraries and include files (in my case /usr) and then trying to build against this release by using the provided CMake config fails with two errors:

  1. onnxruntimeTargets-release.cmake sets IMPORTED_LOCATION_RELEASE to.../lib64/libonnxruntime.so.1.21.0. This does not correspond with the folder structure for the libraries in the tgz being lib, so the so-file can not be found.
  2. onnxruntimeTargets.cmake sets INTERFACE_INCLUDE_DIRECTORIES to .../include/onnxruntime. This does not correspond with the folder structure for includes in the tgz being include, so the headers can not be found.

If I my voice my opinion: the CMake files expecting the headers in include/onnxruntime is a good thing as copying headers from different libraries directly into include has an overall high likelihood of name clashes between libraries.

Urgency

No response

Target platform

Linux (Ubuntu 22.04 in my case)

Build script

cmake_minimum_required(VERSION 3.22)
project(myproject)

find_package(onnxruntime REQUIRED)

add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE onnxruntime::onnxruntime)

Error / output

CMake Error at /usr/lib/cmake/onnxruntime/onnxruntimeTargets.cmake:83 (message):
  The imported target "onnxruntime::onnxruntime" references the file

     "/usr/lib64/libonnxruntime.so.1.21.0"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib/cmake/onnxruntime/onnxruntimeTargets.cmake"

  but not all the files it references.
  1. After fixing the wrong library path manually:
CMake Error in CMakeLists.txt:
  Imported target "onnxruntime::onnxruntime" includes non-existent path

    "/usr/include/onnxruntime"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

Visual Studio Version

No response

GCC / Compiler Version

12.3.0

@Zyrin Zyrin added the build build issues; typically submitted using template label Mar 12, 2025
@Zyrin Zyrin changed the title [Build] Missbatch between CMake config and folder structure of onnxruntime-linux-x64-1.21.0.tgz [Build] Missmatch between CMake config and folder structure of onnxruntime-linux-x64-1.21.0.tgz Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template
Projects
None yet
Development

No branches or pull requests

1 participant