webosose / build-webos

webOS OSE build layer
670 stars 126 forks source link

Build issue with webOS OSE #26

Closed Aniketh01 closed 7 months ago

Aniketh01 commented 2 years ago

I get an error such as the following while building the webOS.

| collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
| compilation terminated.
| [27062/40470] CXX v8_snapshot_clang_arm/obj/v8/v8_libbase/region-allocator.o
| [27063/40470] CXX v8_snapshot_clang_arm/obj/v8/v8_libbase/platform-posix.o
| [27064/40470] CXX v8_snapshot_clang_arm/obj/v8/v8_libbase/random-number-generator.o
| [27065/40470] CXX v8_snapshot_clang_arm/obj/v8/v8_cppgc_shared/worklist.o
| [27066/40470] CXX v8_snapshot_clang_arm/obj/v8/v8_cppgc_shared/stack.o
| [27067/40470] LINK host/top_domain_generator
| [27068/40470] CXX v8_snapshot_clang_arm/obj/v8/torque_base/torque-parser.o
| [27069/40470] CXX v8_snapshot_clang_arm/obj/v8/torque_base/implementation-visitor.o
| ninja: build stopped: subcommand failed.
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/data/webos/build-webos/BUILD/work/raspberrypi4-webos-linux-gnueabi/webruntime/91.0.4472.114-11-r52.4/temp/run.do_compile.3665598' failed with exit code 1
ERROR: Task (/data/webos/build-webos/meta-webosose/meta-webos/recipes-webos/chromium/webruntime_91.bb:do_compile) failed with exit code '1'

Does anyone know the root cause of this?

shr-project commented 2 years ago

Check dmesg if cpp got killed by Out of memory killer.

heegoo-han commented 2 years ago

Set the parallelism values of mcf other than 0 like as for example, ./mcf -b 4 -p 4

Aniketh01 commented 2 years ago

I tried setting up parallelism and still ended up in the same error:

| [1875/12466] LINK host/character_data_generator
| FAILED: host/character_data_generator

ysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 -o "host/character_data_generator" -Wl,--start-group @"host/character_data_generator.rsp"  -Wl,--end-group  -latomic -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0
| collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
| compilation terminated.
| [1876/12466] LINK host/transport_security_state_generator
| FAILED: host/transport_security_state_generator
| python "../../git/src/build/toolchain/gcc_link_wrapper.py" --output="host/transport_security_state_generator" -- g++  -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed -fuse-ld=gold -Wl,--threads -Wl,--thread-count=4 -m64 -Wl,-O2 -Wl,--gc-sections -rdynamic --sysroot=../../../../../../../../../../ -L../../git/src/usr/lib/x86_64-linux-gnu/libfakeroot -L../../git/src/usr/local/lib -L../../git/src/usr/local/lib/x86_64-linux-gnu -L../../git/src/lib/x86_64-linux-gnu -L../../git/src/usr/lib/x86_64-linux-gnu -L../../git/src/lib32 -L../../git/src/usr/lib32 -L../../git/src/libx32 -L../../git/src/usr/libx32 -pie -Wl,--disable-new-dtags -L/data/webos/build-webos/BUILD/work/raspberrypi4-webos-linux-gnueabi/webruntime/91.0.4472.114-11-r52.4/recipe-sysroot-native/usr/lib -L/data/webos/build-webos/BUILD/work/raspberrypi4-webos-linux-gnueabi/webruntime/91.0.4472.114-11-r52.4/recipe-sysroot-native/usr/lib                         -L/data/webos/build-webos/BUILD/work/raspberrypi4-webos-linux-gnueabi/webruntime/91.0.4472.114-11-r52.4/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/data/webos/build-webos/BUILD/work/raspberrypi4-webos-linux-gnueabi/webruntime/91.0.4472.114-11-r52.4/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/data/webos/build-webos/BUILD/work/raspberrypi4-webos-linux-gnueabi/webruntime/91.0.4472.114-11-r52.4/recipe-sysroot-native/lib                         -Wl,-rpath,/data/webos/build-webos/BUILD/work/raspberrypi4-webos-linux-gnueabi/webruntime/91.0.4472.114-11-r52.4/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/data/webos/build-webos/BUILD/work/raspberrypi4-webos-linux-gnueabi/webruntime/91.0.4472.114-11-r52.4/recipe-sysroot-native/lib                         -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/data/webos/build-webos/BUILD/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 -o "host/transport_security_state_generator" -Wl,--start-group @"host/transport_security_state_generator.rsp"  -Wl,--end-group  -latomic -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lsmime3 -lnss3 -lsoftokn3 -lnssutil3 -lplds4 -lplc4 -lnspr4
| collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
| compilation terminated.
| [1878/12466] CXX obj/ui/web_dialogs/web_dialogs/web_dialog_web_contents_delegate.o
| [1879/12466] CXX obj/ui/views/views/menu_item_view.o
| [1880/12466] CXX obj/ui/web_dialogs/web_dialogs/web_dialog_ui.o
| [1877/12466] CXX obj/ui/web_dialogs/web_dialogs/web_dialog_delegate.o
| [1878/12466] CXX obj/ui/web_dialogs/web_dialogs/web_dialog_web_contents_delegate.o
| [1879/12466] CXX obj/ui/views/views/menu_item_view.o
| [1880/12466] CXX obj/ui/web_dialogs/web_dialogs/web_dialog_ui.o
| ninja: build stopped: subcommand failed.
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/data/webos/build-webos/BUILD/work/raspberrypi4-webos-linux-gnueabi/webruntime/91.0.4472.114-11-r52.4/temp/run.do_compile.659399' failed with exit code 1
ERROR: Task (/data/webos/build-webos/meta-webosose/meta-webos/recipes-webos/chromium/webruntime_91.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 10119 tasks of which 10110 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 1 seconds
NOTE: Build completion summary:
NOTE:   do_package_qa: 0.0% sstate reuse(0 setscene, 1 scratch)
NOTE:   do_package: 0.0% sstate reuse(0 setscene, 1 scratch)
NOTE:   do_packagedata: 0.0% sstate reuse(0 setscene, 1 scratch)
NOTE:   do_package_write_ipk: 0.0% sstate reuse(0 setscene, 1 scratch)

Summary: 1 task failed:
  /data/webos/build-webos/meta-webosose/meta-webos/recipes-webos/chromium/webruntime_91.bb:do_compile
Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

And this in dmesg:

[4147652.999933] ld.gold[667453]: segfault at ffffaa58c40e18fd ip 000055a73b0be9dd sp 00007f1ca1f98a90 error 5 in x86_64-linux-gnu-ld.gold[55a73b00c000+186000]
[4147652.999943] Code: 00 4c 89 f6 e8 34 39 fa ff 49 89 c2 4c 01 f3 48 2b 18 8b 40 1c 48 8b b5 20 fd ff ff 4c 8b 85 d8 fd ff ff 48 01 d8 49 03 42 10 <8b> 38 8b 5e 28 49 81 c0 f8 00 00 00 48 89 85 30 fd ff ff 4c 89 85
[4147964.128081] ld.gold[668551]: segfault at 8a ip 0000558543c9b556 sp 00007f60665e7dc0 error 4 in x86_64-linux-gnu-ld.gold[558543bbc000+186000]
[4147964.128089] Code: 00 00 00 00 48 83 ec 08 48 8b 47 70 48 85 c0 74 0c 80 38 00 74 3f 8b 50 04 85 d2 7f 25 48 8b 47 58 48 8b 40 28 48 85 c0 74 18 <80> 78 60 00 75 2a 48 83 78 68 00 75 15 80 b8 d0 00 00 00 00 74 1f
[4147964.250761] traps: ld.gold[668550] general protection fault ip:7fd02ef2573c sp:7ffd900c7ec0 error:0 in libc-2.31.so[7fd02eec0000+14b000]
heegoo-han commented 2 years ago

hmm, then check ld.gold is fine:

heegoo@4571600ef55c:~/build-webos$ ld.gold --version
GNU gold (GNU Binutils for Ubuntu 2.34) 1.16
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

If something wrong try the following:

sudo apt purge binutils
sudo apt remove make
sudo apt autoremove
sudo apt install build-essential
heegoo@4571600ef55c:~/build-webos$ sudo ./scripts/prerequisites.sh -f
heegoo@4571600ef55c:~/build-webos$ make webruntime
shr-project commented 2 years ago

@heegoo-han it's not using ld.gold from host, but the one from binutils-cross-aarch64

@Aniketh01 are you using 18.04 ubuntu? with newer ubuntu I was seeing similar segfaults and easiest work around was to use bfd instead of gold

Aniketh01 commented 2 years ago

I'm using Debian 11. Since Ubuntu is a Debian flavour I thought it will work. @shr-project Can you please let me know how can I change from gold to bfd?

shr-project commented 2 years ago

meta-webos/recipes-webos/chromium/webruntime-common.inc change EXTRA_OEGN_GOLD ot use_gold=false.

But it's possible that with BFD you will get different errors like:

ld: cannot find obj/extensions/common/api/libgenerated_api_json_strings.a: Too many open files

with older binutils-cross.

And I've just noticed that version 91 has:

meta-webos/recipes-webos/chromium/webruntime_91.bb:GN_ARGS:remove = "linux_use_bundled_binutils=false"

so it's possible that it builds own version of ld.gold again and that would be even bigger mess than with 87. I'll check what happen with linux_use_bundled_binutils and why they remove it now.

Aniketh01 commented 2 years ago

Thanks for taking a look @shr-project. Meanwhile, you are at it, is there a version that I could checkout and test to see if it works?

heegoo-han commented 2 years ago

@shr-project great.

shr-project commented 2 years ago

is there a version that I could checkout and test to see if it works?

The easiest option might be to just build in 18.04 docker container which will give you the identical build environment as what LGE is using.

Aniketh01 commented 2 years ago

@shr-project thanks! I will try that as well.

Btw, I see build recipe for webruntime_87. Is there a way I could downgrade from webruntime_91 to webruntime_87?

shr-project commented 2 years ago

@Aniketh01 you can revert this change: https://github.com/webosose/meta-webosose/commit/3da4870ed0f252a45e66331f0466263da1468670 to build 87 version again, but it can still fail as nobody tested 87 version after the switch of the default one to 91.

shr-project commented 2 years ago

third_party/binutils with linux_use_bundled_binutils option was removed from chromium in 2020: https://chromium-review.googlesource.com/c/chromium/src/+/2184772

I'll make sure it gets removed correctly from webruntime recipes.

Aniketh01 commented 2 years ago

Thanks for the suggestion @shr-project. I managed to build the webOS OSE successfully in a container. However, I flashed the image and was setting up the WIFI credentials. Once I completed that and tried to return to the Home Screen/landing screen - none of the app options pop up anymore. All I see is the wallpaper and that's it.

Additionally, once I open an how can I return back to the Home Screen?

Note: I did not revert to 87. My build is based on 91 itself.

Aniketh01 commented 2 years ago

Additionally, is there a way that I can download and install webOS apps into the system? (like a store app?)

ebresie commented 2 years ago

I have limited experience on the build side but I did notice in one of the other webosose repositories there is an app installer. See https://github.com/webosose/appinstalld2

Also not sure if this is what you are looking for but LG has an App Store; LG is mostly TV Apps but maybe...

Aniketh01 commented 2 years ago

@ebresie Can the LG App Store be installed/side-loaded into the webOS OSE in RPI somehow?

And do you mean LG TV apps will not run in webOS OSE?

ebresie commented 2 years ago

I don't know. All I know is LG TV apps are based on webOS so assumed it may be able to be loaded. Beyond that I'm probably not going to be much help.