Bug 276983

Summary: devel/android-tools: build error error: no template named 'function' in namespace 'std'
Product: Ports & Packages Reporter: Ale <discipline>
Component: Individual Port(s)Assignee: Neel Chauhan <nc>
Status: Closed FIXED    
Severity: Affects Only Me CC: mikael, rhurlin, rozhuk.im, vsasjason
Priority: --- Flags: nc: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
v0 none

Description Ale 2024-02-11 14:07:59 UTC
After the PORTREVISION bump due to pr276530 (https://cgit.freebsd.org/ports/commit/devel/android-tools/Makefile?id=7e5aa2085f48d71be003c8ff0377bde837467291), I'm receiving the following error while building devel/android-tools:

[  6% 39/629] /usr/bin/c++  -I/usr/ports/devel/android-tools/work/.build/vendor -I/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb -I/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/include -I/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/boringssl/include -I/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/libbase/include -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -std=gnu++2a -Wno-attributes -D_FILE_OFFSET_BITS=64 -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include  -DNDEBUG -MD -MT vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o -MF vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o.d -o vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o -c /usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp
FAILED: vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o 
/usr/bin/c++  -I/usr/ports/devel/android-tools/work/.build/vendor -I/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb -I/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/include -I/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/boringssl/include -I/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/libbase/include -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -std=gnu++2a -Wno-attributes -D_FILE_OFFSET_BITS=64 -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include  -DNDEBUG -MD -MT vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o -MF vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o.d -o vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o -c /usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp
In file included from /usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp:17:
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/include/adb/tls/tls_connection.h:51:31: error: no template named 'function' in namespace 'std'
   51 |     using CertVerifyCb = std::function<int(X509_STORE_CTX*)>;
      |                          ~~~~~^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/include/adb/tls/tls_connection.h:52:28: error: no template named 'function' in namespace 'std'
   52 |     using SetCertCb = std::function<int(SSL*)>;
      |                       ~~~~~^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/include/adb/tls/tls_connection.h:67:40: error: unknown type name 'CertVerifyCb'
   67 |     virtual void SetCertVerifyCallback(CertVerifyCb cb) = 0;
      |                                        ^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/include/adb/tls/tls_connection.h:76:41: error: unknown type name 'SetCertCb'
   76 |     virtual void SetCertificateCallback(SetCertCb cb) = 0;
      |                                         ^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp:45:32: error: unknown type name 'CertVerifyCb'
   45 |     void SetCertVerifyCallback(CertVerifyCb cb) override;
      |                                ^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp:46:33: error: unknown type name 'SetCertCb'
   46 |     void SetCertificateCallback(SetCertCb cb) override;
      |                                 ^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp:78:5: error: unknown type name 'CertVerifyCb'
   78 |     CertVerifyCb cert_verify_cb_;
      |     ^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp:79:5: error: unknown type name 'SetCertCb'
   79 |     SetCertCb set_cert_cb_;
      |     ^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp:166:47: error: unknown type name 'CertVerifyCb'
  166 | void TlsConnectionImpl::SetCertVerifyCallback(CertVerifyCb cb) {
      |                                               ^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp:170:48: error: unknown type name 'SetCertCb'
  170 | void TlsConnectionImpl::SetCertificateCallback(SetCertCb cb) {
      |                                                ^
/usr/ports/devel/android-tools/work/freebsd-android-tools-271d7a26c8daf4b9fe412d360a2edfaca327efdd/vendor/adb/tls/tls_connection.cpp:369:12: error: no viable conversion from returned value of type 'unique_ptr<adb::tls::(anonymous namespace)::TlsConnectionImpl>' to function return type 'unique_ptr<TlsConnection>'
  369 |     return std::make_unique<TlsConnectionImpl>(role, cert, priv_key, fd);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__memory/unique_ptr.h:127:59: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'typename __unique_if<TlsConnectionImpl>::__unique_single' (aka 'unique_ptr<adb::tls::(anonymous namespace)::TlsConnectionImpl>') to 'const unique_ptr<TlsConnection> &' for 1st argument
  127 | class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr {
      |                                                           ^~~~~~~~~~
/usr/include/c++/v1/__memory/unique_ptr.h:191:21: note: candidate constructor template not viable: no known conversion from 'typename __unique_if<TlsConnectionImpl>::__unique_single' (aka 'unique_ptr<adb::tls::(anonymous namespace)::TlsConnectionImpl>') to 'nullptr_t' (aka 'std::nullptr_t') for 1st argument
  191 |   _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
      |                     ^          ~~~~~~~~~
/usr/include/c++/v1/__memory/unique_ptr.h:213:59: note: candidate constructor not viable: no known conversion from 'typename __unique_if<TlsConnectionImpl>::__unique_single' (aka 'unique_ptr<adb::tls::(anonymous namespace)::TlsConnectionImpl>') to 'unique_ptr<TlsConnection> &&' for 1st argument
  213 |   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT
      |                                                           ^          ~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__memory/unique_ptr.h:220:59: note: candidate template ignored: requirement 'is_convertible<adb::tls::(anonymous namespace)::TlsConnectionImpl *, adb::tls::TlsConnection *>::value' was not satisfied [with _Up = adb::tls::(anonymous namespace)::TlsConnectionImpl, _Ep = std::default_delete<adb::tls::(anonymous namespace)::TlsConnectionImpl>]
  220 |   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
      |                                                           ^
/usr/include/c++/v1/__memory/unique_ptr.h:194:68: note: explicit constructor is not a candidate
  194 |   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT
      |                                                                    ^
11 errors generated.
ninja: build stopped: subcommand failed.
*** Error code 1


The installed go version is from lang/go120.
The ports has been previously built (from updated ports) on 14th Dec. 2023 with success.
I don't know if the problem is related to that but in the meanwhile I updated my box tracking stable/13 on 10th Feb. 2024, so llvm project in base has been upgraded from version 16 to 17:
$ /usr/bin/c++ --version
FreeBSD clang version 17.0.6 (https://github.com/llvm/llvm-project.git llvmorg-17.0.6-0-g6009708b4367)
Target: x86_64-unknown-freebsd13.3
Thread model: posix
InstalledDir: /usr/bin
Comment 1 Mikael Urankar freebsd_committer freebsd_triage 2024-02-11 14:45:18 UTC
Created attachment 248359 [details]
v0

Can you try the attached patch?
Comment 2 Ale 2024-02-11 15:06:02 UTC
(In reply to Mikael Urankar from comment #1)
It worked!
Comment 3 Rainer Hurling freebsd_committer freebsd_triage 2024-02-11 16:21:35 UTC
The patch also builds for me on a recent CURRENT, thanks!
Comment 4 Neel Chauhan freebsd_committer freebsd_triage 2024-02-11 21:55:18 UTC
LGTM.

However, as I am no longer a FreeBSD user (outside of OPNsense), I do not have access to a FreeBSD system to commit this, so one of you other committers will need to push it.

(I technically still do have my private keys, but not a BSD system)
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-02-17 20:31:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6dbc3df04ebbe95dcad623ce76554fb52e26be3d

commit 6dbc3df04ebbe95dcad623ce76554fb52e26be3d
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2024-02-17 20:22:15 +0000
Commit:     Rainer Hurling <rhurlin@FreeBSD.org>
CommitDate: 2024-02-17 20:22:15 +0000

    devel/android-tools: Fix build, include functional

    While here, pet portlint.

    PR:             276983
    Reported by:    Ale <discipline@tiscali.it>
    MFH:            2024Q1

 devel/android-tools/Makefile                                   |  5 +++--
 ...atch-vendor_adb_tls_include_adb_tls_tls__connection.h (new) | 10 ++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-02-17 20:36:42 UTC
A commit in branch 2024Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f7acb519547e2ccbd19699759a01027cc528d0c9

commit f7acb519547e2ccbd19699759a01027cc528d0c9
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2024-02-17 20:22:15 +0000
Commit:     Rainer Hurling <rhurlin@FreeBSD.org>
CommitDate: 2024-02-17 20:34:53 +0000

    devel/android-tools: Fix build, include functional

    While here, pet portlint.

    PR:             276983
    Reported by:    Ale <discipline@tiscali.it>
    MFH:            2024Q1

    (cherry picked from commit 6dbc3df04ebbe95dcad623ce76554fb52e26be3d)

 devel/android-tools/Makefile                                   |  5 +++--
 ...atch-vendor_adb_tls_include_adb_tls_tls__connection.h (new) | 10 ++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
Comment 7 Rainer Hurling freebsd_committer freebsd_triage 2024-02-17 20:40:29 UTC
Committed, thanks. Hope, all is fine for this version now.

BTW: In the original repo, there is a version 34.0.4 from Sept, 23. 2023 [1]

[1] https://github.com/nmeum/android-tools/releases/tag/34.0.4
Comment 8 Anton Saietskii 2024-02-19 15:01:40 UTC
(In reply to Rainer Hurling from comment #7)

That's not actually original repo if we're talking about upstream for current port. Despite that, repo suggested by you looks promising -- perhaps someone will be able to port that as well.
Comment 9 Rainer Hurling freebsd_committer freebsd_triage 2024-02-19 17:15:10 UTC
(In reply to Anton Saietskii from comment #8)

That was the reason why I mentioned this repo ;)