I’m trying to build tensorflow on a machine with a cpu that doesn’t support AVX.
I followed the instruction of the page 從原始碼開始建構 | TensorFlow, but I had this error:
(tf) marco@ubuntu:~/tensorflow$ bazel build --config=native_arch_linux //tensorflow/tools/pip_package:build_pip_package
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=184
INFO: Reading rc options for 'build' from /home/marco/tensorflow/.bazelrc:
Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /home/marco/tensorflow/.bazelrc:
'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false
INFO: Reading rc options for 'build' from /home/marco/tensorflow/.tf_configure.bazelrc:
'build' options: --action_env PYTHON_BIN_PATH=/home/marco/.conda/envs/tf/bin/python3 --action_env PYTHON_LIB_PATH=/home/marco/.conda/envs/tf/lib/python3.10/site-packages --python_path=/home/marco/.conda/envs/tf/bin/python3
INFO: Reading rc options for 'build' from /home/marco/tensorflow/.bazelrc:
'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/common,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file /home/marco/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /home/marco/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:native_arch_linux in file /home/marco/tensorflow/.bazelrc: --copt=-march=native
INFO: Found applicable config definition build:linux in file /home/marco/tensorflow/.bazelrc: --host_copt=-w --copt=-Wno-all --copt=-Wno-extra --copt=-Wno-deprecated --copt=-Wno-deprecated-declarations --copt=-Wno-ignored-attributes --copt=-Wno-unknown-warning --copt=-Wno-array-parameter --copt=-Wno-stringop-overflow --copt=-Wno-array-bounds --copt=-Wunused-result --copt=-Werror=unused-result --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --config=dynamic_kernels --distinct_host_configuration=false --experimental_guard_against_concurrent_changes
INFO: Found applicable config definition build:dynamic_kernels in file /home/marco/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/4ce3e4da2e21ae4dfcee9366415e55f408c884ec.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/081771d4a0e9d7d3aa0eed2ef389fa4700dfb23e.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/openxla/stablehlo/archive/fdd47908468488cbbb386bb7fc723dc19321cb83.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/XNNPACK/archive/e8f74a9763aa36559980a0c2f37f587794995622.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (544 packages loaded, 31172 targets configured).
INFO: Found 1 target...
ERROR: /home/marco/tensorflow/tensorflow/core/tpu/ops/BUILD:25:11: Compiling tensorflow/core/tpu/ops/tpu_partitioned_input_op.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 108 arguments skipped)
In file included from ./tensorflow/core/platform/statusor.h:21,
from ./tensorflow/core/framework/tensor_shape.h:29,
from ./tensorflow/core/framework/partial_tensor_shape.h:20,
from ./tensorflow/core/framework/attr_value_util.h:23,
from ./tensorflow/core/framework/node_def_util.h:23,
from ./tensorflow/core/framework/shape_inference.h:22,
from ./tensorflow/core/framework/common_shape_fns.h:20,
from tensorflow/core/tpu/ops/tpu_partitioned_input_op.cc:16:
tensorflow/core/tpu/ops/tpu_partitioned_input_op.cc: In lambda function:
tensorflow/core/tpu/ops/tpu_partitioned_input_op.cc:190:15: error: '_ComputeOutputShape' was not declared in this scope
190 | _ComputeOutputShape(c, previous_shape_handle, partition_dims));
| ^~~~~~~~~~~~~~~~~~~
./tensorflow/tsl/platform/statusor.h:415:20: note: in definition of macro 'TF_ASSIGN_OR_RETURN_IMPL'
415 | auto statusor = (rexpr); \
| ^~~~~
tensorflow/core/tpu/ops/tpu_partitioned_input_op.cc:188:11: note: in expansion of macro 'TF_ASSIGN_OR_RETURN'
188 | TF_ASSIGN_OR_RETURN(
| ^~~~~~~~~~~~~~~~~~~
tensorflow/core/tpu/ops/tpu_partitioned_input_op.cc:200:27: error: '_ComputeOutputShape' was not declared in this scope
200 | output_shape, _ComputeOutputShape(c, c->input(0), partition_dims));
| ^~~~~~~~~~~~~~~~~~~
./tensorflow/tsl/platform/statusor.h:415:20: note: in definition of macro 'TF_ASSIGN_OR_RETURN_IMPL'
415 | auto statusor = (rexpr); \
| ^~~~~
tensorflow/core/tpu/ops/tpu_partitioned_input_op.cc:199:9: note: in expansion of macro 'TF_ASSIGN_OR_RETURN'
199 | TF_ASSIGN_OR_RETURN(
| ^~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: warning: unrecognized command line option '-Wno-array-parameter'
cc1plus: warning: unrecognized command line option '-Wno-unknown-warning'
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 17381.051s, Critical Path: 354.58s
INFO: 7789 processes: 1053 internal, 6736 local.
FAILED: Build did NOT complete successfully
The system is ubuntu 20.04 with a gcc 9.4. The tensorflow branch is r2.11. The conda environment has been created with python 3.10.
I used the flag --config=native_arch_linux because I don’t want AVX and I’m not sure how the configure script has set the parameters.
I tried to search a similar error in the web but I didn’t find anything.