Skip to content
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

Building ONNXRuntime v1.8.0 on RPi Zero gives linking error #8062

Closed
FamousDirector opened this issue Jun 15, 2021 · 12 comments
Closed

Building ONNXRuntime v1.8.0 on RPi Zero gives linking error #8062

FamousDirector opened this issue Jun 15, 2021 · 12 comments
Labels
build build issues; typically submitted using template

Comments

@FamousDirector
Copy link

FamousDirector commented Jun 15, 2021

Describe the bug
I am trying to build ONNXRuntime v1.8.0 on RPi Zero. During building I get a pthread linking error. Here is the full stack trace

pi@raspberrypi:~/onnxruntime $ bash build.sh --config MinSizeRel --arm --update --build --build_shared_lib --build_wheel 
2021-06-15 23:04:25,529 build [INFO] - Build started
2021-06-15 23:04:25,534 util.run [INFO] - Running subprocess in '/home/pi/onnxruntime'
['git', 'submodule', 'sync', '--recursive']
Synchronizing submodule url for 'cmake/external/FeaturizersLibrary'
Synchronizing submodule url for 'cmake/external/FeaturizersLibrary/src/3rdParty/eigen'
Synchronizing submodule url for 'cmake/external/FeaturizersLibrary/src/3rdParty/re2'
Synchronizing submodule url for 'cmake/external/SafeInt/safeint'
Synchronizing submodule url for 'cmake/external/coremltools'
Synchronizing submodule url for 'cmake/external/cub'
Synchronizing submodule url for 'cmake/external/cxxopts'
Synchronizing submodule url for 'cmake/external/date'
Synchronizing submodule url for 'cmake/external/dlpack'
Synchronizing submodule url for 'cmake/external/eigen'
Synchronizing submodule url for 'cmake/external/emsdk'
Synchronizing submodule url for 'cmake/external/flatbuffers'
Synchronizing submodule url for 'cmake/external/googlebenchmark'
Synchronizing submodule url for 'cmake/external/googletest'
Synchronizing submodule url for 'cmake/external/json'
Synchronizing submodule url for 'cmake/external/libprotobuf-mutator'
Synchronizing submodule url for 'cmake/external/mimalloc'
Synchronizing submodule url for 'cmake/external/mp11'
Synchronizing submodule url for 'cmake/external/nsync'
Synchronizing submodule url for 'cmake/external/onnx'
Synchronizing submodule url for 'cmake/external/onnx/third_party/benchmark'
Synchronizing submodule url for 'cmake/external/onnx/third_party/pybind11'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang'
Synchronizing submodule url for 'cmake/external/optional-lite'
Synchronizing submodule url for 'cmake/external/protobuf'
Synchronizing submodule url for 'cmake/external/protobuf/third_party/benchmark'
Synchronizing submodule url for 'cmake/external/protobuf/third_party/googletest'
Synchronizing submodule url for 'cmake/external/re2'
Synchronizing submodule url for 'cmake/external/tensorboard'
Synchronizing submodule url for 'cmake/external/tvm'
Synchronizing submodule url for 'cmake/external/tvm/3rdparty/HalideIR'
Synchronizing submodule url for 'cmake/external/tvm/3rdparty/dlpack'
Synchronizing submodule url for 'cmake/external/tvm/3rdparty/dmlc-core'
Synchronizing submodule url for 'cmake/external/tvm/3rdparty/rang'
Synchronizing submodule url for 'cmake/external/wil'
Synchronizing submodule url for 'server/external/spdlog'
2021-06-15 23:04:28,695 util.run [DEBUG] - Subprocess completed. Return code: 0
2021-06-15 23:04:28,700 util.run [INFO] - Running subprocess in '/home/pi/onnxruntime'
['git', 'submodule', 'update', '--init', '--recursive']
2021-06-15 23:04:37,894 util.run [DEBUG] - Subprocess completed. Return code: 0
2021-06-15 23:04:37,901 build [INFO] - Generating CMake build tree
2021-06-15 23:04:37,907 util.run [INFO] - Running subprocess in '/home/pi/onnxruntime/build/Linux/MinSizeRel'
['/usr/bin/cmake', '/home/pi/onnxruntime/cmake', '-Donnxruntime_RUN_ONNX_TESTS=OFF', '-Donnxruntime_BUILD_WINML_TESTS=ON', '-Donnxruntime_GENERATE_TEST_REPORTS=ON', '-Donnxruntime_DEV_MODE=ON', '-DPYTHON_EXECUTABLE=/usr/bin/python3', '-Donnxruntime_USE_CUDA=OFF', '-Donnxruntime_CUDA_VERSION=', '-Donnxruntime_ROCM_VERSION=', '-Donnxruntime_CUDA_HOME=', '-Donnxruntime_CUDNN_HOME=', '-Donnxruntime_USE_FEATURIZERS=OFF', '-Donnxruntime_USE_MIMALLOC_STL_ALLOCATOR=OFF', '-Donnxruntime_USE_MIMALLOC_ARENA_ALLOCATOR=OFF', '-Donnxruntime_ENABLE_PYTHON=ON', '-Donnxruntime_BUILD_CSHARP=OFF', '-Donnxruntime_BUILD_JAVA=OFF', '-Donnxruntime_BUILD_NODEJS=OFF', '-Donnxruntime_BUILD_OBJC=OFF', '-Donnxruntime_BUILD_SHARED_LIB=ON', '-Donnxruntime_BUILD_APPLE_FRAMEWORK=OFF', '-Donnxruntime_USE_DNNL=OFF', '-Donnxruntime_DNNL_GPU_RUNTIME=', '-Donnxruntime_DNNL_OPENCL_ROOT=', '-Donnxruntime_USE_NNAPI_BUILTIN=OFF', '-Donnxruntime_USE_RKNPU=OFF', '-Donnxruntime_USE_OPENMP=OFF', '-Donnxruntime_USE_TVM=OFF', '-Donnxruntime_USE_LLVM=OFF', '-Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF', '-Donnxruntime_USE_VITISAI=OFF', '-Donnxruntime_USE_NUPHAR=OFF', '-Donnxruntime_USE_TENSORRT=OFF', '-Donnxruntime_TENSORRT_HOME=', '-Donnxruntime_USE_MIGRAPHX=OFF', '-Donnxruntime_MIGRAPHX_HOME=', '-Donnxruntime_CROSS_COMPILING=ON', '-Donnxruntime_DISABLE_CONTRIB_OPS=OFF', '-Donnxruntime_DISABLE_ML_OPS=OFF', '-Donnxruntime_DISABLE_RTTI=OFF', '-Donnxruntime_DISABLE_EXCEPTIONS=OFF', '-Donnxruntime_DISABLE_ORT_FORMAT_LOAD=OFF', '-Donnxruntime_MINIMAL_BUILD=OFF', '-Donnxruntime_EXTENDED_MINIMAL_BUILD=OFF', '-Donnxruntime_MINIMAL_BUILD_CUSTOM_OPS=OFF', '-Donnxruntime_REDUCED_OPS_BUILD=OFF', '-Donnxruntime_MSVC_STATIC_RUNTIME=OFF', '-Donnxruntime_ENABLE_LANGUAGE_INTEROP_OPS=OFF', '-Donnxruntime_USE_DML=OFF', '-Donnxruntime_USE_WINML=OFF', '-Donnxruntime_BUILD_MS_EXPERIMENTAL_OPS=OFF', '-Donnxruntime_USE_TELEMETRY=OFF', '-Donnxruntime_ENABLE_LTO=OFF', '-Donnxruntime_USE_ACL=OFF', '-Donnxruntime_USE_ACL_1902=OFF', '-Donnxruntime_USE_ACL_1905=OFF', '-Donnxruntime_USE_ACL_1908=OFF', '-Donnxruntime_USE_ACL_2002=OFF', '-Donnxruntime_USE_ARMNN=OFF', '-Donnxruntime_ARMNN_RELU_USE_CPU=ON', '-Donnxruntime_ARMNN_BN_USE_CPU=ON', '-Donnxruntime_ENABLE_NVTX_PROFILE=OFF', '-Donnxruntime_ENABLE_TRAINING=OFF', '-Donnxruntime_ENABLE_TRAINING_OPS=OFF', '-Donnxruntime_ENABLE_CPU_FP16_OPS=OFF', '-Donnxruntime_USE_NCCL=ON', '-Donnxruntime_BUILD_BENCHMARKS=OFF', '-Donnxruntime_USE_ROCM=OFF', '-Donnxruntime_ROCM_HOME=', '-DOnnxruntime_GCOV_COVERAGE=OFF', '-Donnxruntime_USE_MPI=ON', '-Donnxruntime_ENABLE_MEMORY_PROFILE=OFF', '-Donnxruntime_ENABLE_CUDA_LINE_NUMBER_INFO=OFF', '-Donnxruntime_BUILD_WEBASSEMBLY=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING=ON', '-Donnxruntime_ENABLE_WEBASSEMBLY_THREADS=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO=OFF', '-Donnxruntime_ENABLE_EAGER_MODE=OFF', '-Donnxruntime_PYBIND_EXPORT_OPSCHEMA=OFF', '-Donnxruntime_ENABLE_MEMLEAK_CHECKER=OFF', '-DCMAKE_BUILD_TYPE=MinSizeRel']
F16C instruction set is not supported.
FMA instruction set is not supported.
AVX instruction set is not supported.
One or more AVX/F16C instruction flags are not supported. 
Use gtest from submodule
Doing crosscompiling
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.7.3", minimum required is "3.5") 
-- Found PythonLibs: /usr/lib/arm-linux-gnueabihf/libpython3.7m.so (found suitable version "3.7.3", minimum required is "3.5") 
Use protobuf from submodule
-- 
-- 3.16.0.0
-- Using the single-header code from /home/pi/onnxruntime/cmake/external/json/single_include/
NVCC_ERROR = 
NVCC_OUT = No such file or directory
-- Found PythonInterp: /usr/bin/python3 (found version "3.7.3") 
-- Found PythonLibs: /usr/lib/arm-linux-gnueabihf/libpython3.7m.so (found version "3.7.3") 
Generated: /home/pi/onnxruntime/build/Linux/MinSizeRel/external/onnx/onnx/onnx-ml.proto
Generated: /home/pi/onnxruntime/build/Linux/MinSizeRel/external/onnx/onnx/onnx-operators-ml.proto
Generated: /home/pi/onnxruntime/build/Linux/MinSizeRel/external/onnx/onnx/onnx-data.proto
-- 
-- ******** Summary ********
--   CMake version             : 3.16.3
--   CMake command             : /usr/bin/cmake
--   System                    : Linux
--   C++ compiler              : /usr/bin/c++
--   C++ compiler version      : 8.3.0
--   CXX flags                 :  -ffunction-sections -fdata-sections -Wno-error=attributes -Wnon-virtual-dtor
--   Build type                : MinSizeRel
--   Compile definitions       : ENABLE_ORT_FORMAT_LOAD;EIGEN_MPL2_ONLY;PLATFORM_POSIX
--   CMAKE_PREFIX_PATH         : 
--   CMAKE_INSTALL_PREFIX      : /usr/local
--   CMAKE_MODULE_PATH         : /home/pi/onnxruntime/cmake/external
-- 
--   ONNX version              : 1.9.1
--   ONNX NAMESPACE            : onnx
--   ONNX_USE_LITE_PROTO       : ON
--   USE_PROTOBUF_SHARED_LIBS  : OFF
--   ONNX_DISABLE_EXCEPTIONS   : OFF
--   ONNX_WERROR               : OFF
--   ONNX_BUILD_TESTS          : OFF
--   ONNX_BUILD_BENCHMARKS     : OFF
--   ONNXIFI_DUMMY_BACKEND     : OFF
--   ONNXIFI_ENABLE_EXT        : OFF
-- 
--   Protobuf compiler         : 
--   Protobuf includes         : 
--   Protobuf libraries        : 
--   BUILD_ONNX_PYTHON         : OFF
-- NumPy ver. 1.20.3 found (include: /home/pi/.local/lib/python3.7/site-packages/numpy/core/include)
CMake Warning at flake8.cmake:19 (message):
  Could not find 'flake8' to check python scripts.  Please install flake8
  using pip.
Call Stack (most recent call first):
  CMakeLists.txt:1731 (include)


-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/onnxruntime/build/Linux/MinSizeRel
2021-06-15 23:05:02,431 util.run [DEBUG] - Subprocess completed. Return code: 0
2021-06-15 23:05:02,435 build [INFO] - Building targets for MinSizeRel configuration
2021-06-15 23:05:02,445 util.run [INFO] - Running subprocess in '/home/pi/onnxruntime'
['/usr/bin/cmake', '--build', '/home/pi/onnxruntime/build/Linux/MinSizeRel', '--config', 'MinSizeRel']
[  0%] Built target flatbuffers
[  0%] Built target onnxruntime_mocked_allocator
[  2%] Built target onnxruntime_mlas
[ 10%] Built target libprotobuf
[ 17%] Built target libprotoc
[ 17%] Built target protoc
[ 17%] Built target gen_onnx_proto
[ 20%] Built target libprotobuf-lite
[ 21%] Built target onnx_proto
[ 22%] Built target onnxruntime_session
[ 26%] Built target flatc
[ 26%] Built target onnxruntime_flatbuffers
[ 26%] Built target onnxruntime_generate_def
[ 26%] Built target onnxruntime_util
[ 32%] Built target onnxruntime_optimizer
[ 37%] Built target onnx
[ 53%] Built target onnxruntime_providers
[ 55%] Built target onnxruntime_common
[ 57%] Built target onnxruntime_graph
[ 63%] Built target onnxruntime_framework
[ 66%] Built target nsync_cpp
[ 68%] Built target re2
[ 68%] Linking CXX shared library libonnxruntime.so
/usr/bin/ld: libonnxruntime_common.a(env.cc.o): in function `onnxruntime::(anonymous namespace)::PosixThread::~PosixThread()':
env.cc:(.text._ZN11onnxruntime12_GLOBAL__N_111PosixThreadD2Ev+0x20): undefined reference to `pthread_join'
/usr/bin/ld: libonnxruntime_common.a(env.cc.o): in function `onnxruntime::(anonymous namespace)::PosixThread::PosixThread(char const*, int, unsigned int (*)(int, Eigen::ThreadPoolInterface*), Eigen::ThreadPoolInterface*, onnxruntime::ThreadOptions const&)':
env.cc:(.text._ZN11onnxruntime12_GLOBAL__N_111PosixThreadC2EPKciPFjiPN5Eigen19ThreadPoolInterfaceEES6_RKNS_13ThreadOptionsE+0xfc): undefined reference to `pthread_attr_setstacksize'
/usr/bin/ld: env.cc:(.text._ZN11onnxruntime12_GLOBAL__N_111PosixThreadC2EPKciPFjiPN5Eigen19ThreadPoolInterfaceEES6_RKNS_13ThreadOptionsE+0x1a0): undefined reference to `pthread_create'
/usr/bin/ld: env.cc:(.text._ZN11onnxruntime12_GLOBAL__N_111PosixThreadC2EPKciPFjiPN5Eigen19ThreadPoolInterfaceEES6_RKNS_13ThreadOptionsE+0x264): undefined reference to `pthread_setaffinity_np'
/usr/bin/ld: external/re2/libre2.a(regexp.cc.o): in function `std::call_once<re2::Regexp::Incref()::{lambda()#1}>(std::once_flag&, re2::Regexp::Incref()::{lambda()#1}&&)::{lambda()#2}::_FUN()':
regexp.cc:(.text._ZZSt9call_onceIZN3re26Regexp6IncrefEvEUlvE_JEEvRSt9once_flagOT_DpOT0_ENUlvE0_4_FUNEv+0x14): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: external/re2/libre2.a(regexp.cc.o): in function `re2::Mutex::Lock()':
regexp.cc:(.text._ZN3re25Mutex4LockEv[_ZN3re25Mutex4LockEv]+0x4): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: external/re2/libre2.a(regexp.cc.o): in function `re2::MutexLock::~MutexLock()':
regexp.cc:(.text._ZN3re29MutexLockD2Ev[_ZN3re29MutexLockD5Ev]+0xc): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: external/re2/libre2.a(dfa.cc.o): in function `re2::Mutex::Mutex()':
dfa.cc:(.text._ZN3re25MutexC2Ev[_ZN3re25MutexC5Ev]+0xc): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: external/re2/libre2.a(dfa.cc.o): in function `re2::Mutex::~Mutex()':
dfa.cc:(.text._ZN3re25MutexD2Ev[_ZN3re25MutexD5Ev]+0x8): undefined reference to `pthread_rwlock_destroy'
/usr/bin/ld: external/re2/libre2.a(dfa.cc.o): in function `re2::Mutex::Unlock()':
dfa.cc:(.text._ZN3re25Mutex6UnlockEv[_ZN3re25Mutex6UnlockEv]+0x4): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: external/re2/libre2.a(dfa.cc.o): in function `re2::Mutex::ReaderUnlock()':
dfa.cc:(.text._ZN3re25Mutex12ReaderUnlockEv[_ZN3re25Mutex12ReaderUnlockEv]+0x4): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: external/re2/libre2.a(dfa.cc.o): in function `re2::DFA::RWLocker::RWLocker(re2::Mutex*)':
dfa.cc:(.text._ZN3re23DFA8RWLockerC2EPNS_5MutexE+0x18): undefined reference to `pthread_rwlock_rdlock'
/usr/bin/ld: external/nsync/libnsync_cpp.a(per_thread_waiter.c.o): in function `nsync::do_once(std::atomic<unsigned int>*, void (*)(void*)) [clone .constprop.1]':
per_thread_waiter.c:(.text._ZN5nsyncL7do_onceEPSt6atomicIjEPFvPvE.constprop.1+0x60): undefined reference to `pthread_key_create'
/usr/bin/ld: external/nsync/libnsync_cpp.a(per_thread_waiter.c.o): in function `nsync::nsync_set_per_thread_waiter_(void*, void (*)(void*))':
per_thread_waiter.c:(.text._ZN5nsync28nsync_set_per_thread_waiter_EPvPFvS0_E+0x20): undefined reference to `pthread_setspecific'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/onnxruntime.dir/build.make:108: libonnxruntime.so.1.8.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:597: CMakeFiles/onnxruntime.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
Traceback (most recent call last):
  File "/home/pi/onnxruntime/tools/ci_build/build.py", line 2152, in <module>
    sys.exit(main())
  File "/home/pi/onnxruntime/tools/ci_build/build.py", line 2076, in main
    build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, args.target)
  File "/home/pi/onnxruntime/tools/ci_build/build.py", line 1067, in build_targets
    run_subprocess(cmd_args, env=env)
  File "/home/pi/onnxruntime/tools/ci_build/build.py", line 581, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
  File "/home/pi/onnxruntime/tools/python/util/run.py", line 44, in run
    env=env, shell=shell)
  File "/usr/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/cmake', '--build', '/home/pi/onnxruntime/build/Linux/MinSizeRel', '--config', 'MinSizeRel']' returned non-zero exit status 2.

Urgency
None

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Rasbian 10 (Debian Buster)
  • ONNX Runtime installed from (source or binary): source
  • ONNX Runtime version: v1.8.0
  • Python version: 3.7.3
  • Visual Studio version (if applicable): N/A
  • GCC/Compiler version (if compiling from source): 8.3.0
  • CUDA/cuDNN version: N/A
  • GPU model and memory: N/A

To Reproduce

  • Building with the following command: bash build.sh --config MinSizeRel --arm --update --build --build_shared_lib --build_wheel

Expected behavior
The library to build...

Screenshots
None

Additional context
I am not picky on version either. If an older version of ONNX works then I will revert and build from source.

PS. I'd estimate the complete build time of this to be 14 hours on this device.

@snnn
Copy link
Member

snnn commented Jun 15, 2021

Could you please run "make VERBOSE=1" in /home/pi/onnxruntime/build/Linux/MinSizeRel and post the log here?

If build time is a concern, please try cross-compiling, which will only take a few minutes(vs 10+ hours).

@snnn
Copy link
Member

snnn commented Jun 15, 2021

As a quick fix, you may open cmake/CMakeLists.txt,
Find https://github.com/microsoft/onnxruntime/blob/master/cmake/CMakeLists.txt#L1613

list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${CMAKE_DL_LIBS} Threads::Threads)

And change it to

list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${CMAKE_DL_LIBS} pthread)

@FamousDirector
Copy link
Author

I'm a bit of a noob at cross compiling. How would I do this for an armv6 architecture?

@snnn
Copy link
Member

snnn commented Jun 16, 2021

@hanbitmyths hanbitmyths added the build build issues; typically submitted using template label Jun 16, 2021
@FamousDirector
Copy link
Author

FamousDirector commented Jun 16, 2021

Okay so I followed those instructions and cross compiled the library with the following Dockerfile:

FROM balenalib/raspberry-pi-python:3.7-stretch-build

ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_SERVER_BRANCH=v1.8.0

# Enforces cross-compilation through Qemu.
RUN [ "cross-build-start" ]

RUN install_packages \
    sudo \
    build-essential \
    curl \
    libcurl4-openssl-dev \
    libssl-dev \
    wget \
    python3 \
    python3-dev \
    git \
    tar \
    libatlas-base-dev

# Carefully install the latest version of pip 
WORKDIR /pip
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python3 get-pip.py
RUN pip3 install --upgrade setuptools
RUN pip3 install --upgrade wheel
RUN pip3 install numpy

# Build the latest cmake
WORKDIR /code
RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-3.20.3.tar.gz
RUN tar zxf cmake-3.20.3.tar.gz 

WORKDIR /code/cmake-3.20.3
RUN ./configure --system-curl
RUN make
RUN sudo make install

# Set up build args
ARG BUILDTYPE=MinSizeRel
# if doing a 64-bit build change '--arm' to '--arm64'
ARG BUILDARGS="--config ${BUILDTYPE} --arm"

# Prepare onnxruntime Repo
WORKDIR /code
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime

# Build ORT including the shared lib and python bindings
WORKDIR /code/onnxruntime
RUN ./build.sh ${BUILDARGS} --update --build --build_shared_lib --build_wheel --parallel

# Build Output
RUN ls -l /code/onnxruntime/build/Linux/${BUILDTYPE}/*.so
RUN ls -l /code/onnxruntime/build/Linux/${BUILDTYPE}/dist/*.whl

RUN [ "cross-build-end" ]

However after copying the wheel file (onnxruntime-1.8.0-cp37-cp37m-linux_armv6l.whl) to the RPi Zero and running python3 -c "import onnxruntime" I get the error:

Illegal instruction

@snnn
Copy link
Member

snnn commented Jun 16, 2021

Sorry I don't understand the docker file. It was not written by me. I can't provider further help on it. It is not relevant to the build document I showed you.

@FamousDirector
Copy link
Author

I modified it from the documentation here. I scrolled up in the document you send and got it from here.

@kcoul
Copy link

kcoul commented Mar 6, 2024

As a quick fix, you may open cmake/CMakeLists.txt, Find https://github.com/microsoft/onnxruntime/blob/master/cmake/CMakeLists.txt#L1613

list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${CMAKE_DL_LIBS} Threads::Threads)

And change it to

list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${CMAKE_DL_LIBS} pthread)

As it turns out, it's important to also add -pthread to compile options of all external libs as well. Below

function(onnxruntime_set_compile_flags target_name) add
target_compile_options(${target_name} PRIVATE -pthread)

@snnn
Copy link
Member

snnn commented Apr 22, 2024

#20413

@rpatapa
Copy link

rpatapa commented May 20, 2024

#20413

So, is it possible to install onnxruntime on raspberrypi zero or not? If yes, could you advice the steps to install?
Please confirm!

@Joldiges
Copy link

#20413

So, is it possible to install onnxruntime on raspberrypi zero or not? If yes, could you advice the steps to install? Please confirm!

Bump

@snnn
Copy link
Member

snnn commented Oct 21, 2024

nsync is removed. If you still see

undefined reference to `pthread_rwlock_wrlock'

Please go to the build folder and run

make VERBOSE=1 >& build.log

Then find the failed build command in the log file and post the full command here.

@snnn snnn closed this as completed Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template
Projects
None yet
Development

No branches or pull requests

6 participants