Skip to content

Commit 842d946

Browse files
authored
Fix llama runner on MacOS (#13869)
Summary: Fixes two things: - There's a compilation error when building the tests due to missing header. Make sure it works via test_llama.sh - rpath isn't set correctly on MacOS Test Plan: ``` cmake --preset llm -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake-out cmake --build cmake-out -j16 --target install --config Release cmake -DCMAKE_INSTALL_PREFIX=cmake-out \ -DBUILD_TESTING=OFF \ -DCMAKE_BUILD_TYPE=Release \ -Bcmake-out/examples/models/llama \ examples/models/llama cmake --build cmake-out/examples/models/llama -j16 --config Release ```
1 parent e38c077 commit 842d946

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

.ci/scripts/test_llama.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ cmake_install_executorch_libraries() {
154154
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
155155
rm -rf cmake-out
156156
retry cmake --preset llm \
157+
-DEXECUTORCH_BUILD_TESTS=ON \
157158
-DBUILD_TESTING=OFF \
158159
-DCMAKE_INSTALL_PREFIX=cmake-out \
159160
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
@@ -170,6 +171,7 @@ cmake_build_llama_runner() {
170171
popd
171172
dir="examples/models/llama"
172173
retry cmake \
174+
-DEXECUTORCH_BUILD_TESTS=ON \
173175
-DBUILD_TESTING=OFF \
174176
-DCMAKE_INSTALL_PREFIX=cmake-out \
175177
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \

examples/models/llama/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ target_include_directories(llama_main PUBLIC ${_common_include_directories})
220220
target_link_libraries(llama_main PUBLIC llama_runner ${link_libraries})
221221
target_compile_options(llama_main PUBLIC ${_common_compile_options})
222222
if(APPLE)
223-
target_link_options(llama_main PRIVATE -Wl,-rpath,@executable_path)
223+
target_link_options(llama_main PRIVATE -Wl,-rpath,@loader_path)
224224
elseif(UNIX)
225225
set_target_properties(llama_main PROPERTIES LINK_FLAGS "-Wl,-rpath='$ORIGIN'")
226226
endif()
227+
# Windows doesn't need rpath - DLLs are found via standard Windows search order

runtime/executor/test/method_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <cstdlib>
1010
#include <filesystem>
11+
#include <unordered_map>
1112

1213
#include <executorch/extension/data_loader/file_data_loader.h>
1314
#include <executorch/extension/flat_tensor/flat_tensor_data_map.h>

0 commit comments

Comments
 (0)