Issue 247299694: there is a problem when I build it

15 views
Skip to first unread message

buganize...@google.com

unread,
Sep 18, 2022, 4:09:35 AM9/18/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default


ex...@gmail.com added comment #1:

When I build the source code, I found that there is a  bug what the return type doesn’t match in file_reader.cc:85, could you tell me what’s wrong with it?

std::unique_ptr<FileReaderInterface> FileReader::Open(
    const std::string& file_name, const bool error_tolerant) {
...
std::unique_ptr<FileReader> file(
      new (std::nothrow) FileReader(raw_file_ptr, owns_file, error_tolerant));
...
return file   //the bug is there
}

Regards,
Zhongqing Jiang



Generated by Google IssueTracker notification system

You're receiving this email because you are subscribed to updates on Google IssueTracker issue 247299694
Unsubscribe from this issue.

buganize...@google.com

unread,
Sep 19, 2022, 10:28:35 PM9/19/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

jz...@google.com added comment #2:
Thanks for the report. What compiler were you using to build the code? Could you include the error message you're seeing too please?

_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Sep 19, 2022, 10:35:53 PM9/19/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

jz...@google.com added comment #3:

It might have to do with the difference between std::unique_ptr<FileReader> and std::unique_ptr<FileReaderInterface>, but I'd like to see the error message.



_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Sep 21, 2022, 9:46:15 AM9/21/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

ex...@gmail.com added comment #4:
I use make to compile the source code, the error message is as follows.

external/libgav1/libgav1/examples/file_reader.cc:85:10: error: no viable conversion from returned value of type
      'unique_ptr<libgav1::FileReader>' to function return type 'unique_ptr<libgav1::FileReaderInterface>'
  return file;
         ^~~~
/usr/bin/../lib/gcc/i686-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:200:17: note: candidate constructor not viable: no known
      conversion from 'std::unique_ptr<FileReader>' to 'nullptr_t' for 1st argument
      constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { }
                ^
/usr/bin/../lib/gcc/i686-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:205:7: note: candidate constructor not viable: no known
      conversion from 'std::unique_ptr<FileReader>' to 'std::unique_ptr<libgav1::FileReaderInterface, std::default_delete<libgav1::FileReaderInterface>
      > &&' for 1st argument
      unique_ptr(unique_ptr&& __u) noexcept
      ^
/usr/bin/../lib/gcc/i686-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:220:2: note: candidate constructor [with _Up =
      libgav1::FileReader, _Ep = std::default_delete<libgav1::FileReader>, $2 = void] not viable: no known conversion from
      'std::unique_ptr<FileReader>' to 'unique_ptr<libgav1::FileReader, std::default_delete<libgav1::FileReader> > &&' for 1st argument
        unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
        ^
/usr/bin/../lib/gcc/i686-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:356:7: note: candidate constructor not viable: no known
      conversion from 'std::unique_ptr<FileReader>' to 'const std::unique_ptr<libgav1::FileReaderInterface,
      std::default_delete<libgav1::FileReaderInterface> > &' for 1st argument
      unique_ptr(const unique_ptr&) = delete;
      ^
/usr/bin/../lib/gcc/i686-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:228:2: note: candidate template ignored: could not match
      'auto_ptr' against 'unique_ptr'
        unique_ptr(auto_ptr<_Up>&& __u) noexcept;
        ^
