Bug 128671 - master branch cannot be built without manual hacks with Aarch64 distro config
Summary: master branch cannot be built without manual hacks with Aarch64 distro config
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.5.0
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-08 11:45 UTC by ilnur
Modified: 2023-05-21 13:52 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ilnur 2019-11-08 11:45:34 UTC
Description:
Hello,

I've already mentioned this problem in mailing list: https://lists.freedesktop.org/archives/libreoffice/2019-September/083539.html

I've just checked it out again with latest commit in master branch and the problem still exists.

The problem is that you can't just clone and build libreoffice for android with Aarch64 distro config.

Because there are some errors that should be fixed manually. Errors are described in the mail.


But I want to add some more errors that happening now:

Linking obj/local/arm64-v8a/liblo-native-code.so
/home/me/Android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: unrecognized option '--no-keep-files-mapped'

Earlier I would fix this by replacing ld with ld.gold because --no-keep-files-mapped it's the option for the ld.gold, not ld.

But today I got another error: /usr/bin/ld: error: cannot find -landroid_support.


Please, try to build it for android aarch64 and fix happening errors.


Actual Results:
master branch is not building out of the box

Expected Results:
master branch is building out of the box


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Comment 1 Xisco Faulí 2019-11-25 15:08:07 UTC
@Cloph, could you please take a look at this issue ?
Comment 2 Uriy 2019-12-03 14:31:15 UTC
I have the same problem. @Cloph, Do you have any solution, please?
Comment 3 Evgeny 2019-12-04 12:42:59 UTC
I affects me too! Very annoying!
Comment 4 Marina 2019-12-04 14:38:13 UTC
I faced the same problem, really looking forward to fix..
Comment 5 Semjon 2019-12-04 14:41:39 UTC
Guys, fix it, please. I really stuck up with that bug.
Comment 6 test 2019-12-04 14:47:52 UTC
AAAAAAAAAaaaaaaaaaaaaaaaaaaaaaaaaaaa !!!!!!!!!!!!!!!!!!!!
Comment 7 Igor 2019-12-04 14:50:02 UTC
I saw this bug!
It looks very bad, please help, fix it!
Comment 8 Sergey 2019-12-04 14:52:55 UTC
Can u fix it, please?
Comment 9 Nastya 2019-12-04 14:55:16 UTC
Please fix the bug!
Comment 10 Evgeni U. 2019-12-04 16:30:04 UTC
I have the same problem, too. Could you fix this bug, please!
Comment 11 avismortes@yandex.ru 2019-12-05 06:32:10 UTC
The bug repeats itself. Please fix it!!
Comment 12 Nadin 2019-12-05 06:35:08 UTC
the error is repeated!  how can!  repair already, it is impossible to work!
Comment 13 Maksim 2019-12-05 06:38:53 UTC
Oh< this bug...please, fix it!
Comment 14 winyn 2019-12-05 06:43:06 UTC
I also have this bug. impossible to work.
Comment 15 john 2019-12-05 06:45:03 UTC
please help, fix this bug!
Comment 16 Mark 2019-12-10 04:34:29 UTC
Please fix this bug!
Comment 17 Xisco Faulí 2019-12-12 12:22:04 UTC
@Michael, I see you have been doing some work in Android lately. Any idea about this issue ?
Comment 18 Michael Weghorn 2019-12-12 13:29:00 UTC
Hi ilnur,

this should have been fixed by the following commit that went into master on December 2:

https://gerrit.libreoffice.org/#/c/81915/

Can you please retest with current master?

@All: Side note: Please refrain from posting "please fix this" comments on bug reports, IMHO that generally makes a fix rather more unlikely, because the bug becomes lengthier without any additional helpful information, and developers tend to dislike reading long bug reports without getting more information...
Comment 19 ilnur 2019-12-13 13:47:24 UTC
Hi, @Michael Weghorn 

Thank you for your participation in this ticket.

To make experiment clearer, I have just cloned the master branch and tried to compile it again. Commit Id: Iac305e9ec0020a11fd53b4bb87cc782686a247ac

Some errors have gone away, but unfortunately the repo still needs some manual edits.
Build log with error: https://gist.github.com/lexboss93/4dab21d6bad6a315118cd7060d529ae6

System: Debian GNU/Linux 9 (stretch) 64-bit

autogen.input:
--with-distro=LibreOfficeAndroidAarch64
--with-android-sdk=/home/user/Android/Sdk
--with-android-ndk=/home/user/Android/android-ndk-r20b
--with-jdk-home=/usr/lib/jvm/java-8-openjdk-amd64

