Skip to content

Commit b8282a6

Browse files
committed
Fix llama runner on MacOS
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 0d0769a commit b8282a6

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.ci/scripts/test_llama.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ cmake_install_executorch_libraries() {
150150
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
151151
rm -rf cmake-out
152152
retry cmake --preset llm \
153+
-DEXECUTORCH_BUILD_TESTS=ON \
153154
-DBUILD_TESTING=OFF \
154155
-DCMAKE_INSTALL_PREFIX=cmake-out \
155156
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
@@ -166,6 +167,7 @@ cmake_build_llama_runner() {
166167
popd
167168
dir="examples/models/llama"
168169
retry cmake \
170+
-DEXECUTORCH_BUILD_TESTS=ON \
169171
-DBUILD_TESTING=OFF \
170172
-DCMAKE_INSTALL_PREFIX=cmake-out \
171173
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \

examples/models/llama/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ endif()
219219
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})
222-
if(NOT APPLE)
222+
if(APPLE)
223+
set_target_properties(
224+
llama_main PROPERTIES LINK_FLAGS "-Wl,-rpath,@loader_path"
225+
)
226+
else()
223227
set_target_properties(llama_main PROPERTIES LINK_FLAGS "-Wl,-rpath='$ORIGIN'")
224228
endif()

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)