Skip to content

Commit

Permalink
Try again
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanUnderhill committed Feb 21, 2025
1 parent 44d7bfe commit 479f85d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ if(CMAKE_GENERATOR_TOOLSET MATCHES "Visual Studio")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_options(onnxruntime-genai PRIVATE "LINKER:-rpath=\$ORIGIN")
set_target_properties(onnxruntime-genai PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(onnxruntime-genai PROPERTIES INSTALL_RPATH "$ORIGIN" BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries(onnxruntime-genai PRIVATE dl) # For dlopen & co
endif()

Expand Down
3 changes: 1 addition & 2 deletions src/generators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ struct LibraryHandle {
#elif defined(__linux__) && !defined(__ANDROID__)
struct LibraryHandle {
LibraryHandle(const char* filename) {
auto path = Ort::GetCurrentModuleDir() + "/" + filename;
handle_ = dlopen(path.c_str(), RTLD_NOW | RTLD_LOCAL);
handle_ = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
if (!handle_)
throw std::runtime_error(std::string("Failed to load library: ") + dlerror()); // dlerror() includes the path
}
Expand Down

0 comments on commit 479f85d

Please sign in to comment.