telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.45k stars 5.26k forks source link

1.7.11 build failure #6219

Closed xvitaly closed 5 years ago

xvitaly commented 5 years ago
### Steps to reproduce 1. Build 2. 3. ### Expected behaviour Successful build. ### Actual behaviour Build failure related to this: ```c++ #include ``` Do not use Qt private headers in your code. ### Configuration **Operating system:** Fedora 31 **Version of Telegram Desktop:** 1.7.11 **Used theme**: n/a
Logs: Insert log.txt here (if necessary)
xvitaly commented 5 years ago

Also one more error:

BUILDSTDERR: /builddir/build/BUILD/tdesktop-1.7.11/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:365:31: error: no member named 'convertFromARGB32PM' in 'QPixelLayout'; did you mean 'convertToARGB32PM'?
BUILDSTDERR:         const auto convert = layout->convertFromARGB32PM;
BUILDSTDERR:                                      ^~~~~~~~~~~~~~~~~~~
BUILDSTDERR:                                      convertToARGB32PM
BUILDSTDERR: /usr/include/qt5/QtGui/5.12.4/QtGui/private/qdrawhelper_p.h:1339:17: note: 'convertToARGB32PM' declared here
BUILDSTDERR:     ConvertFunc convertToARGB32PM;
BUILDSTDERR:                 ^
BUILDSTDERR: /builddir/build/BUILD/tdesktop-1.7.11/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:377:5: error: too many arguments to function call, expected 3, have 5
BUILDSTDERR:                                 layout,
BUILDSTDERR:                                 ^~~~~~~
BUILDSTDERR: /builddir/build/BUILD/tdesktop-1.7.11/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:387:4: error: too many arguments to function call, expected 3, have 5
BUILDSTDERR:                         layout,
BUILDSTDERR:                         ^~~~~~~
BUILDSTDERR: /builddir/build/BUILD/tdesktop-1.7.11/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:404:5: error: too many arguments to function call, expected 3, have 5
BUILDSTDERR:                                 layout,
BUILDSTDERR:                                 ^~~~~~~
BUILDSTDERR: /builddir/build/BUILD/tdesktop-1.7.11/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:413:4: error: too many arguments to function call, expected 3, have 5
BUILDSTDERR:                         layout,
BUILDSTDERR:                         ^~~~~~~
BUILDSTDERR: 1 warning and 5 errors generated.
xvitaly commented 5 years ago

Regression caused by 556f36ba7ececef1a0b96655ba6b2410faf8614e commit.

Johnnynator commented 5 years ago

The actual breakage was already introduced by https://github.com/telegramdesktop/tdesktop/commit/5628c1eee6125f3015166f29a49d53e541590d7f

xvitaly commented 5 years ago

@john-preston Can you fix this? Now we cannot built Telegram Desktop package at all.

raku-cat commented 5 years ago

Just attempted build with 1.7.14 on arch using the PKGBUILD that exists for 1.17.10, currently results in this

/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp: In function ‘FFmpeg::CodecPointer FFmpeg::MakeCodecPointer(gsl::not_null<AVStream*>)’:
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:139:54: warning: ‘void av_codec_set_pkt_timebase(AVCodecContext*, AVRational)’ is deprecated [-Wdeprecated-declarations]
  139 |  av_codec_set_pkt_timebase(context, stream->time_base);
      |                                                      ^
In file included from /tmp/makepkg/telegram-desktop/src/tdesktop/out/Release/../../Telegram/SourceFiles/ffmpeg/ffmpeg_utility.h:18,
                 from /tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:8:
/usr/include/libavcodec/avcodec.h:3326:12: note: declared here
 3326 | void       av_codec_set_pkt_timebase         (AVCodecContext *avctx, AVRational val);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:139:54: warning: ‘void av_codec_set_pkt_timebase(AVCodecContext*, AVRational)’ is deprecated [-Wdeprecated-declarations]
  139 |  av_codec_set_pkt_timebase(context, stream->time_base);
      |                                                      ^
In file included from /tmp/makepkg/telegram-desktop/src/tdesktop/out/Release/../../Telegram/SourceFiles/ffmpeg/ffmpeg_utility.h:18,
                 from /tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:8:
