Package: libtgowt-dev
Version: 0~git20230615.a45d8b8+dfsg-2.1
Severity: grave
Tags: patch
Justification: renders package unusable
X-Debbugs-Cc: [email protected]

Dear Maintainer,

I wanted to backport the 'telegram-desktop' package from sid to trixie
(where it is currently unavailable). The package built fine, except
at the linking stage, where 'ld' failed, complaining about undefined
references to functions from the libtg_owt library which where taking
as arguments or returning objects whose type was in the 'absl::debian7'
namespace.

A minimal example which produces the same error is the following C++
file:

    #include <iostream>
    #include "rtc_base/strings/string_builder.h"

    int main() {
      char buf[16];
      rtc::SimpleStringBuilder sb{rtc::ArrayView<char>(buf)};

      // Call rtc::SimpleStringBuilder::operator<<(absl::string_view)
      sb << "Hello, world!";

      std::cout << sb.str() << std::endl;

      return 0;
    }

To reproduce the bug (on trixie):
- install 'libtgowt-dev'
- save the above C++ file as 'test.cc'
- compile with the following command:
    g++ -isystem /usr/include/tg_owt test.cc -ltg_owt

This will fail with the following error:

    /usr/bin/ld: /tmp/ccKm0X11.o: in function `main':
    test.cc:(.text+0x5b): undefined reference to 
`rtc::SimpleStringBuilder::operator<<(absl::debian7::string_view)'
    collect2: error: ld returned 1 exit status

Looking at the symbols defined in '/lib/x86_64-linux-gnu/libtg_owt.a'
as provided by 'libtgowt-dev' version 0~git20230615.a45d8b8+dfsg-2.1,
we can see that the library only provides the following function:

    rtc::SimpleStringBuilder::operator<<(absl::debian5::string_view)

but not

    rtc::SimpleStringBuilder::operator<<(absl::debian7::string_view)

(Note the difference in the namespace of the first argument.)

This is due to the fact that the 'libtgowt-dev' package was built
using 'libabsl-dev' version 20230802.1-4 (as can be confirmed by the
corresponding 'buildinfo'), whose 'ABSL_OPTION_INLINE_NAMESPACE_NAME'
constant is #defined to 'debian5', instead of version 20240722.0-4,
currently packaged in trixie, forky and sid, and whose
'ABSL_OPTION_INLINE_NAMESPACE_NAME' is 'debian7'.

Indeed, re-building package 'libtgowt-dev' with the current version
of 'libabsl-dev' (20240722.0-4) and installing the new package fixed
the issue. Compilation and linking went as expected, and the test
program produced the expected output:

    $ g++ -isystem /usr/include/tg_owt test.cc -ltg_owt
    $ ./a.out
    Hello, world!

The rebuilt 'libtgowt-dev' package also allowed me to backport
'telegram-desktop' version 4.14.9+ds-1.1 to trixie without any other
modification.

Maybe a solution to avoid this in the future would be to force the
'libtgowt-dev' package to depend on the same major version of
libabsl-dev as the one it was built against? I'm attaching a small
patch to that effect.

Thank you very much in advance!

snip

-- System Information:
Debian Release: 13.0
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.41+deb13-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libtgowt-dev depends on:
ii  libabsl-dev        20240722.0-4
ii  libavcodec-dev     7:7.1.1-1+b1
ii  libavformat-dev    7:7.1.1-1+b1
ii  libavutil-dev      7:7.1.1-1+b1
ii  libc6-dev          2.41-12
ii  libglib2.0-dev     2.84.3-1
ii  libopus-dev        1.5.2-2
ii  libprotobuf-dev    3.21.12-11
ii  libsrtp2-dev       2.7.0-3
ii  libssl-dev         3.5.1-1
ii  libswresample-dev  7:7.1.1-1+b1
ii  libswscale-dev     7:7.1.1-1+b1
ii  libvpx-dev         1.15.0-2.1
ii  libx11-dev         2:1.8.12-1
ii  libxcomposite-dev  1:0.4.6-1
ii  libxdamage-dev     1:1.1.6-1+b2
ii  libxext-dev        2:1.3.4-1+b3
ii  libxfixes-dev      1:6.0.0-2+b4
ii  libxrandr-dev      2:1.5.4-1+b3
ii  libxrender-dev     1:0.9.12-1
ii  libxtst-dev        2:1.2.5-1
ii  libyuv-dev         0.0.1904.20250204-1

libtgowt-dev recommends no packages.

libtgowt-dev suggests no packages.

-- no debconf information
diff -Naur libtgowt-0~git20230615.a45d8b8+dfsg/debian/changelog 
libtgowt-0~git20230615.a45d8b8+dfsg/debian/changelog
--- libtgowt-0~git20230615.a45d8b8+dfsg/debian/changelog        2024-09-11 
10:50:50.000000000 +0000
+++ libtgowt-0~git20230615.a45d8b8+dfsg/debian/changelog        2025-09-03 
21:48:39.922787116 +0000
@@ -1,3 +1,11 @@
+libtgowt (0~git20230615.a45d8b8+dfsg-2.2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Make sure the package depends on the same major version of libabsl-dev as
+    the one it was built against.
+
+ -- snip <[email protected]>  Wed, 03 Sep 2025 21:40:28 +0000
+
 libtgowt (0~git20230615.a45d8b8+dfsg-2.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Naur libtgowt-0~git20230615.a45d8b8+dfsg/debian/control 
libtgowt-0~git20230615.a45d8b8+dfsg/debian/control
--- libtgowt-0~git20230615.a45d8b8+dfsg/debian/control  2023-06-24 
08:56:41.000000000 +0000
+++ libtgowt-0~git20230615.a45d8b8+dfsg/debian/control  2025-09-03 
22:25:05.258194503 +0000
@@ -46,7 +46,7 @@
 Section: libdevel
 Architecture: any
 Multi-Arch: same
-Depends: libabsl-dev, ${misc:Depends}, ${static:Depends}
+Depends: libabsl-dev (>= ${libabsl-dev-version}), libabsl-dev (<= 
${libabsl-dev-version}.999), ${misc:Depends}, ${static:Depends}
 Description: telegram related WebRTC fork
  This supporting package contains a reduced fork of WebRTC source code. It is
  primarily needed for build support of video calls in Telegram Desktop. WebRTC
diff -Naur libtgowt-0~git20230615.a45d8b8+dfsg/debian/rules 
libtgowt-0~git20230615.a45d8b8+dfsg/debian/rules
--- libtgowt-0~git20230615.a45d8b8+dfsg/debian/rules    2023-06-24 
09:58:51.000000000 +0000
+++ libtgowt-0~git20230615.a45d8b8+dfsg/debian/rules    2025-09-03 
22:25:40.047080071 +0000
@@ -31,8 +31,10 @@
 # Delete no longer used headers.
        $(RM) -r $(INCLUDE_DIR)/third_party/libyuv
 
-# Collect all required packages for linking against the static library.
 execute_before_dh_gencontrol:
+# Major version of libabsl-dev.
+       echo libabsl-dev-version=$$(dpkg-query -f '$${Version}\n' -W 
libabsl-dev | cut -d. -f1) >> debian/libtgowt-dev.substvars
+# Collect all required packages for linking against the static library.
        find $(INSTALL_DIR)/usr -name '*.cmake' | xargs grep -h -o 
'[^";]*\.so\>' | sort -u | xargs dpkg -S > debian/libtgowt-dev.deps
        echo static:Depends=$$(awk -F: '{print $$1 ","}' 
debian/libtgowt-dev.deps) >> debian/libtgowt-dev.substvars
 ifeq ($(filter terse,$(DEB_BUILD_OPTIONS)),)

Reply via email to