Repository: apache/tvm (language: python)

Issue:
[Bug] ci_cpu docker image build fail
### Expected behavior
The docker image (ci_cpu) builds successfully.

### Actual behavior

failed with the following error
```sh
40.25 [ 69%] Built target nnpack_reference_layers
40.88 [ 71%] Generating src/x86_64-fma/2d-fourier-16x16.py.o
43.07 [ 72%] Generating src/x86_64-fma/2d-winograd-8x8-3x3.py.o
43.44 [ 73%] Generating src/x86_64-fma/blas/s8gemm.py.o
43.56 [ 74%] Generating src/x86_64-fma/blas/c8gemm.py.o
43.76 [ 75%] Generating src/x86_64-fma/blas/s4c6gemm.py.o
43.94 [ 77%] Generating src/x86_64-fma/blas/conv1x1.py.o
44.04 [ 78%] Generating src/x86_64-fma/blas/sgemm.py.o
44.18 [ 79%] Generating src/x86_64-fma/max-pooling.py.o
44.25 [ 80%] Generating src/x86_64-fma/relu.py.o
44.30 [ 81%] Generating src/x86_64-fma/softmax.py.o
44.57 [ 83%] Generating src/x86_64-fma/blas/sdotxf.py.o
44.78 [ 84%] Generating src/x86_64-fma/blas/shdotxf.py.o
44.81 Traceback (most recent call last):
44.81   File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
44.81     return _run_code(code, main_globals, None,
44.81   File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
44.81     exec(code, run_globals)
44.81   File "/NNPACK/deps/peachpy/peachpy/x86_64/__main__.py", line 282, in <module>
44.81     main()
44.81   File "/NNPACK/deps/peachpy/peachpy/x86_64/__main__.py", line 269, in main
44.81     execute_script(writers, options.input[0])
44.81   File "/NNPACK/deps/peachpy/peachpy/x86_64/__main__.py", line 200, in execute_script
44.81     execute_script(writers, source_filename)
44.81   File "/NNPACK/deps/peachpy/peachpy/x86_64/__main__.py", line 200, in execute_script
44.81     execute_script(writers, source_filename)
44.81   File "/NNPACK/deps/peachpy/peachpy/x86_64/__main__.py", line 204, in execute_script
44.81     exec(code, globals())
44.81   File "/NNPACK/src/x86_64-fma/blas/shdotxf.py", line 4, in <module>
44.81     from fp16.avx import fp16_alt_xmm_to_fp32_xmm
44.81 ModuleNotFoundError: No module named 'fp16.avx'
44.81 make[2]: *** [CMakeFiles/nnpack.dir/build.make:188: src/x86_64-fma/blas/shdotxf.py.o] Error 1
44.81 make[1]: *** [CMakeFiles/Makefile2:175: CMakeFiles/nnpack.dir/all] Error 2
44.81 make: *** [Makefile:136: all] Error 2
------
Dockerfile.ci_cpu:82
--------------------
  80 |     # NNPACK deps
  81 |     COPY install/ubuntu_install_nnpack.sh /install/ubuntu_install_nnpack.sh
  82 | >>> RUN bash /install/ubuntu_install_nnpack.sh
  83 |
  84 |     # ANTLR deps
--------------------
ERROR: failed to solve: process "/bin/sh -c bash /install/ubuntu_install_nnpack.sh" did not complete successfully: exit code: 2
ERROR: docker build failed.
```
### Environment
Ubuntu 22.04
Latest TVM code at 1f4c568bdd6f5392466a05921b2ff7ef600010fe

### Steps to reproduce
```sh
./docker/build.sh tvm.ci_cpu


### Triage

Please refer to the list of label tags [here](https://github.com/apache/tvm/wiki/Issue-Triage-Labels) to find the relevant tags and add them below in a bullet format (example below).

* needs-triage



Discussion / hints:
the demo_cpu also fails
```sh
Building container (tvm.demo_cpu)...
[+] Building 1.7s (2/2) FINISHED                                                                                      docker:default
 => [internal] load build definition from Dockerfile.demo_cpu                                                                   0.0s
 => => transferring dockerfile: 1.37kB                                                                                          0.0s
 => ERROR [internal] load metadata for docker.io/tlcpack/ci-cpu:v0.55                                                           1.7s
------
 > [internal] load metadata for docker.io/tlcpack/ci-cpu:v0.55:
------
Dockerfile.demo_cpu:20
--------------------
  18 |     # Minimum docker image for demo purposes
  19 |     # prebuilt-image: tvmai/demo-cpu
  20 | >>> FROM tlcpack/ci-cpu:v0.55
  21 |
  22 |     COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear
--------------------
ERROR: failed to solve: tlcpack/ci-cpu:v0.55: docker.io/tlcpack/ci-cpu:v0.55: not found
ERROR: docker build failed.
```
Thanks for reporting this error. Seems the [image build](https://ci.tlcpack.ai/blue/organizations/jenkins/docker-images-ci%2Fdaily-docker-image-rebuild/activity/) failed with the same error for several days. cc: @lhutton1 @tqchen 
Looks related to this issue: https://github.com/Maratyszcza/NNPACK/issues/219
if we don't have a quick fix for this, probably we could consider disabling nnpack.
During my testing, I could do a workaround by updating the `ubuntu_install_nnpack.sh` file ([pastebin](https://pastebin.com/WDMFS5aC)) so that it uses a previous commit of FP16 during the NNPACK cmake as a temporary solution, while they work it out in NNPACK.


i think it makes sense to disable and deprecate nnpack given it is more stale, 

Fix patch:
diff --git a/cmake/modules/contrib/TFLite.cmake b/cmake/modules/contrib/TFLite.cmake
index b8d6a0daff19..255dc5fde780 100644
--- a/cmake/modules/contrib/TFLite.cmake
+++ b/cmake/modules/contrib/TFLite.cmake
@@ -39,6 +39,10 @@ if(NOT USE_TFLITE STREQUAL "OFF")
   endif()
   find_library(TFLITE_CONTRIB_LIB libtensorflow-lite.a ${USE_TFLITE})
   file(GLOB_RECURSE TFLITE_DEPS "${USE_TFLITE}/*.a")
+  # the order of the next libs are important for correct build
+  list(REMOVE_ITEM TFLITE_DEPS "${USE_TFLITE}/_deps/clog-build/libclog.a" "${USE_TFLITE}/_deps/cpuinfo-build/libcpuinfo.a")
+  list(APPEND TFLITE_DEPS "${USE_TFLITE}/_deps/cpuinfo-build/libcpuinfo.a")
+  list(APPEND TFLITE_DEPS "${USE_TFLITE}/_deps/clog-build/libclog.a")
 
   list(APPEND TVM_RUNTIME_LINKER_LIBS ${TFLITE_CONTRIB_LIB})
   list(APPEND TVM_RUNTIME_LINKER_LIBS ${TFLITE_DEPS})
diff --git a/docker/Dockerfile.ci_adreno b/docker/Dockerfile.ci_adreno
index 961977c54286..30e095b27aac 100644
--- a/docker/Dockerfile.ci_adreno
+++ b/docker/Dockerfile.ci_adreno
@@ -20,11 +20,6 @@ FROM tlcpack/ci-gpu
 
 COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear
 
-# Android SDK
-COPY install/ubuntu_install_androidsdk.sh /install/ubuntu_install_androidsdk.sh
-RUN bash /install/ubuntu_install_androidsdk.sh 25.2.9519653 3.22.1 33.0.2 33
-ENV PATH /opt/android-sdk-linux/platform-tools:$PATH
-
 # Clang tool for CLML source codegen
 RUN apt-get update && apt-install-and-clear -y clang-format-15
 
diff --git a/docker/Dockerfile.ci_cpu b/docker/Dockerfile.ci_cpu
index ae088f5c9e63..17344f7dac22 100644
--- a/docker/Dockerfile.ci_cpu
+++ b/docker/Dockerfile.ci_cpu
@@ -77,10 +77,6 @@ COPY install/ubuntu_install_golang.sh /install/ubuntu_install_golang.sh
 RUN bash /install/ubuntu_install_golang.sh
 ENV PATH $PATH:/usr/lib/go-1.18/bin
 
-# NNPACK deps
-COPY install/ubuntu_install_nnpack.sh /install/ubuntu_install_nnpack.sh
-RUN bash /install/ubuntu_install_nnpack.sh
-
 # ANTLR deps
 COPY install/ubuntu_install_java.sh /install/ubuntu_install_java.sh
 RUN bash /install/ubuntu_install_java.sh
@@ -129,10 +125,6 @@ RUN bash /install/ubuntu_install_ethosn_driver_stack.sh
 COPY install/ubuntu_install_vitis_ai_packages_ci.sh /install/ubuntu_install_vitis_ai_packages_ci.sh
 RUN bash /install/ubuntu_install_vitis_ai_packages_ci.sh
 
-# Android SDK
-COPY install/ubuntu_install_androidsdk.sh /install/ubuntu_install_androidsdk.sh
-RUN bash /install/ubuntu_install_androidsdk.sh
-
 # PaddlePaddle deps
 COPY install/ubuntu_install_paddle.sh /install/ubuntu_install_paddle.sh
 RUN bash /install/ubuntu_install_paddle.sh
diff --git a/docker/Dockerfile.ci_gpu b/docker/Dockerfile.ci_gpu
index acb0310a41e2..8d11882098fb 100644
--- a/docker/Dockerfile.ci_gpu
+++ b/docker/Dockerfile.ci_gpu
@@ -133,10 +133,6 @@ RUN bash /install/ubuntu_install_wasmtime.sh
 COPY install/ubuntu_install_redis.sh /install/ubuntu_install_redis.sh
 RUN bash /install/ubuntu_install_redis.sh
 
-# NNPACK deps
-COPY install/ubuntu_install_nnpack.sh /install/ubuntu_install_nnpack.sh
-RUN bash /install/ubuntu_install_nnpack.sh
-
 # BYODT deps
 COPY install/ubuntu_install_universal.sh /install/ubuntu_install_universal.sh
 RUN bash /install/ubuntu_install_universal.sh
diff --git a/docker/Dockerfile.ci_hexagon b/docker/Dockerfile.ci_hexagon
index 3b4c58ef43c9..1855e3a9c231 100644
--- a/docker/Dockerfile.ci_hexagon
+++ b/docker/Dockerfile.ci_hexagon
@@ -58,12 +58,6 @@ RUN bash /install/ubuntu_install_python_package.sh
 COPY install/ubuntu_install_java.sh /install/ubuntu_install_java.sh
 RUN bash /install/ubuntu_install_java.sh
 
-# Android SDK
-COPY install/ubuntu_install_androidsdk.sh /install/ubuntu_install_androidsdk.sh
-RUN bash /install/ubuntu_install_androidsdk.sh
-ENV ANDROID_HOME=/opt/android-sdk-linux
-ENV PATH /opt/android-sdk-linux/platform-tools:$PATH
-
 # Hexagon
 COPY install/ubuntu_install_hexagon.sh /install/ubuntu_install_hexagon.sh
 RUN bash /install/ubuntu_install_hexagon.sh
diff --git a/docker/Dockerfile.demo_vitis_ai b/docker/Dockerfile.demo_vitis_ai
index b82076dbdf9c..01b0b494bd9e 100644
--- a/docker/Dockerfile.demo_vitis_ai
+++ b/docker/Dockerfile.demo_vitis_ai
@@ -45,10 +45,6 @@ RUN bash /install/ubuntu_install_python_package.sh
 COPY install/ubuntu_install_llvm.sh /install/ubuntu_install_llvm.sh
 RUN bash /install/ubuntu_install_llvm.sh
 
-# NNPACK deps
-COPY install/ubuntu_install_nnpack.sh /install/ubuntu_install_nnpack.sh
-RUN bash /install/ubuntu_install_nnpack.sh
-
 ENV PATH $PATH:$CARGO_HOME/bin:/usr/lib/go-1.10/bin
 
 # ANTLR deps
diff --git a/docker/install/ubuntu_install_androidsdk.sh b/docker/install/ubuntu_install_androidsdk.sh
index 5e7278c5d631..193a02745f3a 100755
--- a/docker/install/ubuntu_install_androidsdk.sh
+++ b/docker/install/ubuntu_install_androidsdk.sh
@@ -25,6 +25,8 @@ ANDROID_HOME=/opt/android-sdk-linux
 ASDKTOOLS_HOME=/opt/android-sdk-tools
 ASDKTOOLS_VERSION=3859397
 ASDKTOOLS_SHA256=444e22ce8ca0f67353bda4b85175ed3731cae3ffa695ca18119cbacef1c1bea0
+COMMANDLINETOOLS_VERSION=11076708
+COMMANDLINETOOLS_SHA256=2d2d50857e4eb553af5a6dc3ad507a17adf43d115264b1afc116f95c92e5e258
 
 ANDROID_NDK_VERSION=21.3.6528147
 CMAKE_VERSION=3.6.4111459
@@ -52,11 +54,11 @@ echo "Cmake Version: ${CMAKE_VERSION}"
 echo "Build Tools: ${BUILD_TOOLS_VERSION}"
 echo "Android Platform: ${ANDROID_PLATFORM}"
 
-wget -q http://dl.google.com/android/repository/sdk-tools-linux-${ASDKTOOLS_VERSION}.zip -O sdk-tools-linux.zip
-echo "${ASDKTOOLS_SHA256} *sdk-tools-linux.zip" | sha256sum --check -
-unzip sdk-tools-linux.zip
-rm sdk-tools-linux.zip
-mv tools "${ASDKTOOLS_HOME}/"
+wget -q https://dl.google.com/android/repository/commandlinetools-linux-${COMMANDLINETOOLS_VERSION}_latest.zip  -O commandlinetools-linux.zip
+echo "${COMMANDLINETOOLS_SHA256} commandlinetools-linux.zip" | sha256sum --check -
+unzip commandlinetools-linux.zip
+rm commandlinetools-linux.zip
+mv cmdline-tools/ "${ASDKTOOLS_HOME}/"
 # The following popular fix makes sdkmanager honour $http_proxy variables
 mv ${ASDKTOOLS_HOME}/bin/sdkmanager ${ASDKTOOLS_HOME}/bin/sdkmanager-vanilla
 cat >${ASDKTOOLS_HOME}/bin/sdkmanager <<"EOF"
@@ -90,8 +92,6 @@ extras;google;market_apk_expansion
 extras;google;market_licensing
 extras;google;simulators
 extras;google;webdriver
-extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2
-extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2
 platforms;android-26
 platforms;android-${ANDROID_PLATFORM}
 tools
diff --git a/docker/install/ubuntu_install_java.sh b/docker/install/ubuntu_install_java.sh
index 5556f0d8fed5..c4a8c5f9acb5 100755
--- a/docker/install/ubuntu_install_java.sh
+++ b/docker/install/ubuntu_install_java.sh
@@ -20,7 +20,7 @@ set -o errexit -o nounset
 set -o pipefail
 
 apt-get update
-apt-install-and-clear -y openjdk-8-jdk maven
+apt-install-and-clear -y openjdk-17-jdk maven
 arch=$(uname -m)
 jre_arch="unknown"
 case $arch in
@@ -36,8 +36,8 @@ case $arch in
         ;;
 esac
 
-if [ ! -d "/usr/lib/jvm/java-8-openjdk-$jre_arch/jre" ]; then
+if [ ! -d "/usr/lib/jvm/java-17-openjdk-$jre_arch" ]; then
   echo "error: missing openjdk for $jre_arch" >&2
   exit 1
 fi
-echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-$jre_arch/jre" >> /etc/profile
+echo "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-$jre_arch" >> /etc/profile


Test patch:
diff --git a/tests/scripts/task_config_build_cpu.sh b/tests/scripts/task_config_build_cpu.sh
index f509aad30627..c97321e538bd 100755
--- a/tests/scripts/task_config_build_cpu.sh
+++ b/tests/scripts/task_config_build_cpu.sh
@@ -30,8 +30,6 @@ echo set\(USE_PROFILER ON\) >> config.cmake
 echo set\(USE_DNNL ON\) >> config.cmake
 echo set\(USE_ARM_COMPUTE_LIB ON\) >> config.cmake
 echo set\(USE_LLVM \"/usr/bin/llvm-config-17 --link-static\"\) >> config.cmake
-echo set\(USE_NNPACK ON\) >> config.cmake
-echo set\(NNPACK_PATH /NNPACK/build/\) >> config.cmake
 echo set\(USE_ANTLR ON\) >> config.cmake
 echo set\(CMAKE_CXX_FLAGS \"-Werror -Wno-error=range-loop-construct\"\) >> config.cmake
 echo set\(HIDE_PRIVATE_SYMBOLS ON\) >> config.cmake
diff --git a/tests/scripts/task_config_build_gpu.sh b/tests/scripts/task_config_build_gpu.sh
index e68e646ce178..03f90c5ad4a1 100755
--- a/tests/scripts/task_config_build_gpu.sh
+++ b/tests/scripts/task_config_build_gpu.sh
@@ -33,8 +33,6 @@ echo set\(USE_OPENCL_GTEST \"/googletest\"\) >> config.cmake
 echo set\(USE_MICRO ON\) >> config.cmake
 echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake
 echo set\(USE_LLVM \"/usr/bin/llvm-config-15 --link-static\"\) >> config.cmake
-echo set\(USE_NNPACK ON\) >> config.cmake
-echo set\(NNPACK_PATH /NNPACK/build/\) >> config.cmake
 echo set\(USE_RPC ON\) >> config.cmake
 echo set\(USE_SORT ON\) >> config.cmake
 echo set\(USE_GRAPH_EXECUTOR ON\) >> config.cmake