/usr/include/libavcodec/avcodec.h:3326:12: note: declared here
 3326 | void       av_codec_set_pkt_timebase         (AVCodecContext *avctx, AVRational val);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp: In function ‘void FFmpeg::UnPremultiply(QImage&, const QImage&)’:
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:365:31: error: ‘struct QPixelLayout’ has no member named ‘convertFromARGB32PM’; did you mean ‘convertToARGB32PM’?
  365 |  const auto convert = layout->convertFromARGB32PM;
      |                               ^~~~~~~~~~~~~~~~~~~
      |                               convertToARGB32PM
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp: In function ‘void FFmpeg::PremultiplyInplace(QImage&)’:
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:402:5: error: invalid conversion from ‘const uint*’ {aka ‘const unsigned int*’} to ‘int’ [-fpermissive]
  402 |     reinterpret_cast<const uint*>(bytes),
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     |
      |     const uint* {aka const unsigned int*}
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:403:5: error: invalid conversion from ‘int’ to ‘const QVector<unsigned int>*’ [-fpermissive]
  403 |     width,
      |     ^~~~~
      |     |
      |     int
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:405:12: error: too many arguments to function
  405 |     nullptr);
      |            ^
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:411:4: error: invalid conversion from ‘const uint*’ {aka ‘const unsigned int*’} to ‘int’ [-fpermissive]
  411 |    reinterpret_cast<const uint*>(image.bits()),
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    |
      |    const uint* {aka const unsigned int*}
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:412:18: error: invalid conversion from ‘int’ to ‘const QVector<unsigned int>*’ [-fpermissive]
  412 |    image.width() * image.height(),
      |    ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
      |                  |
      |                  int
/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:414:11: error: too many arguments to function
  414 |    nullptr);
      |           ^
make[2]: *** [CMakeFiles/lib_ffmpeg.dir/build.make:63: CMakeFiles/lib_ffmpeg.dir/tmp/makepkg/telegram-desktop/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.o] Error 1
klimentyev commented 5 years ago

@john-preston why do you use private Qt headers? Please fix, because Linux maintainers can't build Telegram.

farseerfc commented 5 years ago

I wrote a dirty ugly patch to fix this and thus should build with newer versions of Qt5. This patch is now applied in Arch Linux community repo: https://git.archlinux.org/svntogit/community.git/tree/trunk/tdesktop-ffmpeg-fix-convertFromARGB32PM.patch?h=packages/telegram-desktop&id=3636fcefe5d6170a466ed219c94d2aa8cc445d46 Together with another small patch to disable static qt for rlottie, now should be compatible with system-wide qt5: https://git.archlinux.org/svntogit/community.git/tree/trunk/tdesktop-rlottie-static-qt.patch?h=packages/telegram-desktop&id=3636fcefe5d6170a466ed219c94d2aa8cc445d46

This fix tried to convert QImage to the desired format using public API, and create a QImage with spoofed (wrong) QImage::Format. It is dirty because the added malloc and memcpy operations. Hope someone can create a cleaner version as a PR instead of this.

vitlav commented 5 years ago

I wrote a dirty ugly patch to fix this and thus should build with newer versions of Qt5. Thank you, it helps build latest version 1.7.14. Animated stickers are work!

klimentyev commented 5 years ago

@farseerfc Thanks! Does Qt delete the buffer automatically? https://git.archlinux.org/svntogit/community.git/tree/trunk/tdesktop-ffmpeg-fix-convertFromARGB32PM.patch?h=packages/telegram-desktop&id=3636fcefe5d6170a466ed219c94d2aa8cc445d46#n18

john-preston commented 5 years ago

@klimentyev AlignedImageBufferCleanupHandler clears it on the image destruction.

klimentyev commented 5 years ago

@john-preston ok, thx

john-preston commented 5 years ago

@farseerfc I've looked on the code and I think this can be done easily in public APIs without additional malloc-s and memcpy-s with a small performance degradation in case of different CPU extension availability that are used in the private APIs case.

farseerfc commented 5 years ago

@john-preston thanks a lot for properly fixing this! I will soon backport your fix to Arch Linux release of telegram-desktop.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.