Skip to content

fix static linking #2032

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

Merged
merged 1 commit into from
Mar 21, 2025
Merged

fix static linking #2032

merged 1 commit into from
Mar 21, 2025

Conversation

sangeet2020
Copy link
Contributor

Hi,

This PR is in reference to the issue: #1541

The current cmake logic does not handle the case where ONNX runtime is pre-installed and static linking is used.

The proposed solution modifies the sherpa-onnx/csrc/CMakeLists.txt file.

if((BUILD_SHARED_LIBS OR SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE) AND NOT DEFINED onnxruntime_lib_files)
  target_link_libraries(sherpa-onnx-core onnxruntime)
else()
  target_link_libraries(sherpa-onnx-core ${onnxruntime_lib_files})

The modified conditioning allows linking to the pre-installed ONNX Runtime when BUILD_SHARED_LIBS is True or when SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE is set. This prevents build failures caused by missing onnxruntime_lib_files in static builds.

Thanks

Copy link
Collaborator

@csukuangfj csukuangfj left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution!

@csukuangfj csukuangfj merged commit 31096e4 into k2-fsa:master Mar 21, 2025
186 of 222 checks passed
vsd-vector pushed a commit to vsd-vector/sherpa-onnx that referenced this pull request Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants