Error when building executorch on libquantized

Hello,

I am trying to follow the instructions to run llama3-instruct with executorch, but I am encountering an error when running install_requirements.sh --pybind xnnpack
It seems that it fails to build kernels/quantized/libquantized_ops_aot_lib.so so it cannot link it.
Unfortunately, the script only reports the error, but does not say much as to why.
I am running Ubuntu 22.04 on Azure

I tried to run this on a local ubuntu 22.04 running with hyper-v and it works, but then I don’t have enough RAM to export the model

Please let me know if you need any further information, thanks

 [ 88%] Building CXX object kernels/quantized/CMakeFiles/quantized_ops_aot_lib.dir/cpu/op_quantize.cpp.o
  [ 88%] Building CXX object kernels/quantized/CMakeFiles/quantized_ops_aot_lib.dir/__/portable/cpu/util/reduce_util.cpp.o
  [ 88%] Building CXX object kernels/quantized/CMakeFiles/quantized_ops_aot_lib.dir/__/__/runtime/core/exec_aten/util/tensor_util_aten.cpp.o
  [ 88%] Linking CXX shared library libquantized_ops_aot_lib.so
  /usr/bin/ld: cannot find dynamic_lookup: No such file or directory
  collect2: error: ld returned 1 exit status
  gmake[3]: *** [kernels/quantized/CMakeFiles/quantized_ops_aot_lib.dir/build.make:391: kernels/quantized/libquantized_ops_aot_lib.so] Error 1

Do you see any other error messages further up in the logs?

I can see the following warnings, don’t know if they are relevant

