tensorflow: target //tensorflow/compiler/mlir/lite:tensorflow_lite_quantize fail to build

Issue type

Build/Install

Have you reproduced the bug with TensorFlow Nightly?

No

Source

source

TensorFlow version

tf 2.19

Custom code

No

OS platform and distribution

Linux Debian 6.1.119-1 (2024-11-22) x86_64 x86_64 x86_64 GNU/Linux

Mobile device

No response

Python version

3.10

Bazel version

bazel 6.5.0

GCC/compiler version

gcc version 13.1.0

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

Background

I follow the guidance here to run unit test locally. I use a google cloud compute engine. gcc version 13.1.0

I run the follow command to docker image tensorflow/build:2.19-python3.10. docker run -it -v $PWD:/tmp -w /tmp tensorflow/build:2.19-python3.10 bash -c “bazel build --experimental_action_cache_store_output_metadata --disk_cache=~/.cache/bazel --jobs=3 --config=linux //tensorflow/compiler/mlir/lite:tensorflow_lite_quantize”

The build failed and the error message is:

/usr/include/c++/13/bits/unique_ptr.h:1070:30: error: call of overloaded ‘DefaultQuantParamsPass(const mlir::TFL::DefaultQuantParamsPassOptions&)’ is ambiguous 1070 | { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)…)); } |

The full debug message is:

ERROR: /tmp/tensorflow/compiler/mlir/lite/BUILD:1295:11: Compiling tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc failed: (Exit 1): gcc failed: error executing command (from target //tensorflow/compiler/mlir/lite:tensorflow_lite_quantize) /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 235 arguments skipped) In file included from /usr/include/c++/13/memory:78, from tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:16: /usr/include/c++/13/bits/unique_ptr.h: In instantiation of ‘std::__detail::__unique_ptr_t<_Tp> std::make_unique(_Args&& …) [with _Tp = mlir::TFL::{anonymous}::DefaultQuantParamsPass; _Args = {const mlir::TFL::DefaultQuantParamsPassOptions&}; __detail::__unique_ptr_t<_Tp> = __detail::__unique_ptr_tmlir::TFL::{anonymous}::DefaultQuantParamsPass]’: tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:249:50: required from here /usr/include/c++/13/bits/unique_ptr.h:1070:30: error: call of overloaded ‘DefaultQuantParamsPass(const mlir::TFL::DefaultQuantParamsPassOptions&)’ is ambiguous 1070 | { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)…)); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:52: bazel-out/k8-opt/bin/tensorflow/compiler/mlir/lite/transforms/passes.h.inc:162:3: note: candidate: ‘mlir::TFL::{anonymous}::impl::DefaultQuantParamsPassBase::DefaultQuantParamsPassBase(mlir::TFL::DefaultQuantParamsPassOptions) [with DerivedT = mlir::TFL::{anonymous}::DefaultQuantParamsPass]’ 162 | DefaultQuantParamsPassBase(DefaultQuantParamsPassOptions options) : DefaultQuantParamsPassBase() { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:57:37: note: inherited here 57 | using DefaultQuantParamsPassBase::DefaultQuantParamsPassBase; | ^~~~~~~~~~~~~~~~~~~~~~~~~~ tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:66:12: note: candidate: ‘mlir::TFL::{anonymous}::DefaultQuantParamsPass::DefaultQuantParamsPass(const mlir::TFL::DefaultQuantParamsPassOptions&)’ 66 | explicit DefaultQuantParamsPass( | ^~~~~~~~~~~~~~~~~~~~~~ tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:54:7: note: candidate: ‘mlir::TFL::{anonymous}::DefaultQuantParamsPass::DefaultQuantParamsPass(const mlir::TFL::{anonymous}::DefaultQuantParamsPass&)’ 54 | class DefaultQuantParamsPass | ^~~~~~~~~~~~~~~~~~~~~~ tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:54:7: note: candidate: ‘mlir::TFL::{anonymous}::DefaultQuantParamsPass::DefaultQuantParamsPass(mlir::TFL::{anonymous}::DefaultQuantParamsPass&&)’ (deleted) Target //tensorflow/compiler/mlir/lite:tensorflow_lite_quantize failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 407.917s, Critical Path: 206.23s INFO: 43 processes: 7 internal, 36 local. FAILED: Build did NOT complete successfully

Standalone code to reproduce the issue

I run the follow command to docker image tensorflow/build:2.19-python3.10.
docker run -it -v $PWD:/tmp -w /tmp tensorflow/build:2.19-python3.10 bash -c "bazel build --experimental_action_cache_store_output_metadata --disk_cache=~/.cache/bazel --jobs=3 --config=linux //tensorflow/compiler/mlir/lite:tensorflow_lite_quantize"

### The build failed and the error message is:
/usr/include/c++/13/bits/unique_ptr.h:1070:30: error: call of overloaded 'DefaultQuantParamsPass(const mlir::TFL::DefaultQuantParamsPassOptions&)' is ambiguous
1070 | { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
|

Relevant log output


About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 26 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Hi, @npanpaliya I apologize for the delayed response, thank you for bringing this issue to our attention I’ll try to replicate the same behavior from my end and will update you.

Thank you for your cooperation and patience.

We are also seeing the same error with gcc 12, python 3.11 and tensorflow master branch. Could someone please provide any pointers on this issue?

Issue is not stale, it’s just being ignored by the TF developers.

@adamjstewart I think this is fine to merge; it’s a trivial change that breaks nothing. I will submit a PR. Please do let me know if this fixes the issue for you.

The title of this issue should probably be “TensorFlow build failure with GCC 13”. It has nothing to do with the build target.

Also, GCC might be correct that this is an actual ambiguity; I am not sure. I will see if I can create a small reproducer.

@adamjstewart

GCC is complaining that an inherited constructor is creating an ambiguity. I do not know whether this is a GCC bug, or if GCC is correct that the call is ambiguous.

But you can fix the problem by getting rid of the inherited constructor. The following patch allows my GCC 13 build to finish:

diff --git a/tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc b/tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc
index f1b602a6763..800a3fb0603 100644
--- a/tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc
+++ b/tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc
@@ -54,7 +54,9 @@ namespace {
 class DefaultQuantParamsPass
     : public impl::DefaultQuantParamsPassBase<DefaultQuantParamsPass> {
  public:
-  using DefaultQuantParamsPassBase::DefaultQuantParamsPassBase;
+  DefaultQuantParamsPass()
+  {
+  }

   explicit DefaultQuantParamsPass(double default_min, double default_max,
                                   bool is_signed) {

I don’t think this issue has anything to do with LiteRT, I encounter this bug anytime I try to build TensorFlow with GCC.

We are also encountering the same issue trying to build TF at tip-of-tree for x86_64 (albeit using hermetic Clang).