-
Notifications
You must be signed in to change notification settings - Fork 424
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
Link errors when copy execuTorch libs to the application folders #7465
Comments
I used executorch in a simple external C++ project with the CMakeList.txt file mentioned in the following issue #7459 (comment) |
Can you expand on the error? |
@kimishpatel partial of link errors. Will try @dinusha94 's method. 2024-12-31 16:49:20 -0800 -- INFO: [docker] CMakeFiles/executorch_app.dir/src/executorch_wrapper.cpp.o: In function `EngineExecuTorch::EngineExecute()': /optexe/workspace/simpleApp/src/executorch_wrapper.cpp:164: undefined reference to `executorch::extension::Module::execute(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&, std::__ndk1::vector<executorch::runtime::EValue, std::__ndk1::allocatorexecutorch::runtime::EValue > const&)' 2024-12-31 16:49:20 -0800 -- INFO: [docker] CMakeFiles/executorch_app.dir/src/executorch_wrapper.cpp.o: In function `std::__ndk1::__unique_ifexecutorch::extension::Module::__unique_single std::__ndk1::make_unique<executorch::extension::Module, char const*>(char const*&&)': /opt/build-tools/AndroidNDKStandaloneToolchain/android-ndk/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/c++/v1/memory:3003: undefined reference to `executorch::extension::Module::Module(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&, executorch::extension::Module::LoadMode, std::__ndk1::unique_ptr<executorch::runtime::EventTracer, std::__ndk1::default_deleteexecutorch::runtime::EventTracer >)' 2024-12-31 16:49:20 -0800 -- INFO: [docker] CMakeFiles/executorch_app.dir/src/executorch_wrapper.cpp.o: In function `executorch::runtime::EValue::toTensor() const &': /optexe/android_ndk/include/executorch/runtime/core/evalue.h:278: undefined reference to `executorch::runtime::internal::get_log_timestamp()' 2024-12-31 16:49:20 -0800 -- INFO: [docker] /optexe/android_ndk/include/executorch/runtime/core/evalue.h:278: undefined reference to `executorch::runtime::runtime_abort()' 2024-12-31 16:49:20 -0800 -- INFO: [docker] CMakeFiles/executorch_app.dir/src/executorch_wrapper.cpp.o: In function `executorch::extension::make_tensor_ptr(std::__ndk1::vector<int, std::__ndk1::allocator >, void*, std::__ndk1::vector<unsigned char, std::__ndk1::allocator >, std::__ndk1::vector<int, std::__ndk1::allocator >, executorch::runtime::etensor::ScalarType, executorch::runtime::TensorShapeDynamism, std::__ndk1::function<void (void*)>)': /optexe/android_ndk/include/executorch/extension/tensor/tensor_ptr.h:158: undefined reference to `executorch::extension::make_tensor_impl_ptr(std::__ndk1::vector<int, std::__ndk1::allocator >, void*, std::__ndk1::vector<unsigned char, std::__ndk1::allocator >, std::__ndk1::vector<int, std::__ndk1::allocator >, executorch::runtime::etensor::ScalarType, executorch::runtime::TensorShapeDynamism, std::__ndk1::function<void (void*)>)' 2024-12-31 16:49:20 -0800 -- INFO: [docker] CMakeFiles/executorch_app.dir/src/executorch_wrapper.cpp.o: In function `executorch::runtime::internal::logf(executorch::runtime::LogLevel, unsigned long, char const*, char const*, unsigned long, char const*, ...)': /optexe/android_ndk/include/executorch/runtime/platform/log.h:131: undefined reference to `executorch::runtime::internal::vlogf(executorch::runtime::LogLevel, unsigned long, char const*, char const*, unsigned long, char const*, std::__va_list)' 2024-12-31 16:49:20 -0800 -- INFO: [docker] CMakeFiles/executorch_app.dir/src/executorch_wrapper.cpp.o: In function `executorch::runtime::EValue::toTensorList() const': /optexe/android_ndk/include/executorch/runtime/core/evalue.h:353: undefined reference to `executorch::runtime::internal::get_log_timestamp()' 2024-12-31 16:49:20 -0800 -- INFO: [docker] /optexe/android_ndk/include/executorch/runtime/core/evalue.h:353: undefined reference to `executorch::runtime::runtime_abort()' 2024-12-31 16:49:20 -0800 -- INFO: [docker] CMakeFiles/executorch_app.dir/src/executorch_wrapper.cpp.o: In function `executorch::runtime::EValue::toListOptionalTensor() const': /optexe/android_ndk/include/executorch/runtime/core/evalue.h:371: undefined reference to ` |
@dinusha94 |
I copied those folders from the executorch's build directory, /executorch/cmake-out/lib, also need to copy includes to /usr/local/include/ from /executorch/cmake-out/include. to get all necessary includes I added the following code to the top level CMakeList.txt before building executorch include new codes after
Code to include in CMakeList.txt
|
@dinusha94 thank you for your help. I realized I need to turn on some compile options in CMakeFile.txt. After that I can build successfully. I haven't tested a model yet. |
@jpeng2012 I am gonna close this issue as original one seems to be resolved. Thanks @dinusha94 for the pointers. I dont know if gh has "thanks" badges but if there is one, i will send it your way |
🐛 Describe the bug
Currently I am using release 0.4, I copied the header files under extension/tensor, extension/module/, runtime/core, runtime/platform, runtime/executor, libexecutorch.a, libportable_kernels.a, libportable_ops_lib.a to my application folders
My cmake file framework is like this,
set(EXECUTORCH_LIBRARY ${EXECUTORCH_LIB_PATH}/libexecutorch.a
${EXECUTORCH_LIB_PATH}/libportable_kernels.a
${EXECUTORCH_LIB_PATH}/libportable_ops_lib.a)
dd_library(mysharedLib SHARED ${SRC_LIST})
target_link_libraries(mysharedLib PRIVATE
-Wl,--no-allow-shlib-undefined
-Wl,-z,defs
-Wl,--whole-archive ${EXECUTORCH_LIBRARY} -Wl,--no-whole-archive
${OTHERLIBS}
The compilation works just fine but linker keep complaining executorch::runtime:: ....
What's wrong?
Also is it possible to build a shared library version?
It would be great if you can provide a simple exmaple cmakefile to link the only minimal libraries to external c++ project.
Versions
OS: Ubuntu 22.04.5 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.22.1
Libc version: glibc-2.35
Python version: 3.12.6
The text was updated successfully, but these errors were encountered: