microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.13k stars 2.85k forks source link

[Build] Error building docker ROCm #13503

Closed timpraferi closed 1 year ago

timpraferi commented 1 year ago

Describe the issue

I'm trying to build the ROCm docker image and its failing.

CMake Error at CMakeLists.txt:1887 (cmake_minimum_required): CMake 3.23.1 or higher is required. You are running version

Seams to be a CMake minimum version error. Tried adding this line to the Dockerfile and it didn't work.

RUN apt-get update \
  && apt-get -y install build-essential \
  && apt-get install -y wget \
  && rm -rf /var/lib/apt/lists/* \
  && wget https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1-Linux-x86_64.sh \
      -q -O /tmp/cmake-install.sh \
      && chmod u+x /tmp/cmake-install.sh \
      && mkdir /opt/cmake-3.24.1 \
      && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-3.24.1 \
      && rm /tmp/cmake-install.sh \
      && ln -s /opt/cmake-3.24.1/bin/* /usr/local/bin

Urgency

No response

Target platform

Linux, Python, x86_64, ROCm (Preview) Linux 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Build script

$ git clone https://github.com/microsoft/onnxruntime
$ cd onnxruntime/dockerfiles
$ docker build -t onnxruntime-rocm -f Dockerfile.rocm .

Error / output

Sending build context to Docker daemon  67.07kB
Step 1/5 : FROM rocm/pytorch:rocm5.2.3_ubuntu20.04_py3.7_pytorch_1.12.1
 ---> c2ed632773ee
Step 2/5 : ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
 ---> Using cache
 ---> e59e5cdbab5e
Step 3/5 : ARG ONNXRUNTIME_BRANCH=main
 ---> Using cache
 ---> 3d97605aaf0e
Step 4/5 : WORKDIR /code
 ---> Using cache
 ---> ff3c65e26eda
Step 5/5 : RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&    cd onnxruntime &&    /bin/sh ./build.sh --config Release --build_wheel --update --build --parallel --cmake_extra_defines            ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) --use_rocm --rocm_home=/opt/rocm &&    pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&    cd ..
 ---> Running in 5ba6d08154c2
Cloning into 'onnxruntime'...
Updating files: 100% (6524/6524), done.
Submodule 'cmake/external/FP16' (https://github.com/Maratyszcza/FP16.git) registered for path 'cmake/external/FP16'
Submodule 'cmake/external/SafeInt/safeint' (https://github.com/dcleblanc/SafeInt.git) registered for path 'cmake/external/SafeInt/safeint'
Submodule 'cmake/external/XNNPACK' (https://github.com/google/XNNPACK.git) registered for path 'cmake/external/XNNPACK'
Submodule 'cmake/external/cub' (https://github.com/NVlabs/cub.git) registered for path 'cmake/external/cub'
Submodule 'cmake/external/cxxopts' (https://github.com/jarro2783/cxxopts.git) registered for path 'cmake/external/cxxopts'
Submodule 'cmake/external/date' (https://github.com/HowardHinnant/date.git) registered for path 'cmake/external/date'
Submodule 'cmake/external/dlpack' (https://github.com/dmlc/dlpack.git) registered for path 'cmake/external/dlpack'
Submodule 'cmake/external/eigen' (https://gitlab.com/libeigen/eigen.git) registered for path 'cmake/external/eigen'
Submodule 'cmake/external/emsdk' (https://github.com/emscripten-core/emsdk.git) registered for path 'cmake/external/emsdk'
Submodule 'cmake/external/flatbuffers' (https://github.com/google/flatbuffers.git) registered for path 'cmake/external/flatbuffers'
Submodule 'cmake/external/googlebenchmark' (https://github.com/google/benchmark.git) registered for path 'cmake/external/googlebenchmark'
Submodule 'cmake/external/googletest' (https://github.com/google/googletest.git) registered for path 'cmake/external/googletest'
Submodule 'cmake/external/json' (https://github.com/nlohmann/json.git) registered for path 'cmake/external/json'
Submodule 'cmake/external/libprotobuf-mutator' (https://github.com/google/libprotobuf-mutator.git) registered for path 'cmake/external/libprotobuf-mutator'
Submodule 'cmake/external/mimalloc' (https://github.com/microsoft/mimalloc.git) registered for path 'cmake/external/mimalloc'
Submodule 'cmake/external/mp11' (https://github.com/boostorg/mp11.git) registered for path 'cmake/external/mp11'
Submodule 'cmake/external/nsync' (https://github.com/google/nsync.git) registered for path 'cmake/external/nsync'
Submodule 'cmake/external/onnx' (https://github.com/onnx/onnx.git) registered for path 'cmake/external/onnx'
Submodule 'cmake/external/onnx-tensorrt' (https://github.com/onnx/onnx-tensorrt.git) registered for path 'cmake/external/onnx-tensorrt'
Submodule 'cmake/external/onnxruntime-extensions' (https://github.com/microsoft/onnxruntime-extensions.git) registered for path 'cmake/external/onnxruntime-extensions'
Submodule 'cmake/external/protobuf' (https://github.com/protocolbuffers/protobuf.git) registered for path 'cmake/external/protobuf'
Submodule 'cmake/external/pthreadpool' (https://github.com/Maratyszcza/pthreadpool.git) registered for path 'cmake/external/pthreadpool'
Submodule 'cmake/external/pytorch_cpuinfo' (https://github.com/pytorch/cpuinfo.git) registered for path 'cmake/external/pytorch_cpuinfo'
Submodule 'cmake/external/re2' (https://github.com/google/re2.git) registered for path 'cmake/external/re2'
Submodule 'cmake/external/tensorboard' (https://github.com/tensorflow/tensorboard.git) registered for path 'cmake/external/tensorboard'
Submodule 'cmake/external/wil' (https://github.com/microsoft/wil.git) registered for path 'cmake/external/wil'
Cloning into '/code/onnxruntime/cmake/external/FP16'...
Cloning into '/code/onnxruntime/cmake/external/SafeInt/safeint'...
Cloning into '/code/onnxruntime/cmake/external/XNNPACK'...
Cloning into '/code/onnxruntime/cmake/external/cub'...
Cloning into '/code/onnxruntime/cmake/external/cxxopts'...
Cloning into '/code/onnxruntime/cmake/external/date'...
Cloning into '/code/onnxruntime/cmake/external/dlpack'...
Cloning into '/code/onnxruntime/cmake/external/eigen'...
Cloning into '/code/onnxruntime/cmake/external/emsdk'...
Cloning into '/code/onnxruntime/cmake/external/flatbuffers'...
Cloning into '/code/onnxruntime/cmake/external/googlebenchmark'...
Cloning into '/code/onnxruntime/cmake/external/googletest'...
Cloning into '/code/onnxruntime/cmake/external/json'...
Cloning into '/code/onnxruntime/cmake/external/libprotobuf-mutator'...
Cloning into '/code/onnxruntime/cmake/external/mimalloc'...
Cloning into '/code/onnxruntime/cmake/external/mp11'...
Cloning into '/code/onnxruntime/cmake/external/nsync'...
Cloning into '/code/onnxruntime/cmake/external/onnx'...
Cloning into '/code/onnxruntime/cmake/external/onnx-tensorrt'...
Cloning into '/code/onnxruntime/cmake/external/onnxruntime-extensions'...
Cloning into '/code/onnxruntime/cmake/external/protobuf'...
Cloning into '/code/onnxruntime/cmake/external/pthreadpool'...
Cloning into '/code/onnxruntime/cmake/external/pytorch_cpuinfo'...
Cloning into '/code/onnxruntime/cmake/external/re2'...
Cloning into '/code/onnxruntime/cmake/external/tensorboard'...
Cloning into '/code/onnxruntime/cmake/external/wil'...
Submodule path 'cmake/external/FP16': checked out '0a92994d729ff76a58f692d3028ca1b64b145d91'
Submodule path 'cmake/external/SafeInt/safeint': checked out 'ff15c6ada150a5018c5ef2172401cb4529eac9c0'
Submodule path 'cmake/external/XNNPACK': checked out '003c580e696a774afdc984996ee909b7c8d8128c'
Submodule path 'cmake/external/cub': checked out 'c3cceac115c072fb63df1836ff46d8c60d9eb304'
Submodule path 'cmake/external/cxxopts': checked out '3c73d91c0b04e2b59462f0a741be8c07024c1bc0'
Submodule path 'cmake/external/date': checked out 'e7e1482087f58913b80a20b04d5c58d9d6d90155'
Submodule path 'cmake/external/dlpack': checked out '277508879878e0a5b5b43599b1bea11f66eb3c6c'
Submodule path 'cmake/external/eigen': checked out 'd10b27fe37736d2944630ecd7557cefa95cf87c9'
Submodule path 'cmake/external/emsdk': checked out 'c220895fd1163c01f0a8b44229fb9e4fe0ae0958'
Submodule path 'cmake/external/flatbuffers': checked out '6df40a2471737b27271bdd9b900ab5f3aec746c7'
Submodule path 'cmake/external/googlebenchmark': checked out '7d0d9061d83b663ce05d9de5da3d5865a3845b79'
Submodule path 'cmake/external/googletest': checked out '58d77fa8070e8cec2dc1ed015d66b454c8d78850'
Submodule path 'cmake/external/json': checked out 'b5364faf9d732052506cefc933d3f4e4f04513a5'
Submodule path 'cmake/external/libprotobuf-mutator': checked out '7a2ed51a6b682a83e345ff49fc4cfd7ca47550db'
Submodule path 'cmake/external/mimalloc': checked out 'f412df7a2b64421e1f1d61fde6055a6ea288e8f5'
Submodule path 'cmake/external/mp11': checked out '21cace4e574180ba64d9307a5e4ea9e5e94d3e8d'
Submodule path 'cmake/external/nsync': checked out '436617053d0f39a1019a371c3a9aa599b3cb2cea'
Submodule path 'cmake/external/onnx': checked out '5a5f8a5935762397aa68429b5493084ff970f774'
Submodule 'third_party/benchmark' (https://github.com/google/benchmark.git) registered for path 'cmake/external/onnx/third_party/benchmark'
Submodule 'third_party/pybind11' (https://github.com/pybind/pybind11.git) registered for path 'cmake/external/onnx/third_party/pybind11'
Cloning into '/code/onnxruntime/cmake/external/onnx/third_party/benchmark'...
Cloning into '/code/onnxruntime/cmake/external/onnx/third_party/pybind11'...
Submodule path 'cmake/external/onnx/third_party/benchmark': checked out '0d98dba29d66e93259db7daa53a9327df767a415'
Submodule path 'cmake/external/onnx/third_party/pybind11': checked out 'ffa346860b306c9bbfb341aed9c14c067751feb8'
Submodule path 'cmake/external/onnx-tensorrt': checked out '87c7a70688fd98fb355b8976f41425b40e4fe52f'
Submodule 'third_party/onnx' (https://github.com/onnx/onnx.git) registered for path 'cmake/external/onnx-tensorrt/third_party/onnx'
Cloning into '/code/onnxruntime/cmake/external/onnx-tensorrt/third_party/onnx'...
Submodule path 'cmake/external/onnx-tensorrt/third_party/onnx': checked out '553df22c67bee5f0fe6599cff60f1afc6748c635'
Submodule 'third_party/benchmark' (https://github.com/google/benchmark.git) registered for path 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark'
Submodule 'third_party/pybind11' (https://github.com/pybind/pybind11.git) registered for path 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11'
Cloning into '/code/onnxruntime/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark'...
Cloning into '/code/onnxruntime/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11'...
Submodule path 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark': checked out 'e776aa0275e293707b6a0901e0e8d8a8a3679508'
Submodule path 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11': checked out '09f082940113661256310e3f4811aa7261a9fa05'
Submodule 'tools/clang' (https://github.com/wjakob/clang-cindex-python3) registered for path 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang'
Cloning into '/code/onnxruntime/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang'...
Submodule path 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang': checked out '6a00cbc4a9b8e68b71caf7f774b3f9c753ae84d5'
Submodule path 'cmake/external/onnxruntime-extensions': checked out 'd4b2aff0c890ae38bad87c20f5731333db2a2cc1'
Submodule path 'cmake/external/protobuf': checked out 'a902b39270841beafc307dfa709610aa1cac2f06'
Submodule 'third_party/benchmark' (https://github.com/google/benchmark.git) registered for path 'cmake/external/protobuf/third_party/benchmark'
Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'cmake/external/protobuf/third_party/googletest'
Cloning into '/code/onnxruntime/cmake/external/protobuf/third_party/benchmark'...
Cloning into '/code/onnxruntime/cmake/external/protobuf/third_party/googletest'...
Submodule path 'cmake/external/protobuf/third_party/benchmark': checked out '5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8'
Submodule path 'cmake/external/protobuf/third_party/googletest': checked out '5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081'
Submodule path 'cmake/external/pthreadpool': checked out '1787867f6183f056420e532eec640cba25efafea'
Submodule path 'cmake/external/pytorch_cpuinfo': checked out '5916273f79a21551890fd3d56fc5375a78d1598d'
Submodule path 'cmake/external/re2': checked out '4244cd1cb492fa1d10986ec67f862964c073f844'
Submodule path 'cmake/external/tensorboard': checked out '373eb09e4c5d2b3cc2493f0949dc4be6b6a45e81'
Submodule path 'cmake/external/wil': checked out 'e8c599bca6c56c44b6730ad93f6abbc9ecd60fc1'
./build.sh: 6: Bad substitution
./build.sh: 15: [[: not found
./build.sh: 17: [[: not found
2022-10-30 07:37:11,327 build [DEBUG] - Command line arguments:
  --build_dir /code/onnxruntime/build/Linux --config Release --build_wheel --update --build --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=1.14.0 --use_rocm --rocm_home=/opt/rocm
2022-10-30 07:37:11,332 build [INFO] - Build started
2022-10-30 07:37:11,333 util.run [INFO] - Running subprocess in '/code/onnxruntime'
  git submodule sync --recursive
Synchronizing submodule url for 'cmake/external/FP16'
Synchronizing submodule url for 'cmake/external/SafeInt/safeint'
Synchronizing submodule url for 'cmake/external/XNNPACK'
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/onnxruntime-extensions'
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/pthreadpool'
Synchronizing submodule url for 'cmake/external/pytorch_cpuinfo'
Synchronizing submodule url for 'cmake/external/re2'
Synchronizing submodule url for 'cmake/external/tensorboard'
Synchronizing submodule url for 'cmake/external/wil'
2022-10-30 07:37:11,564 util.run [DEBUG] - Subprocess completed. Return code: 0
2022-10-30 07:37:11,565 util.run [INFO] - Running subprocess in '/code/onnxruntime'
  git submodule update --init --recursive
2022-10-30 07:37:12,308 util.run [DEBUG] - Subprocess completed. Return code: 0
2022-10-30 07:37:12,309 build [INFO] - Generating CMake build tree
2022-10-30 07:37:12,310 util.run [INFO] - Running subprocess in '/code/onnxruntime/build/Linux/Release'
  /opt/conda/bin/cmake /code/onnxruntime/cmake -Donnxruntime_RUN_ONNX_TESTS=OFF -Donnxruntime_GENERATE_TEST_REPORTS=ON -DPython_EXECUTABLE=/opt/conda/bin/python3 -DPYTHON_EXECUTABLE=/opt/conda/bin/python3 -Donnxruntime_USE_MIMALLOC=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=OFF -Donnxruntime_BUILD_APPLE_FRAMEWORK=OFF -Donnxruntime_USE_DNNL=OFF -Donnxruntime_USE_NNAPI_BUILTIN=OFF -Donnxruntime_USE_RKNPU=OFF -Donnxruntime_USE_LLVM=OFF -Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF -Donnxruntime_USE_VITISAI=OFF -Donnxruntime_USE_TENSORRT=OFF -Donnxruntime_USE_TENSORRT_BUILTIN_PARSER=OFF -Donnxruntime_TENSORRT_PLACEHOLDER_BUILDER=OFF -Donnxruntime_USE_TVM=OFF -Donnxruntime_TVM_CUDA_RUNTIME=OFF -Donnxruntime_TVM_USE_HASH=OFF -Donnxruntime_USE_MIGRAPHX=OFF -Donnxruntime_CROSS_COMPILING=OFF -Donnxruntime_DISABLE_CONTRIB_OPS=OFF -Donnxruntime_DISABLE_ML_OPS=OFF -Donnxruntime_DISABLE_RTTI=OFF -Donnxruntime_DISABLE_EXCEPTIONS=OFF -Donnxruntime_MINIMAL_BUILD=OFF -Donnxruntime_EXTENDED_MINIMAL_BUILD=OFF -Donnxruntime_MINIMAL_BUILD_CUSTOM_OPS=OFF -Donnxruntime_REDUCED_OPS_BUILD=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_TRAINING_TORCH_INTEROP=OFF -Donnxruntime_ENABLE_TRAINING_ON_DEVICE=OFF -Donnxruntime_ENABLE_CPU_FP16_OPS=OFF -Donnxruntime_USE_NCCL=OFF -Donnxruntime_BUILD_BENCHMARKS=OFF -Donnxruntime_USE_ROCM=ON -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_BUILD_WEBASSEMBLY_STATIC_LIB=OFF -Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING=ON -Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_THROWING=OFF -Donnxruntime_ENABLE_WEBASSEMBLY_THREADS=OFF -Donnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO=OFF -Donnxruntime_ENABLE_WEBASSEMBLY_PROFILING=OFF -Donnxruntime_ENABLE_EAGER_MODE=OFF -Donnxruntime_ENABLE_LAZY_TENSOR=OFF -Donnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS=OFF -Donnxruntime_ENABLE_CUDA_PROFILING=OFF -Donnxruntime_ENABLE_ROCM_PROFILING=OFF -Donnxruntime_USE_XNNPACK=OFF -Donnxruntime_USE_CANN=OFF -Donnxruntime_ROCM_HOME=/opt/rocm -Donnxruntime_ROCM_VERSION= -DONNXRUNTIME_VERSION=1.14.0 -Donnxruntime_DEV_MODE=ON -Donnxruntime_PYBIND_EXPORT_OPSCHEMA=OFF -Donnxruntime_ENABLE_MEMLEAK_CHECKER=OFF -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Building ONNX Runtime for x86_64
-- Performing Test onnxruntime_HAVE_BUILTIN_ATOMICS
-- Performing Test onnxruntime_HAVE_BUILTIN_ATOMICS - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found Patch: /usr/bin/patch  
Patch found: /usr/bin/patch
-- Performing Test COMPILER_SUPPORT_MF16C
-- Performing Test COMPILER_SUPPORT_MF16C - Success
-- Performing Test COMPILER_SUPPORT_FMA
-- Performing Test COMPILER_SUPPORT_FMA - Success
-- Performing Test COMPILER_SUPPORT_AVX
-- Performing Test COMPILER_SUPPORT_AVX - Success
Use gtest from submodule
-- Found Python: /opt/conda/bin/python3 (found version "3.7.13") found components: Interpreter 
-- Found Python: /opt/conda/bin/python3 (found suitable version "3.7.13", minimum required is "3.6") found components: Interpreter Development.Module NumPy 
Use nsync from submodule
Use protobuf from submodule
-- 
-- 3.18.3.0
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success
Use date from submodule
# date: USE_SYSTEM_TZ_DB ON
# date: USE_TZ_DB_IN_DOT OFF
# date: BUILD_SHARED_LIBS OFF
# date: ENABLE_DATE_TESTING OFF
Use mp11 from submodule
Use json from submodule
-- Using the single-header code from /code/onnxruntime/cmake/external/json/single_include/
Use re2 from submodule
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
Use cpuinfo from submodule
-- Performing Test HAS_UNUSED_BUT_SET_PARAMETER
-- Performing Test HAS_UNUSED_BUT_SET_PARAMETER - Success
-- Performing Test HAS_UNUSED_BUT_SET_VARIABLE
-- Performing Test HAS_UNUSED_BUT_SET_VARIABLE - Success
-- Performing Test HAS_UNUSED_VARIABLE
-- Performing Test HAS_UNUSED_VARIABLE - Success
-- Performing Test HAS_CAST_FUNCTION_TYPE
-- Performing Test HAS_CAST_FUNCTION_TYPE - Success
-- Performing Test HAS_PARENTHESES
-- Performing Test HAS_PARENTHESES - Success
-- Performing Test HAS_USELESS_CAST
-- Performing Test HAS_USELESS_CAST - Success
-- Performing Test HAS_NONNULL_COMPARE
-- Performing Test HAS_NONNULL_COMPARE - Success
-- Performing Test HAS_TAUTOLOGICAL_POINTER_COMPARE
-- Performing Test HAS_TAUTOLOGICAL_POINTER_COMPARE - Failed
-- Performing Test HAS_CATCH_VALUE
-- Performing Test HAS_CATCH_VALUE - Success
-- Performing Test HAS_MISSING_BRACES
-- Performing Test HAS_MISSING_BRACES - Success
-- Performing Test HAS_IGNORED_ATTRIBUTES
-- Performing Test HAS_IGNORED_ATTRIBUTES - Success
-- Performing Test HAS_DEPRECATED_COPY
-- Performing Test HAS_DEPRECATED_COPY - Success
-- Performing Test HAS_DEPRECATED_DECLARATIONS
-- Performing Test HAS_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAS_CLASS_MEMACCESS
-- Performing Test HAS_CLASS_MEMACCESS - Success
-- Performing Test HAS_MAYBE_UNINITIALIZED
-- Performing Test HAS_MAYBE_UNINITIALIZED - Success
-- Performing Test HAS_STRICT_ALIASING
-- Performing Test HAS_STRICT_ALIASING - Success
NVCC_ERROR = 
NVCC_OUT = No such file or directory
-- Performing Test HAS_AMBIGUOUS_REVERSED_OPERATOR
-- Performing Test HAS_AMBIGUOUS_REVERSED_OPERATOR - Failed
-- Performing Test HAS_DEPRECATED_ANON_ENUM_ENUM_CONVERSION
-- Performing Test HAS_DEPRECATED_ANON_ENUM_ENUM_CONVERSION - Failed
-- Performing Test HAS_UNDEFINED_VAR_TEMPLATE
-- Performing Test HAS_UNDEFINED_VAR_TEMPLATE - Failed
-- Performing Test HAS_FORMAT_TRUNCATION
-- Performing Test HAS_FORMAT_TRUNCATION - Success
-- Performing Test HAS_BITWISE_INSTEAD_OF_LOGICAL
-- Performing Test HAS_BITWISE_INSTEAD_OF_LOGICAL - Failed
-- Performing Test HAS_ENUM_CONSTEXPR_CONVERSION
-- Performing Test HAS_ENUM_CONSTEXPR_CONVERSION - Failed
-- Performing Test HAS_DEPRECATED_BUILTINS
-- Performing Test HAS_DEPRECATED_BUILTINS - Failed
-- Found PythonInterp: /opt/conda/bin/python3 (found version "3.7.13") 
-- Found PythonLibs: /opt/conda/lib/libpython3.7m.so (found version "3.7.13") 
Generated: /code/onnxruntime/build/Linux/Release/external/onnx/onnx/onnx-ml.proto
Generated: /code/onnxruntime/build/Linux/Release/external/onnx/onnx/onnx-operators-ml.proto
Generated: /code/onnxruntime/build/Linux/Release/external/onnx/onnx/onnx-data.proto
-- 
-- ******** Summary ********
--   CMake version             : 3.22.1
--   CMake command             : /opt/conda/bin/cmake
--   System                    : Linux
--   C++ compiler              : /usr/bin/c++
--   C++ compiler version      : 9.4.0
--   CXX flags                 :  -ffunction-sections -fdata-sections -DCPUINFO_SUPPORTED -Wnon-virtual-dtor
--   Build type                : Release
--   Compile definitions       : EIGEN_MPL2_ONLY;PLATFORM_POSIX;__STDC_FORMAT_MACROS
--   CMAKE_PREFIX_PATH         : 
--   CMAKE_INSTALL_PREFIX      : /usr/local
--   CMAKE_MODULE_PATH         : /code/onnxruntime/cmake/external
-- 
--   ONNX version              : 1.12.0
--   ONNX NAMESPACE            : onnx
--   ONNX_USE_LITE_PROTO       : ON
--   USE_PROTOBUF_SHARED_LIBS  : OFF
--   Protobuf_USE_STATIC_LIBS  : ON
--   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
Use flatbuffers from submodule
-- Looking for strtof_l
-- Looking for strtof_l - found
-- Looking for strtoull_l
-- Looking for strtoull_l - found
CMake Error at CMakeLists.txt:1887 (cmake_minimum_required):
  CMake 3.23.1 or higher is required.  You are running version 3.22.1

-- Configuring incomplete, errors occurred!
See also "/code/onnxruntime/build/Linux/Release/CMakeFiles/CMakeOutput.log".
See also "/code/onnxruntime/build/Linux/Release/CMakeFiles/CMakeError.log".
rocm_home = /opt/rocm
Traceback (most recent call last):
  File "/code/onnxruntime/tools/ci_build/build.py", line 2817, in <module>
    sys.exit(main())
  File "/code/onnxruntime/tools/ci_build/build.py", line 2711, in main
    cmake_extra_args,
  File "/code/onnxruntime/tools/ci_build/build.py", line 1303, in generate_build_tree
    cuda_home=cuda_home,
  File "/code/onnxruntime/tools/ci_build/build.py", line 738, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
  File "/code/onnxruntime/tools/python/util/run.py", line 57, in run
    shell=shell,
  File "/opt/conda/lib/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/opt/conda/bin/cmake', '/code/onnxruntime/cmake', '-Donnxruntime_RUN_ONNX_TESTS=OFF', '-Donnxruntime_GENERATE_TEST_REPORTS=ON', '-DPython_EXECUTABLE=/opt/conda/bin/python3', '-DPYTHON_EXECUTABLE=/opt/conda/bin/python3', '-Donnxruntime_USE_MIMALLOC=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=OFF', '-Donnxruntime_BUILD_APPLE_FRAMEWORK=OFF', '-Donnxruntime_USE_DNNL=OFF', '-Donnxruntime_USE_NNAPI_BUILTIN=OFF', '-Donnxruntime_USE_RKNPU=OFF', '-Donnxruntime_USE_LLVM=OFF', '-Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF', '-Donnxruntime_USE_VITISAI=OFF', '-Donnxruntime_USE_TENSORRT=OFF', '-Donnxruntime_USE_TENSORRT_BUILTIN_PARSER=OFF', '-Donnxruntime_TENSORRT_PLACEHOLDER_BUILDER=OFF', '-Donnxruntime_USE_TVM=OFF', '-Donnxruntime_TVM_CUDA_RUNTIME=OFF', '-Donnxruntime_TVM_USE_HASH=OFF', '-Donnxruntime_USE_MIGRAPHX=OFF', '-Donnxruntime_CROSS_COMPILING=OFF', '-Donnxruntime_DISABLE_CONTRIB_OPS=OFF', '-Donnxruntime_DISABLE_ML_OPS=OFF', '-Donnxruntime_DISABLE_RTTI=OFF', '-Donnxruntime_DISABLE_EXCEPTIONS=OFF', '-Donnxruntime_MINIMAL_BUILD=OFF', '-Donnxruntime_EXTENDED_MINIMAL_BUILD=OFF', '-Donnxruntime_MINIMAL_BUILD_CUSTOM_OPS=OFF', '-Donnxruntime_REDUCED_OPS_BUILD=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_TRAINING_TORCH_INTEROP=OFF', '-Donnxruntime_ENABLE_TRAINING_ON_DEVICE=OFF', '-Donnxruntime_ENABLE_CPU_FP16_OPS=OFF', '-Donnxruntime_USE_NCCL=OFF', '-Donnxruntime_BUILD_BENCHMARKS=OFF', '-Donnxruntime_USE_ROCM=ON', '-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_BUILD_WEBASSEMBLY_STATIC_LIB=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING=ON', '-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_THROWING=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_THREADS=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_PROFILING=OFF', '-Donnxruntime_ENABLE_EAGER_MODE=OFF', '-Donnxruntime_ENABLE_LAZY_TENSOR=OFF', '-Donnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS=OFF', '-Donnxruntime_ENABLE_CUDA_PROFILING=OFF', '-Donnxruntime_ENABLE_ROCM_PROFILING=OFF', '-Donnxruntime_USE_XNNPACK=OFF', '-Donnxruntime_USE_CANN=OFF', '-Donnxruntime_ROCM_HOME=/opt/rocm', '-Donnxruntime_ROCM_VERSION=', '-DONNXRUNTIME_VERSION=1.14.0', '-Donnxruntime_DEV_MODE=ON', '-Donnxruntime_PYBIND_EXPORT_OPSCHEMA=OFF', '-Donnxruntime_ENABLE_MEMLEAK_CHECKER=OFF', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
The command '/bin/sh -c git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&    cd onnxruntime &&    /bin/sh ./build.sh --config Release --build_wheel --update --build --parallel --cmake_extra_defines            ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) --use_rocm --rocm_home=/opt/rocm &&    pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&    cd ..' returned a non-zero code: 1

Visual Studio Version

No response

GCC / Compiler Version

No response

mszhanyi commented 1 year ago

Did you comment out the build script, login in the docker container and check the cmake version.

timpraferi commented 1 year ago

Thank you @mszhanyi I checked and my script didn't actually upgrade the cmake version

Step 7/7 : RUN cmake --version
 ---> Running in 3f122a59c2a9
cmake version 3.22.1

Had to add

ENV PATH="/opt/cmake-3.24.1/bin/:${PATH}"

Now it's the right version

Step 7/7 : RUN cmake --version
 ---> Running in 0053f3495781
cmake version 3.24.1

Now I'm waiting to se if it builds

timpraferi commented 1 year ago

Ok, the final version is

# --------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------
# Dockerfile to run ONNXRuntime with ROCm integration
#--------------------------------------------------------------------------

FROM rocm/pytorch:rocm5.2.3_ubuntu20.04_py3.7_pytorch_1.12.1

ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_BRANCH=main

WORKDIR /code

RUN apt-get update \
  && apt-get -y install build-essential \
  && apt-get install -y wget \
  && rm -rf /var/lib/apt/lists/* \
  && wget https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1-Linux-x86_64.sh \
      -q -O /tmp/cmake-install.sh \
      && chmod u+x /tmp/cmake-install.sh \
      && mkdir /opt/cmake-3.24.1 \
      && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-3.24.1 \
      && rm /tmp/cmake-install.sh \
      && ln -s /opt/cmake-3.24.1/bin/* /usr/local/bin

ENV PATH="/opt/cmake-3.24.1/bin/:${PATH}"
#RUN cmake --version

# Prepare onnxruntime repository & build onnxruntime
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&\
    cd onnxruntime &&\
    /bin/sh ./build.sh --config Release --build_wheel --update --build --parallel --cmake_extra_defines\
            ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) --use_rocm --rocm_home=/opt/rocm &&\
    pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&\
    cd ..

Does anybody else have this problem? If so this might me worth a pull request.