Closed niutech closed 2 years ago
You can get a stack trace by running Ladybird in a debugger. The debug
Ninja target automatically launches Ladybird in gdb
.
strace
might also be useful for tracking down why the memfd_create
syscall used for creating AnonymousBuffer
failed if that's the issue. There is no target for that, you need to set the SERENITY_SOURCE_DIR
environment variable yourself and run strace Build/ladybird
.
Thank you! I got the stack trace from gdb
:
#0 __GI___assert_fail (assertion=0x7ffffbc098ba "has<T>()", file=0x7ffffbc098c3 "/mnt/c/Users/xxx/Workspace/ladybird/Build/serenity/AK/Variant.h", line=366,
function=0x7ffffbc0d5d3 "T &AK::Variant<Core::AnonymousBuffer, AK::Error>::get() [Ts = <Core::AnonymousBuffer, AK::Error>, T = Core::AnonymousBuffer]") at assert.c:100
#1 0x00007ffffbbf05d7 in AK::Variant<Core::AnonymousBuffer, AK::Error>::get<Core::AnonymousBuffer> (this=0x7ffffffed310) at serenity/AK/Variant.h:366
#2 AK::ErrorOr<Core::AnonymousBuffer, AK::Error>::value (this=0x7ffffffed310) at serenity/AK/Error.h:96
#3 AK::ErrorOr<Core::AnonymousBuffer, AK::Error>::release_value (this=0x7ffffffed310) at serenity/AK/Error.h:104
#4 Gfx::load_system_theme (file=...) at serenity/Userland/Libraries/LibGfx/SystemTheme.cpp:36
#5 0x00007ffffbbf22bf in Gfx::load_system_theme (path=...) at serenity/Userland/Libraries/LibGfx/SystemTheme.cpp:153
#6 0x0000000008020efa in WebView::WebView (this=0x84ecba0) at /mnt/c/Users/xxx/Workspace/ladybird/WebView.cpp:353
#7 0x0000000008028e23 in Tab::Tab (this=0x84fa820, window=<optimized out>) at /mnt/c/Users/xxx/Workspace/ladybird/Tab.cpp:25
#8 0x0000000008014246 in AK::make<Tab, BrowserWindow*> (args=<optimized out>) at serenity/AK/NonnullOwnPtr.h:161
#9 BrowserWindow::new_tab (this=this@entry=0x7ffffffed6f0) at /mnt/c/Users/xxx/Workspace/ladybird/BrowserWindow.cpp:200
#10 0x0000000008014201 in BrowserWindow::BrowserWindow (this=0x7ffffffed6f0, event_loop=...) at /mnt/c/Users/xxx/Workspace/ladybird/BrowserWindow.cpp:186
#11 0x00000000080206db in serenity_main (arguments=...) at /mnt/c/Users/xxx/Workspace/ladybird/main.cpp:35
#12 0x00007ffffd5d1176 in main (argc=argc@entry=1, argv=argv@entry=0x7ffffffeddf8) at serenity/Userland/Libraries/LibMain/Main.cpp:39
#13 0x00007ffff7781c87 in __libc_start_main (main=0x7ffffd5d1090 <main(int, char**)>, argc=1, argv=0x7ffffffeddf8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffffffedde8)
at ../csu/libc-start.c:310
#14 0x0000000008010b5a in _start ()
What could be the root cause?
So it apparently failed to load a file as we're in Gfx::load_system_theme
. What does strace
say?
Here are the last lines of strace
:
openat(AT_FDCWD, "/mnt/c/Users/xxx/Workspace/ladybird/Build/serenity/Base/res/themes/Default.ini", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 11
read(11, "[Colors]\nDesktopBackground=#5050"..., 16384) = 2364
read(11, "", 16384) = 0
memfd_create("", MFD_CLOEXEC) = -1 ENOSYS (Function not implemented)
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 14
fstat(14, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
read(14, "# Locale name alias data base.\n#"..., 4096) = 2995
read(14, "", 4096) = 0
close(14) = 0
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "ladybird: /mnt/c/Users/xxx/Wor"..., 236ladybird: /mnt/c/Users/xxx/Workspace/ladybird/Build/serenity/AK/Variant.h:366: T &AK::Variant<Core::AnonymousBuffer, AK::Error>::get() [Ts = <Core::AnonymousBuffer, AK::Error>, T = Core::AnonymousBuffer]: Assertion `has<T>()' failed.
) = 236
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f258f2c0000
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
getpid() = 2818
gettid() = 2818
tgkill(2818, 2818, SIGABRT) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=2818, si_uid=1000} ---
+++ killed by SIGABRT (core dumped) +++
memfd_create("", MFD_CLOEXEC) = -1 ENOSYS (Function not implemented)
It looks like your kernel does not support memfd_create
which is needed for loading the system theme. What kernel version and distro is this?
This is Ubuntu 18.04.6 LTS: Linux 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux
. This is a WSL issue 3542.
note the "fixed-in-wsl2" label on the issue. Try upgrading to a newer distro/kernel.
Sorry, now I found out using wsl -l -v
that in fact I was using WSL1 not 2. Now I converted it to WSL2 using wsl --set-version [name] 2
.
EDIT: Success! Now Ladybird runs well:
I try to build Ladybird in WSL2, but I get an error:
Which function does invoke
AK::Variant<Core::AnonymousBuffer, AK::Error>::get()
? How can I show the stack trace?I am using cmake 3.23.2 and ninja 1.8.2.