Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 745813 - app-office/libreoffice-6.4.6.2 clang-10 segfault during build
Summary: app-office/libreoffice-6.4.6.2 clang-10 segfault during build
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Office Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-01 05:21 UTC by Markus Peloquin
Modified: 2021-08-16 01:56 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge_info.txt,5.87 KB, text/plain)
2020-10-01 05:22 UTC, Markus Peloquin
Details
build.log.xz (build.log.xz,422.29 KB, application/x-xz)
2020-10-01 05:28 UTC, Markus Peloquin
Details
libreoffice-clang.patch (libreoffice-clang10.patch,877 bytes, patch)
2020-10-27 04:09 UTC, Perfect Gentleman
Details | Diff
clang-11/llvm-11 libreoffic patch (libreoffice-6.4.7.2-llvm-11.patch,637 bytes, patch)
2020-11-26 10:57 UTC, Denis Pronin
Details | Diff
libreoffice-6.4.6.2-llvm-10-deleteException.patch (libreoffice-6.4.6.2-llvm-10-deux.patch,9.27 KB, patch)
2020-12-11 07:31 UTC, Markus Peloquin
Details | Diff
libreoffice-7.0.3.1-llvm-10-deleteException.patch (libreoffice-7.0.3.1-llvm-10-deux.patch,9.74 KB, patch)
2020-12-11 20:32 UTC, Markus Peloquin
Details | Diff
libreoffice-7.0.3.1-libcxx11.patch (libreoffice-7.0.3.1-libcxx11.patch,1.05 KB, patch)
2020-12-11 20:32 UTC, Markus Peloquin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Peloquin 2020-10-01 05:21:24 UTC
During the build I'm getting the same error as Mark Wright in Bug 713574, Comment 7:

Work on gallery 'file:///var/tmp/portage/app-office/libreoffice-6.4.6.2-r2/work/libreoffice-6.4.6.2/workdir/Gallery/education'
Existing themes: 0
/bin/sh: line 1: 17402 Segmentation fault      ( LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"$I/program:$I/program" $I/program/gengal.bin --build-tree --destdir file://$S/extras/source/gallery --name "education" --path $W/Gallery/education --filenames file://$RESPONSEFILE )
make[1]: *** [/var/tmp/portage/app-office/libreoffice-6.4.6.2-r2/work/libreoffice-6.4.6.2/solenv/gbuild/Gallery.mk:55: /var/tmp/portage/app-office/libreoffice-6.4.6.2-r2/work/libreoffice-6.4.6.2/workdir/Gallery/education.done] Error 139

I don't know how to get debugging information turned on, but I managed to get the segfault's backtrace (roughly the same as in Bug 713574, Comment 15):

  * frame #0: 0x00007ffff7fc114b libgcc3_uno.so`gcc3::deleteException(void*) + 43
    frame #1: 0x00007ffff3d0d8ec libc++abi.so.1`__cxa_end_catch + 204
    frame #2: 0x00007ffff6985dbf libmergedlo.so`FileExists(INetURLObject const&) + 463
    frame #3: 0x00007ffff6980fbb libmergedlo.so`GalleryThemeEntry::ImplGetURLIgnoreCase(INetURLObject const&) + 91
    frame #4: 0x00007ffff6980697 libmergedlo.so`GalleryThemeEntry::GalleryThemeEntry(bool, INetURLObject const&, rtl::OUString const&, bool, bool, unsigned int, bool) + 567
    frame #5: 0x00007ffff69837c1 libmergedlo.so`Gallery::CreateTheme(rtl::OUString const&) + 337
    frame #6: 0x000000000020744f gengal.bin`GalApp::Main() + 2719
    frame #7: 0x00007ffff75a37f5 libmergedlo.so`ImplSVMain() + 101
    frame #8: 0x00000000002090da gengal.bin`main + 26
    frame #9: 0x00007ffff39decfe libc.so.6`__libc_start_main + 238
    frame #10: 0x00000000002059aa gengal.bin`_start + 42

As before, it is within [[libgcc3_uno.so`gcc3::deleteException(void*)]], but optimizations probably inlined the call to [[libgcc3_uno.so`std::type_info::name(this=0x0000000000000000) const]].

Here's upstream's fix <https://cgit.freedesktop.org/libreoffice/core/commit/?id=986bd28388df745dd969e7be7c3bda36b2b2cb0e>, which I've found is applied. Basically what it does is (I mean, I think this is exactly what it does):

#if defined _LIBCPPABI_VERSION
if ((*(void **)header == nullptr) header++;
#endif

But for whatever reason, it seems that this condition isn't triggered.

Reproducible: Always
Comment 1 Markus Peloquin 2020-10-01 05:22:02 UTC
Created attachment 663313 [details]
emerge --info
Comment 2 Markus Peloquin 2020-10-01 05:28:08 UTC
Created attachment 663316 [details]
build.log.xz
Comment 3 Perfect Gentleman 2020-10-27 04:09:08 UTC
Created attachment 668759 [details, diff]
libreoffice-clang.patch

Try that patch (libreoffice-clang.patch).
Comment 4 Perfect Gentleman 2020-10-27 04:10:51 UTC
(In reply to Perfect Gentleman from comment #3)
> Created attachment 668759 [details, diff] [details, diff]
> libreoffice-clang.patch
> 
> Try that patch (libreoffice-clang.patch).

It worked with Clang-11 and LO-7
Comment 5 Andreas K. Hüttel archtester gentoo-dev 2020-11-22 16:41:06 UTC
(In reply to Perfect Gentleman from comment #4)
> (In reply to Perfect Gentleman from comment #3)
> > Created attachment 668759 [details, diff] [details, diff] [details, diff]
> > libreoffice-clang.patch
> > 
> > Try that patch (libreoffice-clang.patch).
> 
> It worked with Clang-11 and LO-7

Please clarify:
* the patch is needed for clang-11 and lo-7, or
* the patch is not needed anymore for clang-11 and lo-7 ?
Comment 6 Perfect Gentleman 2020-11-26 01:34:06 UTC
(In reply to Andreas K. Hüttel from comment #5)
> (In reply to Perfect Gentleman from comment #4)
> > (In reply to Perfect Gentleman from comment #3)
> > > Created attachment 668759 [details, diff] [details, diff] [details, diff] [details, diff]
> > > libreoffice-clang.patch
> > > 
> > > Try that patch (libreoffice-clang.patch).
> > 
> > It worked with Clang-11 and LO-7
> 
> Please clarify:
> * the patch is needed for clang-11 and lo-7, or
> * the patch is not needed anymore for clang-11 and lo-7 ?

the patch is needed for clang-11 and lo-7
Comment 7 Denis Pronin 2020-11-26 10:57:23 UTC
Created attachment 675073 [details, diff]
clang-11/llvm-11 libreoffic patch

This patch works for me utilizing clang-11 + llvm-11 toolset
Comment 8 Markus Peloquin 2020-12-11 07:31:48 UTC
Created attachment 677806 [details, diff]
libreoffice-6.4.6.2-llvm-10-deleteException.patch

I noted before that the segmentation fault occurs in deleteException(). When reading through the implementation in 7.1 (no earlier), I found that it does take LLVM 10 into account:

https://github.com/LibreOffice/core/blob/libreoffice-7-1/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx#L114-L135

Introduced in:
https://github.com/LibreOffice/core/commit/cc5a6c6afeed1d2cf76d288133971d29ee8d893e

The patch 'libreoffice-6.4.6.2-llvm-10.patch' seems to have missed this change, which explains why it is insufficient, and why dannftk@yandex.ru had to use a hack:
https://gitweb.gentoo.org/repo/gentoo.git/tree/app-office/libreoffice/files/libreoffice-6.4.6.2-llvm-10.patch?id=947faddaa0c012fe78adaf3fb3d0d1f1fde2be4e

The GitHub commit above doesn't apply cleanly, but I modified it and libreoffice-6.4.6.2 and 6.4.7.2 build successfully.
Comment 9 Markus Peloquin 2020-12-11 20:32:24 UTC
Created attachment 678010 [details, diff]
libreoffice-7.0.3.1-llvm-10-deleteException.patch

Also, I've noticed that the ebuild for 7.0.3.1 is missing the LLVM 10 patches. 7.0.3.1 will need:
* libreoffice-6.4.6.2-llvm-10.patch (exists)
* This patch (updated from previous one to apply cleanly)
* The next patch for libc++ 11 changes.
Comment 10 Markus Peloquin 2020-12-11 20:32:28 UTC
Created attachment 678013 [details, diff]
libreoffice-7.0.3.1-libcxx11.patch

As mentioned above, this adds two missing headers. It builds fine now.
Comment 11 Joakim Tjernlund 2021-02-22 16:47:51 UTC
What about LO 7.0.4.2 ? Does it need anything from here ?
Comment 12 Joakim Tjernlund 2021-02-22 18:27:40 UTC
(In reply to Joakim Tjernlund from comment #11)
> What about LO 7.0.4.2 ? Does it need anything from here ?

I rebuilt LO 7.0.4.2 with libreoffice-6.4.6.2-llvm-10.patch and libreoffice-7.0.3.1-libcxx11.patch ( one didn't apply) and now I got a crash less when double clicking on an Draw img embedded into a word docx.


Is libreoffice-7.0.3.1-llvm-10-deux.patch not needed for 7.0.4.2 or did I just get lucky?
Comment 13 Perfect Gentleman 2021-02-23 06:03:48 UTC
LO-7.1.1.1 builds with Clang-11.1 without any patching.
Comment 14 David Carlos Manuelda 2021-02-24 14:21:18 UTC
(In reply to Perfect Gentleman from comment #13)
> LO-7.1.1.1 builds with Clang-11.1 without any patching.

I can confirm, built LO-7.1.1.1 with Clang-11.1.0 with default libc++ and what's better, executes without segfaulting without any patch except for the missing includes in patch libreoffice-7.0.3.1-libcxx11.patch (adapted for being applied to this version).

Maybe it is worth to just bump (and add the missing version for some dependencies like libixion and liborcus)?
Comment 15 Andreas Sturmlechner gentoo-dev 2021-05-05 00:50:53 UTC
If you still need those patches in 7.1.3.2 then please try to get them upstreamed.
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-08-16 01:56:56 UTC
(In reply to Andreas Sturmlechner from comment #15)
> If you still need those patches in 7.1.3.2 then please try to get them
> upstreamed.

Yep. I'll close this unless there's some progress or update here?