Erro when compiling tensorflow from source code for my cpus

cat build.log
INFO: Options provided by the client:
Inherited ‘common’ options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for ‘build’ from /home/brian/tensorflow/.bazelrc:
Inherited ‘common’ options: --experimental_repo_remote_exec
INFO: Reading rc options for ‘build’ from /home/brian/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 --features=-force_no_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 --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for ‘build’ from /home/brian/tensorflow/.tf_configure.bazelrc:
‘build’ options: --action_env PYTHON_BIN_PATH=/home/brian/anaconda3/envs/myown/bin/python3 --action_env PYTHON_LIB_PATH=/home/brian/anaconda3/envs/myown/lib/python3.11/site-packages --python_path=/home/brian/anaconda3/envs/myown/bin/python3
INFO: Found applicable config definition build:short_logs in file /home/brian/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /home/brian/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:opt in file /home/brian/tensorflow/.tf_configure.bazelrc: --copt=/usr/bin/clang-16 --host_copt=/usr/bin/clang-16
INFO: Found applicable config definition build:mkl in file /home/brian/tensorflow/.bazelrc: --define=build_with_mkl=true --define=enable_mkl=true --define=tensorflow_mkldnn_contraction_kernel=0 --define=build_with_openmp=true -c opt
INFO: Found applicable config definition build:monolithic in file /home/brian/tensorflow/.bazelrc: --define framework_shared_object=false --define tsl_protobuf_header_only=false --experimental_link_static_libraries_once=false
INFO: Found applicable config definition build:linux in file /home/brian/tensorflow/.bazelrc: --define=build_with_onednn_v2=true --host_copt=-w --copt=-Wno-all --copt=-Wno-extra --copt=-Wno-deprecated --copt=-Wno-deprecated-declarations --copt=-Wno-ignored-attributes --copt=-Wno-array-bounds --copt=-Wunused-result --copt=-Werror=unused-result --copt=-Wswitch --copt=-Werror=switch --copt=-Wno-error=unused-but-set-variable --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 --experimental_guard_against_concurrent_changes
INFO: Found applicable config definition build:dynamic_kernels in file /home/brian/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
Loading:
Loading:
Loading: 0 packages loaded
INFO: Build option --define has changed, discarding analysis cache.
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 0 targets configured)
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 41240 targets configured).
checking cached actions
INFO: Found 1 target…
[0 / 4] [Prepa] BazelWorkspaceStatusAction stable-status.txt
[1,049 / 1,152] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 1s local … (2 actions running)
[3,083 / 4,562] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 2s local … (2 actions running)
[4,102 / 11,046] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 4s local … (3 actions, 2 running)
[4,954 / 11,728] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 5s local … (2 actions running)
[8,561 / 12,129] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 12s local … (3 actions, 2 running)
[9,019 / 12,407] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 13s local … (2 actions running)
[12,092 / 12,407] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 22s local … (3 actions, 2 running)
[12,248 / 12,407] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 23s local … (3 actions running)
[13,543 / 13,550] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 49s local … (3 actions running)
[13,546 / 13,550] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 73s local … (3 actions, 2 running)
[13,546 / 13,550] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 74s local … (3 actions running)
[13,546 / 13,550] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 84s local … (3 actions running)
[13,546 / 13,550] Creating runfiles tree bazel-out/k8-opt/bin/tensorflow/lite/toco/python/toco_from_protos.runfiles; 114s local … (3 actions running)
ERROR: /home/brian/tensorflow/tensorflow/BUILD:1668:19: Action tensorflow/_api/v2/v2.py failed: (Aborted): bash failed: error executing command (from target //tensorflow:tf_python_api_gen_v2)
(cd /home/brian/.cache/bazel/_bazel_brian/011b11df796d2a951625a1b78cd560de/execroot/org_tensorflow &&
exec env -
PATH=/home/brian/.cache/bazelisk/downloads/bazelbuild/bazel-6.1.0-linux-x86_64/bin:/home/brian/anaconda3/envs/myown/bin:/home/brian/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PYTHON_BIN_PATH=/home/brian/anaconda3/envs/myown/bin/python3
PYTHON_LIB_PATH=/home/brian/anaconda3/envs/myown/lib/python3.11/site-packages
TF2_BEHAVIOR=1
/bin/bash -c ‘bazel-out/k8-opt/bin/tensorflow/create_tensorflow.python_api_tf_python_api_gen_v2 --root_init_template=tensorflow/api_template.init.py --apidir=bazel-out/k8-opt/bin/tensorflow/_api/v2/ --apiname=tensorflow --apiversion=2 --compat_apiversion=1 --compat_apiversion=2 --compat_init_template=tensorflow/compat_template_v1.init.py --compat_init_template=tensorflow/compat_template.init.py --packages=tensorflow.python,tensorflow.dtensor.python.accelerator_util,tensorflow.dtensor.python.api,tensorflow.dtensor.python.config,tensorflow.dtensor.python.d_checkpoint,tensorflow.dtensor.python.d_variable,tensorflow.dtensor.python.input_util,tensorflow.dtensor.python.layout,tensorflow.dtensor.python.mesh_util,tensorflow.dtensor.python.tpu_util,tensorflow.dtensor.python.save_restore,tensorflow.lite.python.analyzer,tensorflow.lite.python.lite,tensorflow.lite.python.authoring.authoring,tensorflow.python.modules_with_exports --output_package=tensorflow._api.v2 --use_relative_imports=True --loading=default bazel-out/k8-opt/bin/tensorflow/tf_python_api_gen_v2.params’)

Configuration: f5043fece35f68c60ebeae9332418ff454c29160946d03bdc5ae7ae628b465be

Execution platform: @local_execution_config_platform//:platform

2023-07-27 07:31:00.079525: F ./tensorflow/core/framework/variant_op_registry.h:114] Check failed: existing == nullptr (0x55b0143354f8 vs. nullptr)UnaryVariantDeviceCopy for direction: 1 and type_index: tensorflow::Tensor already registered
[13,549 / 13,550] checking cached actions
Target //tensorflow/tools/pip_package:build_pip_package failed to build
ERROR: /home/brian/tensorflow/tensorflow/lite/python/BUILD:71:10 Middleman _middlemen/tensorflow_Slite_Spython_Stflite_Uconvert-runfiles failed: (Aborted): bash failed: error executing command (from target //tensorflow:tf_python_api_gen_v2)
(cd /home/brian/.cache/bazel/_bazel_brian/011b11df796d2a951625a1b78cd560de/execroot/org_tensorflow &&
exec env -
PATH=/home/brian/.cache/bazelisk/downloads/bazelbuild/bazel-6.1.0-linux-x86_64/bin:/home/brian/anaconda3/envs/myown/bin:/home/brian/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PYTHON_BIN_PATH=/home/brian/anaconda3/envs/myown/bin/python3
PYTHON_LIB_PATH=/home/brian/anaconda3/envs/myown/lib/python3.11/site-packages
TF2_BEHAVIOR=1
/bin/bash -c ‘bazel-out/k8-opt/bin/tensorflow/create_tensorflow.python_api_tf_python_api_gen_v2 --root_init_template=tensorflow/api_template.init.py --apidir=bazel-out/k8-opt/bin/tensorflow/_api/v2/ --apiname=tensorflow --apiversion=2 --compat_apiversion=1 --compat_apiversion=2 --compat_init_template=tensorflow/compat_template_v1.init.py --compat_init_template=tensorflow/compat_template.init.py --packages=tensorflow.python,tensorflow.dtensor.python.accelerator_util,tensorflow.dtensor.python.api,tensorflow.dtensor.python.config,tensorflow.dtensor.python.d_checkpoint,tensorflow.dtensor.python.d_variable,tensorflow.dtensor.python.input_util,tensorflow.dtensor.python.layout,tensorflow.dtensor.python.mesh_util,tensorflow.dtensor.python.tpu_util,tensorflow.dtensor.python.save_restore,tensorflow.lite.python.analyzer,tensorflow.lite.python.lite,tensorflow.lite.python.authoring.authoring,tensorflow.python.modules_with_exports --output_package=tensorflow._api.v2 --use_relative_imports=True --loading=default bazel-out/k8-opt/bin/tensorflow/tf_python_api_gen_v2.params’)

Configuration: f5043fece35f68c60ebeae9332418ff454c29160946d03bdc5ae7ae628b465be

Execution platform: @local_execution_config_platform//:platform

INFO: Elapsed time: 176.640s, Critical Path: 159.34s
INFO: 10 processes: 9 internal, 1 local.
FAILED: Build did NOT complete successfully

1 Like

Any update here? I also met this error when build command with “–config=monolithic”…