fix compile problem

Modify points:
1. add --host_copt=-Wno-stringop-truncation
why: Workaround for gcc 10+ warnings related to upb.
     See https://github.com/tensorflow/tensorflow/issues/39467

2. add fix_compile.patch
error message:
Execution platform: @local_execution_config_platform//:platform
tensorflow/core/kernels/sparse_tensors_map_ops.cc:358:18: error: expected constructor, destructor, or type conversion before '(' token
  358 | TF_CALL_ALL_TYPES(REGISTER_KERNELS);
      |                  ^
tensorflow/core/kernels/sparse_tensors_map_ops.cc:516:18: error: expected constructor, destructor, or type conversion before '(' token
  516 | TF_CALL_ALL_TYPES(REGISTER_KERNELS);
      |                  ^
Target //tensorflow/tools/pip_package:build_pip_package failed to build
ERROR: /home/abuild/rpmbuild/BUILD/tensorflow-2.3.1/tensorflow/python/tools/BUILD:143:10 C++ compilation of rule '//tensorflow/core/kernels:sparse_tensors_map_ops' failed (Exit 1): gcc failed: error executing command
This commit is contained in:
Lin Jiaxin 2021-08-06 10:54:43 +08:00
parent 37301caef0
commit 1d6142becf
2 changed files with 18 additions and 2 deletions

11
fix_compile.patch Normal file
View File

@ -0,0 +1,11 @@
--- a/tensorflow/core/kernels/sparse_tensors_map_ops.cc 2021-08-05 09:54:10.591394528 +0800
+++ b/tensorflow/core/kernels/sparse_tensors_map_ops.cc 2021-08-05 12:22:51.148694390 +0800
@@ -21,6 +21,8 @@
#include <utility>
#include <vector>
+#include "tensorflow/core/framework/op_kernel.h"
+#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/framework/resource_mgr.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_util.h"

View File

@ -1,7 +1,7 @@
%global _empty_manifest_terminate_build 0 %global _empty_manifest_terminate_build 0
Name: tensorflow Name: tensorflow
Version: 2.3.1 Version: 2.3.1
Release: 4 Release: 5
Summary: An Open Source Machine Learning Framework for Everyone Summary: An Open Source Machine Learning Framework for Everyone
License: Apache License 2.0 License: Apache License 2.0
URL: https://www.tensorflow.org/ URL: https://www.tensorflow.org/
@ -14,6 +14,7 @@ Patch0002: CVE-2021-29538.patch
Patch0003: CVE-2021-29535.patch Patch0003: CVE-2021-29535.patch
Patch0004: CVE-2021-29566.patch Patch0004: CVE-2021-29566.patch
Patch0005: CVE-2021-29534.patch Patch0005: CVE-2021-29534.patch
Patch0006: fix_compile.patch
Requires: python3-future Requires: python3-future
Requires: python3-numpy Requires: python3-numpy
@ -49,7 +50,7 @@ ln -sfn $(find ${extdir}/../install -maxdepth 2 -name platforms) ${extdir}/exter
rm -rf ${extdir}/external/local_config* rm -rf ${extdir}/external/local_config*
%build %build
bazel --output_user_root=`pwd`/../output_user_root build //tensorflow/tools/pip_package:build_pip_package bazel --output_user_root=`pwd`/../output_user_root build --host_copt=-Wno-stringop-truncation //tensorflow/tools/pip_package:build_pip_package
./bazel-bin/tensorflow/tools/pip_package/build_pip_package dist ./bazel-bin/tensorflow/tools/pip_package/build_pip_package dist
%install %install
@ -60,6 +61,10 @@ bazel --output_user_root=`pwd`/../output_user_root build //tensorflow/tools/pip_
%{_bindir}/* %{_bindir}/*
%changelog %changelog
* Fri Aug 06 2021 linjiaxin5 <linjiaxin5@huawei.com> - 2.3.1-5
- Fix failure caused by GCC upgrade to 10
- add patch fix_compile.patch
* Mon Jun 28 2021 polite2anyone <zhangyao05@outlook,com> - 2.3.1-4 * Mon Jun 28 2021 polite2anyone <zhangyao05@outlook,com> - 2.3.1-4
- Add patch CVE-2021-29534 - Add patch CVE-2021-29534