Bug 260040

Summary: net-im/telegram-desktop: fails to build on recent head (after clang 13 import)
Product: Ports & Packages Reporter: Guido Falsi <madpilot>
Component: Individual Port(s)Assignee: Gleb Smirnoff <glebius>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (glebius)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 260042, 260044    
Bug Blocks:    

Description Guido Falsi freebsd_committer freebsd_triage 2021-11-25 08:45:27 UTC
Hi,

I have recently updated my head installation and this port now fails to build.

I was actually able to fix this and the failures are caused by these two dependencies:

net-im/tg_owt
devel/range-v3

which install include files that are invalid with clang 13 (Looks like incompatibilities with C++17 and/or C++20)

No change is required in the telegram-desktop port, but I'm filing this to keep everyone informed.

I'll file separate bug reports with patches for the two mentioned ports and set those as dependencies of this one. Both patches are imported from upstream sources.

These are the two errors I'm seeing:

-------------------
FAILED: Telegram/CMakeFiles/lib_tgcalls.dir/ThirdParty/tgcalls/tgcalls/CodecSelectHelper.cpp.o 
/usr/bin/c++ -DBWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0 -DDESKTOP_APP_DISABLE_CRASH_REPORTS -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION -DDESKTOP_APP_USE_PACKAGED -DHAVE_WEBRTC_VIDEO -DNO_MAIN_THREAD_WRAPPING -DQT_IMPLICIT_QCHAR_CONSTRUCTION -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS -DRTC_DISABLE_TRACE_EVENTS -DRTC_ENABLE_VP9 -DTGCALLS_USE_STD_OPTIONAL -DWEBRTC_APM_DEBUG_DUMP=0 -DWEBRTC_APP_TDESKTOP -DWEBRTC_DUMMY_AUDIO_BUILD -DWEBRTC_ENABLE_PROTOBUF=0 -DWEBRTC_FREEBSD -DWEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE -DWEBRTC_LIBRARY_IMPL -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1 -DWEBRTC_OPUS_SUPPORT_120MS_PTIME=1 -DWEBRTC_OPUS_VARIABLE_COMPLEXITY=0 -DWEBRTC_POSIX -DWEBRTC_USE_BUILTIN_ISAC_FLOAT -DWEBRTC_USE_H264 -DWEBRTC_USE_PIPEWIRE -DWEBRTC_USE_X11 -D_FORTIFY_SOURCE=2 -I/wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/ThirdParty/tgcalls -I/wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/ThirdParty/tgcalls/tgcalls -isystem /usr/local/include/tg_owt -isystem /usr/local/include/tg_owt/third_party/libyuv/include -isystem /usr/local/include/tg_owt/third_party/abseil-cpp -isystem /usr/local/include -O2 -pipe -march=nehalem -fstack-protector-strong -fno-strict-aliasing  -DNDEBUG -O2 -pipe -march=nehalem -fstack-protector-strong -fno-strict-aliasing  -DNDEBUG -Wno-deprecated-volatile -Wno-ambiguous-reversed-operator -fstack-protector-all -fstack-clash-protection -fPIC -fno-strict-aliasing -pipe -Wall -W -Wno-unused-parameter -Wno-switch -Wno-missing-field-initializers -Wno-sign-compare -std=gnu++20 -MD -MT Telegram/CMakeFiles/lib_tgcalls.dir/ThirdParty/tgcalls/tgcalls/CodecSelectHelper.cpp.o -MF Telegram/CMakeFiles/lib_tgcalls.dir/ThirdParty/tgcalls/tgcalls/CodecSelectHelper.cpp.o.d -o Telegram/CMakeFiles/lib_tgcalls.dir/ThirdParty/tgcalls/tgcalls/CodecSelectHelper.cpp.o -c /wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/ThirdParty/tgcalls/tgcalls/CodecSelectHelper.cpp
In file included from /wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/ThirdParty/tgcalls/tgcalls/CodecSelectHelper.cpp:1:
In file included from /wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/ThirdParty/tgcalls/tgcalls/CodecSelectHelper.h:4:
In file included from /wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/ThirdParty/tgcalls/tgcalls/Message.h:4:
In file included from /usr/local/include/tg_owt/api/candidate.h:20:
In file included from /usr/local/include/tg_owt/rtc_base/checks.h:57:
/usr/local/include/tg_owt/third_party/abseil-cpp/absl/meta/type_traits.h:630:35: error: no type named 'result_of' in namespace 'std'
using result_of_t = typename std::result_of<T>::type;
                    ~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/include/tg_owt/third_party/abseil-cpp/absl/meta/type_traits.h:630:44: error: expected ';' after alias declaration
using result_of_t = typename std::result_of<T>::type;
                                           ^
2 errors generated.
------------------------

