Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,11 @@ target_link_libraries(executorch_core PRIVATE program_schema)
if(ANDROID)
target_link_libraries(executorch_core PUBLIC log)
endif()
if(EXECUTORCH_USE_DL)
# Skip when cross-compiling: find_library() resolves the host libdl even for a
# bare-metal target (e.g. arm-none-eabi), which then links -ldl into the
# baremetal runner and fails ("cannot find -ldl"). dladdr() isn't used on those
# targets anyway. Per-target presets also set EXECUTORCH_USE_DL OFF explicitly.
if(EXECUTORCH_USE_DL AND NOT CMAKE_CROSSCOMPILING)
# Check if dl exists for this toolchain and only then link it.
find_library(DL_LIBRARY_EXISTS NAMES dl)
# Check if the library was found
Expand Down
2 changes: 2 additions & 0 deletions tools/cmake/preset/arm_baremetal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ set_overridable_option(EXECUTORCH_BUILD_EXECUTOR_RUNNER OFF)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR OFF)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER OFF)
set_overridable_option(EXECUTORCH_BUILD_ARM_BAREMETAL ON)
# Bare-metal has no libdl (see CMakeLists.txt EXECUTORCH_USE_DL block).
set_overridable_option(EXECUTORCH_USE_DL OFF)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON)
set_overridable_option(EXECUTORCH_BUILD_CORTEX_M ON)
Expand Down
2 changes: 2 additions & 0 deletions tools/cmake/preset/esp_baremetal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}")
set_overridable_option(EXECUTORCH_BUILD_EXECUTOR_RUNNER OFF)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR OFF)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER OFF)
# Bare-metal has no libdl (see CMakeLists.txt EXECUTORCH_USE_DL block).
set_overridable_option(EXECUTORCH_USE_DL OFF)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON)
set_overridable_option(EXECUTORCH_ENABLE_LOGGING ON)
Expand Down
2 changes: 2 additions & 0 deletions tools/cmake/preset/zephyr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

set_overridable_option(EXECUTORCH_BUILD_COREML OFF)
set_overridable_option(EXECUTORCH_ENABLE_EVENT_TRACER OFF)
# Bare-metal has no libdl (see CMakeLists.txt EXECUTORCH_USE_DL block).
set_overridable_option(EXECUTORCH_USE_DL OFF)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_LLM OFF)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_LLM_AOT OFF)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER OFF)
Expand Down
Loading