[ 44%] Building C object backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-prod.dir/src/amalgam/gen/avx512vnnigfni.c.o
  In file included from /home/enrico/executorch/executorch/../executorch/runtime/platform/assert.h:13,
                   from /home/enrico/executorch/executorch/../executorch/runtime/core/array_ref.h:32,
                   from /home/enrico/executorch/executorch/../executorch/runtime/core/exec_aten/exec_aten.h:32,
                   from /home/enrico/executorch/executorch/../executorch/extension/aten_util/aten_bridge.h:11,
                   from /home/enrico/executorch/executorch/extension/aten_util/aten_bridge.cpp:9:
  /home/enrico/executorch/executorch/extension/aten_util/aten_bridge.cpp: In function ‘void torch::util::{anonymous}::check_tensor_meta(const at::Tensor&, const Tensor&)’:
  /home/enrico/executorch/executorch/../executorch/runtime/platform/assert.h:24:7: warning: format ‘%hhd’ expects argument of type ‘int’, but argument 9 has type ‘torch::executor::ScalarType’ [-Wformat=]
     24 |       "In function %s(), assert failed" _format, \
  /home/enrico/executorch/executorch/../executorch/runtime/platform/log.h:161:11: note: in definition of macro ‘ET_LOG’
    161 |           _format,                                                            \
        |           ^~~~~~~
  /home/enrico/executorch/executorch/../executorch/runtime/platform/assert.h:39:7: note: in expansion of macro ‘ET_ASSERT_MESSAGE_EMIT’
     39 |       ET_ASSERT_MESSAGE_EMIT(" (%s): " _format, #_cond, ##__VA_ARGS__); \
        |       ^~~~~~~~~~~~~~~~~~~~~~
  /home/enrico/executorch/executorch/extension/aten_util/aten_bridge.cpp:57:3: note: in expansion of macro ‘ET_CHECK_MSG’
     57 |   ET_CHECK_MSG(
        |   ^~~~~~~~~~~~
  /home/enrico/executorch/executorch/extension/aten_util/aten_bridge.cpp:59:31: note: format string is defined here
     59 |       "dtypes dont match a %hhd vs. b %hhd",
        |                            ~~~^
        |                               |
        |                               int
  In file included from /home/enrico/executorch/executorch/../executorch/runtime/platform/assert.h:13,
                   from /home/enrico/executorch/executorch/../executorch/runtime/core/array_ref.h:32,
                   from /home/enrico/executorch/executorch/../executorch/runtime/core/exec_aten/exec_aten.h:32,
                   from /home/enrico/executorch/executorch/../executorch/extension/aten_util/aten_bridge.h:11,
                   from /home/enrico/executorch/executorch/extension/aten_util/aten_bridge.cpp:9:
  /home/enrico/executorch/executorch/../executorch/runtime/platform/assert.h:24:7: warning: format ‘%hhd’ expects argument of type ‘int’, but argument 10 has type ‘torch::executor::ScalarType’ [-Wformat=]
     24 |       "In function %s(), assert failed" _format, \
  /home/enrico/executorch/executorch/../executorch/runtime/platform/log.h:161:11: note: in definition of macro ‘ET_LOG’
    161 |           _format,                                                            \
        |           ^~~~~~~
  /home/enrico/executorch/executorch/../executorch/runtime/platform/assert.h:39:7: note: in expansion of macro ‘ET_ASSERT_MESSAGE_EMIT’
     39 |       ET_ASSERT_MESSAGE_EMIT(" (%s): " _format, #_cond, ##__VA_ARGS__); \
        |       ^~~~~~~~~~~~~~~~~~~~~~
  /home/enrico/executorch/executorch/extension/aten_util/aten_bridge.cpp:57:3: note: in expansion of macro ‘ET_CHECK_MSG’
     57 |   ET_CHECK_MSG(
        |   ^~~~~~~~~~~~
  /home/enrico/executorch/executorch/extension/aten_util/aten_bridge.cpp:59:42: note: format string is defined here
     59 |       "dtypes dont match a %hhd vs. b %hhd",
        |                                       ~~~^
        |                                          |
        |                                          int

and

 [ 55%] Building CXX object kernels/portable/CMakeFiles/portable_kernels.dir/cpu/op_amin.cpp.o
  /home/enrico/executorch/executorch/util/read_file.cpp: In function ‘torch::executor::Error torch::executor::util::read_file_content(const char*, std::shared_ptr<char>*, size_t*)’:
  /home/enrico/executorch/executorch/util/read_file.cpp:49:8: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
     49 |   fread(ptr.get(), fileLen, 1, file);
        |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and

 [ 55%] Building CXX object extension/data_loader/CMakeFiles/extension_data_loader.dir/mmap_data_loader.cpp.o
  In file included from /home/enrico/executorch/executorch/extension/data_loader/../../../executorch/runtime/core/error.h:18,
                   from /home/enrico/executorch/executorch/extension/data_loader/../../../executorch/runtime/core/result.h:19,
                   from /home/enrico/executorch/executorch/extension/data_loader/../../../executorch/runtime/core/data_loader.h:14,
                   from /home/enrico/executorch/executorch/extension/data_loader/../../../executorch/extension/data_loader/mmap_data_loader.h:11,
                   from /home/enrico/executorch/executorch/extension/data_loader/mmap_data_loader.cpp:9:
  /home/enrico/executorch/executorch/extension/data_loader/mmap_data_loader.cpp: In function ‘void torch::executor::util::{anonymous}::MunmapSegment(void*, void*, size_t)’:
  /home/enrico/executorch/executorch/extension/data_loader/mmap_data_loader.cpp:140:9: warning: too many arguments for format [-Wformat-extra-args]
    140 |         "munmap(0x%zx, %zu) failed: %s (ignored)",
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/enrico/executorch/executorch/extension/data_loader/../../../executorch/runtime/platform/log.h:161:11: note: in definition of macro ‘ET_LOG’
    161 |           _format,                                                            \
        |           ^~~~~~~

No, warnings won’t let the code fail.

I get the same error as the original poster. I do get cmake deprecation warnings in the logs, but no errors before this linking error.

[ 90%] Built target portable_kernels
[ 90%] Generating selected_operators.yaml for portable_ops_lib
[ 90%] Linking CXX shared library libquantized_ops_aot_lib.so
c++: error: dynamic_lookup: No such file or directory
make[3]: *** [kernels/quantized/CMakeFiles/quantized_ops_aot_lib.dir/build.make:391: kernels/quantized/libquantized_ops_aot_lib.so] Error 1
make[2]: *** [CMakeFiles/Makefile2:1080: kernels/quantized/CMakeFiles/quantized_ops_aot_lib.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs…
[100%] Generating code for kernel registration
[100%] Building CXX object kernels/portable/CMakeFiles/portable_ops_lib.dir/portable_ops_lib/RegisterCodegenUnboxedKernelsEverything.cpp.o
[100%] Linking CXX static library libportable_ops_lib.a
[100%] Built target portable_ops_lib
make[1]: *** [CMakeFiles/Makefile2:733: CMakeFiles/portable_lib.dir/rule] Error 2
make: *** [Makefile:234: portable_lib] Error 2
error: command ‘/home/xxxx/miniconda3/envs/executorch_llama/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.

You would also need to check for previous errors pointing to a failure related to dynamic_lookup. If you have trouble isolating it, feel free to upload the full log into e.g. a Gist.

This is the full log, including the apt get calls so you can see the version of everything that is installed, in case it helps

Your log does not show your original error and fails with:

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".

pointing to potentially this issue.

Make sure you are able to at least start the build in your environment.

Apologies, I did forget to install cmake the first time, this is the log after I installed it

flatcc fails with a missing file:

  /bin/sh: 1: /home/enrico/executorch/executorch/sdk/../third-party/flatcc/bin/flatcc: not found
  gmake[3]: *** [sdk/CMakeFiles/etdump_schema.dir/build.make:71: sdk/include/executorch/sdk/etdump/etdump_schema_flatcc_reader.h] Error 127
  gmake[2]: *** [CMakeFiles/Makefile2:1974: sdk/CMakeFiles/etdump_schema.dir/all] Error 2

Indeed I do not see executorch/sdk/etdump/etdump_schema_flatcc_reader.h in the current main branch of executorch so you might want to open an isue in their GitHub repository asking if this file is missing by mistake.

2 Likes