As earlier, I can copy share.hxx file from gcc3_linux_x86-64 directory and include it in
two files (uno2cpp.cxx and abi.cxx) #include "share.hxx", but I'm not sure if it a correct way to fix it. Moreover, I've already tried it before (at another commit id) and libreoffice was crashing https://bugs.documentfoundation.org/show_bug.cgi?id=127781
Not sure if it's related to my manual edit.
Comment 20 ilnur 2019-12-16 06:25:35 UTC
Yes, it crashes likewise:

12-16 09:18:25.380  9620  9620 W LibreOfficeMainActivity: onCreate..
12-16 09:18:25.874  9620  9620 D LibreOfficeMainActivity: SCHEME_FILE: getPath(): /storage/emulated/0/Documents/untitled.odt
12-16 09:18:25.913  9620  9620 I LibreOfficeMainActivity: onStart..
12-16 09:18:25.914  9620  9620 I LibreOfficeMainActivity: onResume..
12-16 09:18:25.930  9620  9652 I LibreOfficeKit: Initializing LibreOfficeKit, dataDir=/data/user/0/org.example.libreoffice
12-16 09:18:25.932  9620  9652 I LibreOfficeKit: Setting FONTCONFIG_FILE to /data/user/0/org.example.libreoffice/etc/fonts/fonts.conf
12-16 09:18:25.932  9620  9652 I LibreOfficeKit: LibreOfficeKit: libreofficekit_initialize finished
12-16 09:18:26.094  9620  9656 I LibreOffice: New sal thread started and attached res=0
12-16 09:18:26.094  9620  9656 I LibreOffice/androidinst: Android: CreateSalInstance!
12-16 09:18:26.094  9620  9656 I LibreOffice/androidinst: AttachCurrentThread res=0 env=0x7881eee660
12-16 09:18:26.215  2879  2978 I ActivityManager: Displayed org.example.libreoffice/org.libreoffice.LibreOfficeMainActivity: +856ms
12-16 09:18:26.242  9620  9652 I LibreOfficeKit: LibreOfficeKit successfully initialized
12-16 09:18:26.394  9620  9658 I LibreOffice: New sal thread started and attached res=0
12-16 09:18:26.395  9620  9659 I LibreOffice: New sal thread started and attached res=0
12-16 09:18:26.395  9620  9658 I LibreOffice: Detached finished sal thread res=0
12-16 09:18:26.397  9620  9659 I LibreOffice: Detached finished sal thread res=0
12-16 09:18:26.403  9620  9660 I LibreOffice: New sal thread started and attached res=0
12-16 09:18:26.404  9620  9660 I LibreOffice: Detached finished sal thread res=0
12-16 09:18:26.405  9620  9661 I LibreOffice: New sal thread started and attached res=0
12-16 09:18:26.407  9620  9661 I LibreOffice: Detached finished sal thread res=0
12-16 09:18:26.445  9620  9652 I LibreOffice/androidinst: 
12-16 09:18:26.445  9620  9652 I LibreOffice/androidinst: SalAbort: 'Unknown application error'
12-16 09:18:26.488  2879  6134 I WindowManager: WIN DEATH: Window{b4406ab u0 org.example.libreoffice/org.libreoffice.LibreOfficeMainActivity}
12-16 09:18:26.489  2879  4283 W ActivityManager: Force removing ActivityRecord{5e2bd69 u0 org.example.libreoffice/org.libreoffice.LibreOfficeMainActivity t5}: app died, no saved state
12-16 09:18:26.490  2879  3392 W InputDispatcher: channel '3d991d8 org.example.libreoffice/org.libreoffice.ui.LibreOfficeUIActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
12-16 09:18:26.490  2879  3392 E InputDispatcher: channel '3d991d8 org.example.libreoffice/org.libreoffice.ui.LibreOfficeUIActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
12-16 09:18:26.492  2879  8796 I WindowManager: WIN DEATH: Window{3d991d8 u0 org.example.libreoffice/org.libreoffice.ui.LibreOfficeUIActivity}
12-16 09:18:26.492  2879  8796 W InputDispatcher: Attempted to unregister already unregistered input channel '3d991d8 org.example.libreoffice/org.libreoffice.ui.LibreOfficeUIActivity (server)'
12-16 09:18:26.496  2879  4283 W ActivityManager: Force removing ActivityRecord{6422053 u0 org.example.libreoffice/org.libreoffice.ui.LibreOfficeUIActivity t5}: app died, no saved state
Comment 21 Michael Weghorn 2019-12-17 19:05:35 UTC
I quickly tried and can reproduce the failures as shown in the log linked in comment 19 with aarch64, like

> [CXX] bridges/source/cpp_uno/shared/bridge.cxx
> /home/user/Projects/libreoffice_aarch64/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx:117:40: error: no type named '__class_type_info' in namespace '__cxxabiv1'

@Stephan: Do you possibly have an idea?
Comment 22 Stephan Bergmann 2019-12-17 20:16:51 UTC
(In reply to Michael Weghorn from comment #21)
> I quickly tried and can reproduce the failures as shown in the log linked in
> comment 19 with aarch64, like
> 
> > [CXX] bridges/source/cpp_uno/shared/bridge.cxx
> > /home/user/Projects/libreoffice_aarch64/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx:117:40: error: no type named '__class_type_info' in namespace '__cxxabiv1'

That's what <https://gerrit.libreoffice.org/#/c/81913/> "android: Fix the 'bridges' build on aarch64" should address.

Regarding crashes mentioned in some of the comments, there is <https://gerrit.libreoffice.org/#/c/84204/> "android: Avoid throwing exceptions through the bridges", but which is going in the wrong direction, installing silly workarounds instead of fixing whatever root cause.
Comment 23 Stephan Bergmann 2019-12-17 22:47:48 UTC
(In reply to Stephan Bergmann from comment #22)
> That's what <https://gerrit.libreoffice.org/#/c/81913/> "android: Fix the
> 'bridges' build on aarch64" should address.

Please check whether <https://gerrit.libreoffice.org/#/c/85344/> "tdf#128671: Rely on unwind.h, declare what's missing from cxxabi.h" fixes those problems (and ideally report your results directly in that Gerrit change).  (I only checked that change with a Linux aaarch64 build, not with an Adnroid aarch64 one.)
Comment 24 Commit Notification 2019-12-18 14:09:24 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/189d498f5c0c633f8cd87b3f1b6d57020371a952

tdf#128671: Rely on unwind.h, declare what's missing from cxxabi.h

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 25 Stephan Bergmann 2019-12-18 14:20:42 UTC
(In reply to Commit Notification from comment #24)
> Stephan Bergmann committed a patch related to this issue.
> It has been pushed to "master":
> 
> https://git.libreoffice.org/core/commit/
> 189d498f5c0c633f8cd87b3f1b6d57020371a952
> 
> tdf#128671: Rely on unwind.h, declare what's missing from cxxabi.h

Building should work now.  Regarding one source of crashes during exception handling, see my today's comment at <https://gerrit.libreoffice.org/#/c/84204/2> "android: Avoid throwing exceptions through the bridges" for how this commit might fix those too.

Feedback welcome (leaving this bug as ASSIGNED for now).
Comment 26 ilnur 2019-12-19 06:35:46 UTC
@Stephan Bergmann, thank you for contribution.

Indeed, building is now working.

But the crash still persists, though. It happens when I try to open a sample doc (e.g. untitled.odt).
https://gist.github.com/lexboss93/3d5c685ecb868621a2b337d8a7e3faa4
Comment 27 Stephan Bergmann 2019-12-19 13:10:39 UTC
(In reply to ilnur from comment #26)
> But the crash still persists, though. It happens when I try to open a sample
> doc (e.g. untitled.odt).
> https://gist.github.com/lexboss93/3d5c685ecb868621a2b337d8a7e3faa4

Looks different than comment 20, but I myself have no idea what's going wrong there and can't debug it.  Guess it's OK to keep this bug open to track that crash; detaching myself again.
Comment 28 Michael Weghorn 2019-12-19 16:07:03 UTC
Is there any good way to reproduce/test this without an actual arm64 device?
I just tried using an arm64 AVD on x86_64 hardware (running Debian testing), but that's so slow that 10 minutes were not even enough for the Android system boot...
Comment 29 ilnur 2019-12-19 16:40:24 UTC
(In reply to Stephan Bergmann from comment #27)
> Looks different than comment 20, ...
It's my fault that in comment #20 I grepped logcat with "libre", in comment #26 I grepped it the right way using the process id.
I think most important lines are 81-84 in gist from comment#26.
Comment 30 ilnur 2019-12-19 16:48:42 UTC
(In reply to Michael Weghorn from comment #28)
> Is there any good way to reproduce/test this without an actual arm64 device?
> I just tried using an arm64 AVD on x86_64 hardware (running Debian testing),
> but that's so slow that 10 minutes were not even enough for the Android
> system boot...

Maybe BlueStacks might fit? I didn't use it myself for emulation purposes, but on the wiki it says:
>This 64-bit release allows the installation and usage of ARM64-v8a android applications.

and quick googling showed that it's possible to connect it via adb:
>https://www.youtube.com/watch?v=7LH7UbP-yEM
Comment 31 Michael Weghorn 2019-12-19 17:46:52 UTC
(In reply to ilnur from comment #30)
> Maybe BlueStacks might fit? I didn't use it myself for emulation purposes,
> but on the wiki it says:
> >This 64-bit release allows the installation and usage of ARM64-v8a android applications.
> 
> and quick googling showed that it's possible to connect it via adb:
> >https://www.youtube.com/watch?v=7LH7UbP-yEM

I only watched the first few seconds, but it says there "it's compatible with Windows and Mac"; and it looks like some proprietary tool at a quick glance; I'm out...
Comment 32 Michael Weghorn 2020-02-12 08:44:11 UTC
https://gerrit.libreoffice.org/plugins/gitiles/core/+diff/a7d1fed24557b203acb5016a98af26f4ef24d27a%5E%21 ("Hack to dynamically adapt to __cxa_exceptiom in LLVM 5.0 libcxxabi") sounds like it might be related, but I don't have a device to test.
Comment 33 Stephan Bergmann 2020-02-12 09:19:29 UTC
(In reply to Michael Weghorn from comment #32)
> https://gerrit.libreoffice.org/plugins/gitiles/core/+diff/
> a7d1fed24557b203acb5016a98af26f4ef24d27a%5E%21 ("Hack to dynamically adapt
> to __cxa_exceptiom in LLVM 5.0 libcxxabi") sounds like it might be related,
> but I don't have a device to test.

Yes, would be interesting to learn whether that helps for Android builds that do not have the <https://gerrit.libreoffice.org/#/c/84204/> "android: Avoid throwing exceptions through the bridges" et al changes (see comment 22).
Comment 34 ilnur 2020-02-12 10:27:42 UTC
Hello, I've just tried to build a master branch on a latest available commit (be10debe0ec7873bdc56977d0b9934c6eb165b9e Wed Feb 12 11:00:15 2020 +0100). Unfortunately it fails with the following error:
....
>[CXX] bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx
>[CXX] bridges/source/cpp_uno/shared/bridge.cxx
>/home/user/Projects/libreoffice_aarch64/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx:156:35: error: unknown type name '__cxa_exception'; did you mean '__cxxabiv1::__cxa_exception'?
>        header = reinterpret_cast<__cxa_exception const *>(
>                                  ^~~~~~~~~~~~~~~
>                                  __cxxabiv1::__cxa_exception
>/home/user/Projects/libreoffice_aarch64/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.hxx:71:8: note: '__cxxabiv1::__cxa_exception' declared here
>struct __cxa_exception {
>       ^
>/home/user/Projects/libreoffice_aarch64/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx:156:18: error: assigning to '__cxxabiv1::__cxa_exception *' from incompatible type 'const >__cxxabiv1::__cxa_exception *'
>        header = reinterpret_cast<__cxa_exception const *>(
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>2 errors generated.
>make[1]: *** [/home/user/Projects/libreoffice_aarch64/solenv/gbuild/LinkTarget.mk:298: /home/user/Projects/libreoffice_aarch64/workdir/CxxObject/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.o] Error >1
>make[1]: *** Waiting for unfinished jobs....
>make: *** [Makefile:282: build] Error 2

Earlier it was building with no error and I didn't changed anything on my computer.
Comment 35 Stephan Bergmann 2020-02-12 11:50:52 UTC
(In reply to ilnur from comment #34)
> Hello, I've just tried to build a master branch on a latest available commit
> (be10debe0ec7873bdc56977d0b9934c6eb165b9e Wed Feb 12 11:00:15 2020 +0100).
> Unfortunately it fails with the following error:
> ....
> >/home/user/Projects/libreoffice_aarch64/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx:156:35: error: unknown type name '__cxa_exception'; did you mean '__cxxabiv1::__cxa_exception'?

He, sorry, that happens when you let Kendy convince you to submit and effectively untested change.  :)

ilnur, can you please check whether <https://gerrit.libreoffice.org/c/core/+/88519> "Blind fix for Linux aarch64 with libcxxabi [NEW]" fixes that for you (and ideally leave a reply there in Gerrit)?
Comment 36 ilnur 2020-02-18 10:17:12 UTC
Thank you. Now master branch can be built without manual hacks with Aarch64 distro config. Though the document viewer still crashes https://bugs.documentfoundation.org/show_bug.cgi?id=127781
Comment 37 saffron exchange 2023-03-06 05:59:30 UTC Comment hidden (spam)
Comment 38 betbhai9 2023-05-21 13:15:06 UTC Comment hidden (spam)
Comment 39 betbhai9 2023-05-21 13:17:00 UTC Comment hidden (obsolete, spam)