1 error generated.
CMakeFiles/libgav1_file_reader.dir/build.make:81: recipe for target 'CMakeFiles/libgav1_file_reader.dir/examples/file_reader.cc.o' failed
make[2]: *** [CMakeFiles/libgav1_file_reader.dir/examples/file_reader.cc.o] Error 1
CMakeFiles/Makefile2:699: recipe for target 'CMakeFiles/libgav1_file_reader.dir/all' failed
make[1]: *** [CMakeFiles/libgav1_file_reader.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
make: *** [all] Error 2


_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Sep 22, 2022, 8:41:56 AM9/22/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

ex...@gmail.com added comment #5:
I use cmake to compile the source code

_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Sep 22, 2022, 8:43:13 PM9/22/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

jz...@google.com added comment #6:

The compiler looks to be g++, what distribution are you using? Can you include the output from g++ --version? I don't see any issue with g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) for both 32 and 64-bit.

We generally recommend a more recent compiler. gcc 6+ or clang 7+ should work, as might a cast or reworking the function to return an output pointer.



_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Sep 23, 2022, 11:38:42 PM9/23/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

ex...@gmail.com added comment #7:
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0, clang 3.8

I will use gcc 6+, Thanks.

_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Sep 27, 2022, 6:24:36 PM9/27/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

jz...@google.com added comment #8:
Thanks for the update. Your version of g++ seems to match mine so I'm not sure why I wasn't seeing the issue. Can you include the cmake command line you used and the output from git describe?

I think we'll close this as working as intended since it's due to an issue with an old compiler.

_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Sep 27, 2022, 6:56:10 PM9/27/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

jz...@google.com added comment #9:
clang-3.8 shows the issue, so maybe that was set via alternatives or with -DCMAKE_CXX_COMPILER.

_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Sep 27, 2022, 8:40:43 PM9/27/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

jz...@google.com added comment #10:

A workaround with clang would be to explicitly move the return value: return std::move(file). You may also need to add -latomic to the link flags. This can be done with -DCMAKE_EXE_LINKER_FLAGS=-latomic.

This may actually be a bug since the return type differs from the variable and in C++11 this technically should be required. Let me check on the details.



_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Oct 1, 2022, 5:37:25 PM10/1/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed

ap...@google.com added comment #11:
Project: codecs/libgav1
Branch: main

commit db829677b625393ba8408b93096d10faadee2c8a
Author: James Zern <jz...@google.com>
Date:   Wed Sep 28 16:02:10 2022

    FileReader::Open: explicitly move return value
   
    This function returns a std::unique_ptr<FileReaderInterface> which
    FileReader derives from. In C++11 overload resolution was not considered
    for local variables:
   
    12.8 Copying and moving class objects (32)
    When the criteria for elision of a copy operation are met or would be
    met save for the fact that the source object is a function parameter,
    and the object to be copied is designated by an lvalue, overload
    resolution to select the constructor for the copy is first performed as
    if the object were designated by an rvalue.
   
    https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf
   
    Some compilers may have adopted C++14 behavior so this change may not
    always be strictly necessary:
   
    When the criteria for elision of a copy/move operation are met, but not
    for an exception-declaration, and the object to be copied is designated
    by an lvalue, or when the expression in a return statement is a
    (possibly parenthesized) id-expression that names an object with
    automatic storage duration declared in the body or
    parameter-declaration-clause of the innermost enclosing function or
    lambda-expression, overload resolution to select the constructor for the
    copy is first performed as if the object were designated by an rvalue
   
    https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf
   
    Rather than use std::move, return a new std::unique_ptr constructed from
    the FileReader pointer.
   
    This avoids the need for an ifdef to ensure the code is being
    compiled as C++11 and in the case of gcc, using a version (< 9)
    prior to the implementation of a fix for C++ core issue #1579 (Return by
    converting move constructor):
    https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579
   
    This fixes compilation with some older versions of clang (observed with
    3.8).
   
    Bug: b/247299694
    PiperOrigin-RevId: 478130178
    PiperOrigin-RevId: 478098624
    PiperOrigin-RevId: 477575208
    Change-Id: I15989ea73143134d70d82618763ccd1da0c49742

M       examples/file_reader.cc

https://chromium-review.googlesource.com/3927758


_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  New
reporter:  ex...@gmail.com
cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Oct 1, 2022, 5:39:35 PM10/1/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed
status:  New  →  Assigned
assignee:  <none>  →  jz...@google.com

_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  Assigned
reporter:  ex...@gmail.com
assignee:  jz...@google.com

cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



buganize...@google.com

unread,
Oct 1, 2022, 5:40:34 PM10/1/22
to gav1-deve...@googlegroups.com
Replying to this email means your email address will be shared with the team that works on this product.

https://issuetracker.google.com/issues/247299694

Changed
status:  Assigned  →  Fixed

jz...@google.com added comment #12:
Thanks again for the report and sorry it took so long to identify the issue. This should be fixed with clang-3.8 now. We don't regularly test with this, however, so a newer compiler is still recommended.

_______________________________

Reference Info: 247299694 there is a problem when I build it
component:  750480
status:  Fixed
reporter:  ex...@gmail.com
assignee:  jz...@google.com

cc:  ex...@gmail.com, ga...@googlegroups.com
type:  Bug
priority:  P4
severity:  S2
retention:  Component default



Reply all
Reply to author
Forward
0 new messages