------------------------
FAILED: Telegram/lib_base/CMakeFiles/lib_base_crash_report_writer.dir/cmake_pch.hxx.pch 
/usr/bin/c++ -DDESKTOP_APP_DISABLE_CRASH_REPORTS -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION -DDESKTOP_APP_USE_PACKAGED -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_IMPLICIT_QCHAR_CONSTRUCTION -DQT_NETWORK_LIB -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_SVG_LIB -DQT_WIDGETS_LIB -D_FORTIFY_SOURCE=2 -I/wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/lib_base -I/wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/lib_rpl -I/wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/lib_crl -isystem /usr/local/include -isystem /usr/local/include/qt5/QtCore/5.15.2 -isystem /usr/local/include/qt5/QtCore/5.15.2/QtCore -isystem /usr/local/include/qt5/QtGui/5.15.2 -isystem /usr/local/include/qt5/QtGui/5.15.2/QtGui -isystem /usr/local/include/qt5 -isystem /usr/local/include/qt5/QtCore -isystem /usr/local/lib/qt5/mkspecs/freebsd-clang -isystem /usr/local/include/qt5/QtGui -isystem /usr/local/include/qt5/QtWidgets -isystem /usr/local/include/qt5/QtNetwork -isystem /usr/local/include/qt5/QtSvg -isystem /usr/local/include/qt5/QtDBus -isystem /usr/local/include/giomm-2.4 -isystem /usr/local/lib/giomm-2.4/include -isystem /usr/local/include/glib-2.0 -isystem /usr/local/lib/glib-2.0/include -isystem /usr/local/include/glibmm-2.4 -isystem /usr/local/lib/glibmm-2.4/include -isystem /usr/local/include/sigc++-2.0 -isystem /usr/local/lib/sigc++-2.0/include -isystem /usr/local/include/gio-unix-2.0 -O2 -pipe -march=nehalem -fstack-protector-strong -fno-strict-aliasing  -DNDEBUG -O2 -pipe -march=nehalem -fstack-protector-strong -fno-strict-aliasing  -DNDEBUG -fstack-protector-all -fstack-clash-protection -fPIC -fno-strict-aliasing -pipe -Wall -W -Wno-unused-parameter -Wno-switch -Wno-missing-field-initializers -Wno-sign-compare -pthread -std=gnu++20 -Winvalid-pch -fpch-instantiate-templates -Xclang -emit-pch -Xclang -include -Xclang /wrkdirs/usr/ports/net-im/telegram-desktop/work/.build/Telegram/lib_base/CMakeFiles/lib_base_crash_report_writer.dir/cmake_pch.hxx -x c++-header -MD -MT Telegram/lib_base/CMakeFiles/lib_base_crash_report_writer.dir/cmake_pch.hxx.pch -MF Telegram/lib_base/CMakeFiles/lib_base_crash_report_writer.dir/cmake_pch.hxx.pch.d -o Telegram/lib_base/CMakeFiles/lib_base_crash_report_writer.dir/cmake_pch.hxx.pch -c /wrkdirs/usr/ports/net-im/telegram-desktop/work/.build/Telegram/lib_base/CMakeFiles/lib_base_crash_report_writer.dir/cmake_pch.hxx.cxx
In file included from <built-in>:1:
In file included from /wrkdirs/usr/ports/net-im/telegram-desktop/work/.build/Telegram/lib_base/CMakeFiles/lib_base_crash_report_writer.dir/cmake_pch.hxx:5:
In file included from /wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-3.2.5-full/Telegram/lib_base/base/base_pch.h:23:
In file included from /usr/local/include/range/v3/all.hpp:17:
In file included from /usr/local/include/range/v3/action.hpp:17:
In file included from /usr/local/include/range/v3/action/action.hpp:23:
In file included from /usr/local/include/range/v3/action/concepts.hpp:23:
In file included from /usr/local/include/range/v3/range/concepts.hpp:37:
In file included from /usr/local/include/range/v3/iterator/concepts.hpp:30:
In file included from /usr/local/include/range/v3/iterator/access.hpp:22:
/usr/local/include/std/detail/associated_types.hpp:270:60: error: too many template arguments for class template '__iterator_traits'
            &is_std_iterator_traits_specialized_impl_(std::__iterator_traits<I, B> *))[2];
                                                           ^                    ~~
/usr/include/c++/v1/__iterator/iterator_traits.h:326:8: note: template is declared here
struct __iterator_traits {};
       ^
1 error generated.
------------------------
Comment 1 commit-hook freebsd_committer freebsd_triage 2021-11-25 19:03:52 UTC
A commit in branch main references this bug:

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

commit cf108be7a7cb0ab997984a70a2192af7d7040ab0
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2021-11-25 18:59:53 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2021-11-25 18:59:53 +0000

    devel/range-v3: Fix installed include to work with clang13

    Import upstream patch to fix incompatibility with clang13. This
    fixes build of telegram-desktop [1] in recent head after clang13 import.

    PR:             260044, 260040 [1]
    Approved by:    build fix blanket
    Obtained from:  https://github.com/ericniebler/range-v3/commit/0487cca29e352e8f16bbd91fda38e76e39a0ed28

 devel/range-v3/Makefile                       |   1 +
 devel/range-v3/files/patch-0487cca29e35 (new) | 122 ++++++++++++++++++++++++++
 2 files changed, 123 insertions(+)
Comment 2 commit-hook freebsd_committer freebsd_triage 2021-11-25 19:03:54 UTC
A commit in branch main references this bug:

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

commit c88ab801382cef0e6d65740a390cc9bbdac99eae
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2021-11-25 18:55:29 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2021-11-25 18:59:35 +0000

    net-im/tg_owt: Fix installed include to work with clang13

    Import code from upstream fixing an issue in an installed include
    file causing telegram-desktop [1] to fail to build on recent head after
    the import of clang13.

    PR:             260042, 260040 [1]
    Approved by:    build fix blanket
    Obtained from:  https://github.com/abseil/abseil-cpp/commit/e19260fd7dbef881492fd73891e0be5bd4a09b95

 net-im/tg_owt/Makefile                             |  2 +-
 ...party_abseil-cpp_absl_meta_type__traits.h (new) | 30 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
Comment 3 Guido Falsi freebsd_committer freebsd_triage 2021-11-25 19:06:31 UTC
Required patches committed with blanket approval.

Port now builds fine.