pytorch / executorch

On-device AI across mobile, embedded and edge for PyTorch
https://pytorch.org/executorch/
Other
1.44k stars 234 forks source link

Undefined symbols for architecture arm64 when sudo ./install_requirements.sh --pybind coreml #3797

Open joshuachak opened 1 month ago

joshuachak commented 1 month ago

I am using Macbook Pro M3 Max (MacOS 14.4.1 (23E224)), when doing sudo ./install_requirements.sh --pybind coreml, there is an error:

[100%] Building CXX object examples/models/llama2/custom_ops/CMakeFiles/custom_ops_aot_lib.dir/op_sdpa_aot.cpp.o
  [100%] Linking CXX shared library libcustom_ops_aot_lib.dylib
  Undefined symbols for architecture arm64:
    "c10::throwNullDataPtrError()", referenced from:
        void* c10::TensorImpl::data_impl<void, c10::TensorImpl::mutable_data()::'lambda'()>(c10::TensorImpl::mutable_data()::'lambda'() const&) const in op_sdpa_aot.cpp.o
    "c10::warnDeprecatedDataPtr()", referenced from:
        void* c10::TensorImpl::data_impl<void, c10::TensorImpl::mutable_data()::'lambda'()>(c10::TensorImpl::mutable_data()::'lambda'() const&) const in op_sdpa_aot.cpp.o
    "c10::impl::cow::materialize_cow_storage(c10::StorageImpl&)", referenced from:
        void* c10::TensorImpl::data_impl<void, c10::TensorImpl::mutable_data()::'lambda'()>(c10::TensorImpl::mutable_data()::'lambda'() const&) const in op_sdpa_aot.cpp.o
  ld: symbol(s) not found for architecture arm64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make[3]: *** [examples/models/llama2/custom_ops/libcustom_ops_aot_lib.dylib] Error 1
  make[2]: *** [examples/models/llama2/custom_ops/CMakeFiles/custom_ops_aot_lib.dir/all] Error 2
  make[1]: *** [examples/models/llama2/custom_ops/CMakeFiles/custom_ops_aot_lib.dir/rule] Error 2
  make: *** [custom_ops_aot_lib] Error 2
  error: command '/opt/miniconda3/envs/executorch/bin/cmake' failed with exit code 2
  error: subprocess-exited-with-error

  × Building wheel for executorch (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /opt/miniconda3/envs/executorch/bin/python /opt/miniconda3/envs/executorch/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmplkwva39i
  cwd: /Users/admin/Documents/executorch
  Building wheel for executorch (pyproject.toml) ... error
  ERROR: Failed building wheel for executorch
Failed to build executorch
ERROR: Could not build wheels for executorch, which is required to install pyproject.toml-based projects
WARNING: Location 'pip/' is ignored: it is either a non-existing path or lacks a specific scheme.

Does anyone know how to fix it? Many thanks!!

mergennachin commented 1 month ago

@joshuachak

I can't reproduce locally on the main branch. Which branch and git hash are you using?

mergennachin commented 1 month ago

Can you try these?

git clean -xfd
pip uninstall executorch
rm -rf cmake-out

And try again