serenity
serenity copied to clipboard
ladybird on NetBSD
I tried packaging ladybird for pkgsrc and tried following the Custom CMake build directory instructions from https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructionsLadybird.md but fail quite soon (directly after configure) when various Python scripts are called and want to create files in directories that do not exist (yet?).
I though that perhaps it's caused by me building highly parallel, but even with a single job it fails with:
[ 0%] Generating CSS/DefaultStyleSheetSource.cpp
Traceback (most recent call last):
File "/scratch/wip/ladybird-git/work/serenity/Meta/embed_as_string_view.py", line 38, in <module>
sys.exit(main())
^^^^^^
File "/scratch/wip/ladybird-git/work/serenity/Meta/embed_as_string_view.py", line 23, in main
with open(args.output, 'w') as f:
^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'CSS/DefaultStyleSheetSource.cpp.tmp'
*** [Lagom/Userland/Libraries/LibWeb/CSS/DefaultStyleSheetSource.cpp] Error code 1
with more jobs in parallel, here are some more of the problems:
Traceback (most recent call last):
File "/scratch/wip/ladybird-git/work/serenity/Meta/embed_as_string_view.py", line 38, in <module>
sys.exit(main())
^^^^^^
File "/scratch/wip/ladybird-git/work/serenity/Meta/embed_as_string_view.py", line 23, in main
with open(args.output, 'w') as f:
^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'MathML/MathMLStyleSheetSource.cpp.tmp'
Traceback (most recent call last):
File "/scratch/wip/ladybird-git/work/serenity/Meta/embed_as_string_view.py", line 38, in <module>
sys.exit(main())
^^^^^^
File "/scratch/wip/ladybird-git/work/serenity/Meta/embed_as_string_view.py", line 23, in main
with open(args.output, 'w') as f:
^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'SVG/SVGStyleSheetSource.cpp.tmp'
Traceback (most recent call last):
File "/scratch/wip/ladybird-git/work/serenity/Meta/embed_as_string_view.py", line 38, in <module>
sys.exit(main())
^^^^^^
File "/scratch/wip/ladybird-git/work/serenity/Meta/embed_as_string_view.py", line 23, in main
with open(args.output, 'w') as f:
^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'CSS/QuirksModeStyleSheetSource.cpp.tmp'
Traceback (most recent call last):
File "/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/TIFFGenerator.py", line 637, in <module>
main()
File "/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/TIFFGenerator.py", line 632, in main
update_file(output_path / 'TIFFMetadata.h', generate_metadata_file(known_tags))
File "/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/TIFFGenerator.py", line 621, in update_file
with target.open('w') as file:
^^^^^^^^^^^^^^^^
File "/usr/pkg/lib/python3.11/pathlib.py", line 1044, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/scratch/wip/ladybird-git/work/serenity/cmake-pkgsrc-build/Lagom/Userland/Libraries/LibGfx/ImageFormats/TIFFMetadata.h'
For the last example, which has a complete path, I see that the path up to LibGfx exists, but not the ImageFormats subdirectory:
# ls work/serenity/cmake-pkgsrc-build/Lagom/Userland/Libraries/LibGfx/
CMakeFiles Makefile cmake_install.cmake
Please advise, thank you!
The build with the default Unix Makefiles generator has been broken for a while, I think. Can you try using the ninja generator?
cmake <.... arguments> -GNinja
Thanks for the comment. I've tried that too, but see an endless loop of these messages:
===> Building for ladybird-0.0.0nb20240227
[0/2] Re-checking globbed directories...
[1/2] Re-running CMake...
-- Configuring done (0.9s)
-- Generating done (0.3s)
-- Build files have been written to: /scratch/wip/ladybird-git/work/serenity/cmake-pkgsrc-build
[0/2] Re-checking globbed directories...
[1/2] Re-running CMake...
-- Configuring done (0.9s)
-- Generating done (0.3s)
-- Build files have been written to: /scratch/wip/ladybird-git/work/serenity/cmake-pkgsrc-build
The combination of cmake + ninja in pkgsrc usually works fine, but I had to disable it for two other projects too. I suspect a timestamp problem, but I have no clue how to debug this.
Update: It's not endless, it's just very long, and then it fails with:
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/Environment.cpp: In function 'AK::Optional<AK::StringView> Core::Environment::get(AK::StringView, SecureOnly)':
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/Environment.cpp:101:20: error: '::secure_getenv' has not been declared
101 | result = ::secure_getenv(builder.string_view().characters_without_null_termination());
| ^~~~~~~~~~~~~
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/Environment.cpp: In function 'AK::ErrorOr<void> Core::Environment::clear()':
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/Environment.cpp:162:17: error: '::clearenv' has not been declared; did you mean 'clearerr'?
162 | auto rc = ::clearenv();
| ^~~~~~~~
| clearerr
so that's progress :)
We just recently (like, literally yesterday) added the calls to secure_getenv in that file. What OS is this? Does it have that function? Or are we just missing an include
I'm compiling on NetBSD.
As I understand it, both functions are glibc extensions and should be hidden by ifdef(__linux__).
I use this for now:
--- Userland/Libraries/LibCore/Environment.cpp.orig 2024-02-27 18:09:19.633132086 +0000
+++ Userland/Libraries/LibCore/Environment.cpp
@@ -93,7 +93,7 @@ Optional<StringView> get(StringView name
builder.append('\0');
// Note the explicit null terminators above.
-#if defined(AK_OS_MACOS)
+#if defined(AK_OS_MACOS) || defined(__NetBSD__)
char* result = ::getenv(builder.string_view().characters_without_null_termination());
#else
char* result;
@@ -153,7 +153,7 @@ ErrorOr<void> put(StringView env)
ErrorOr<void> clear()
{
-#if defined(AK_OS_MACOS)
+#if defined(AK_OS_MACOS) || defined(__NetBSD__)
auto environment = raw_environ();
for (size_t environ_size = 0; environment[environ_size]; ++environ_size) {
environment[environ_size] = NULL;
I'm at
[50/2402] Generating Userland/Services/RequestServer/RequestClientEndpoint.h
FAILED: Lagom/Userland/Services/RequestServer/RequestClientEndpoint.h /scratch/wip/ladybird-git/work/serenity/cmake-pkgsrc-build/Lagom/Userland/Services/RequestServer/RequestClientEndpoint.h
cd /scratch/wip/ladybird-git/work/serenity/cmake-pkgsrc-build/Lagom && /scratch/wip/ladybird-git/work/serenity/cmake-pkgsrc-build/bin/IPCCompiler /scratch/wip/ladybird-git/work/serenity/Userland/Services/RequestServer/RequestClient.ipc -o Userland/Services/RequestServer/RequestClientEndpoint.h.tmp && /usr/pkg/bin/cmake -E copy_if_different Userland/Services/RequestServer/RequestClientEndpoint.h.tmp Userland/Services/RequestServer/RequestClientEndpoint.h && /usr/pkg/bin/cmake -E remove Userland/Services/RequestServer/RequestClientEndpoint.h.tmp
/scratch/wip/ladybird-git/work/serenity/cmake-pkgsrc-build/bin/IPCCompiler: Shared object "liblagom-filesystem.so.0" not found
which I've worked around with setting LD_LIBRARY_PATH to include cmake-pkgsrc-build/lib, which leads to
In file included from /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.cpp:12:
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.h:26:2: in 'constexpr' expansion of '<lambda closure object>Gfx::Detail::<lambda()>().Gfx::Detail::<lambda()>()'
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.h:24:40: error: call to non-'constexpr' function 'unsigned int popcount(unsigned int)'
24 | coverage_lut[sample] = popcount(sample);
| ~~~~~~~~^~~~~~~~
In file included from /usr/include/string.h:98,
from /scratch/wip/ladybird-git/work/serenity/AK/Memory.h:15,
from /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/Painter.h:10,
from /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/AntiAliasingPainter.h:9,
from /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.cpp:11:
/usr/include/strings.h:57:17: note: 'unsigned int popcount(unsigned int)' declared here
57 | unsigned int popcount(unsigned int) __constfunc;
| ^~~~~~~~
which I only know how to fix this way:
--- Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.h.orig 2024-02-27 18:16:47.107269492 +0000
+++ Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.h
@@ -18,7 +18,7 @@ namespace Gfx {
namespace Detail {
-static auto constexpr coverage_lut = [] {
+static auto coverage_lut = [] {
Array<u8, 256> coverage_lut {};
for (u32 sample = 0; sample <= 255; sample++)
coverage_lut[sample] = popcount(sample);
compilation on-going.
so we don't have many people compiling for NetBSD, so this is kinda expected. FreeBSD is going ok it seems, as they have a port in their tree.
fwiw FreeBSD 14 seems to have secure_getenv https://man.freebsd.org/cgi/man.cgi?getenv(3)
we have macros like AK_OS_NETBSD already, from AK/Platform.h
Regarding executing binaries from the build, that's supposed to work via RPATH. if pkgsrc hates RPATH, then it's expected you'd need LD_LIBRARY_PATH. that's https://github.com/SerenityOS/serenity/issues/22335
That popcount thing looks super bogus. On my linux box that's calling ::AK::popcount from AK/BuiltinWrappers.h, which we using into the global namespace. it shouldn't be calling ::popcount from /usr/include/strings.h.
Thanks, I'll use AK_OS_NETBSD.
pkgsrc doesn't like temporary RPATHs. only the final installation RPATH is allowed. So the LD_LIBRARY_PATH workaround is fine.
Does Linux even provide a native popcount? NetBSD does, perhaps that's the problem.
I needed no further patches to compile; I had to change the font search path (pkgsrc uses ${PREFIX}/share/fonts which is usually, but not always,/usr/pkg/share/fonts).
On startup, I have a major problem though:
119877.571 [33;1mWebContent(1042)[0m: FontDatabase::load_all_fonts_from_uri('file:///usr/share/fonts'): open: No such file or directory (errno=2)
119877.574 [33;1mWebContent(1042)[0m: FontDatabase::load_all_fonts_from_uri('file:///home/wiz/.local/share/fonts'): open: No such file or directory (errno=2)
VERIFICATION FAILED: block != MAP_FAILED at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/Heap/BlockAllocator.cpp:60
0x766f4616f05c <ak_verification_failed+0xc6> at /usr/pkg/lib/liblagom-ak.so.0
0x766f464806b7 JS::BlockAllocator::allocate_block(char const*) 0xaf> at /usr/pkg/lib/liblagom-js.so.0
0x766f46484287 JS::HeapBlock::create_with_cell_size(JS::Heap&, JS::CellAllocator&, unsigned long, char const*) 0x39> at /usr/pkg/lib/liblagom-js.so.0
0x766f46480ae8 JS::CellAllocator::allocate_cell(JS::Heap&) 0x1b6> at /usr/pkg/lib/liblagom-js.so.0
0x766f4680288b JS::VM::VM(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >, AK::Array<AK::String, 1ul>) 0x531> at /usr/pkg/lib/liblagom-js.so.0
0x766f468040f1 JS::VM::create(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >) 0xeb> at /usr/pkg/lib/liblagom-js.so.0
0x766f471e6a71 Web::Bindings::initialize_main_thread_vm() 0x12c> at /usr/pkg/lib/liblagom-web.so.0
0xed5679 serenity_main(Main::Arguments) 0xe5bad0> at /usr/pkg/libexec/WebContent
0xed99b4 <main+0xe5b117> at /usr/pkg/libexec/WebContent
119877.614 [33;1mRequestServer(28756)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119877.614 [33;1mWebSocket(9287)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119877.615 [33;1mLadybird(2728)[0m: WebContent process crashed!
119877.748 [33;1mWebContent(19386)[0m: FontDatabase::load_all_fonts_from_uri('file:///usr/share/fonts'): open: No such file or directory (errno=2)
119877.751 [33;1mWebContent(19386)[0m: FontDatabase::load_all_fonts_from_uri('file:///home/wiz/.local/share/fonts'): open: No such file or directory (errno=2)
VERIFICATION FAILED: block != MAP_FAILED at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/Heap/BlockAllocator.cpp:60
0x79706187a05c <ak_verification_failed+0xc6> at /usr/pkg/lib/liblagom-ak.so.0
0x797061b8b6b7 JS::BlockAllocator::allocate_block(char const*) 0xaf> at /usr/pkg/lib/liblagom-js.so.0
0x797061b8f287 JS::HeapBlock::create_with_cell_size(JS::Heap&, JS::CellAllocator&, unsigned long, char const*) 0x39> at /usr/pkg/lib/liblagom-js.so.0
0x797061b8bae8 JS::CellAllocator::allocate_cell(JS::Heap&) 0x1b6> at /usr/pkg/lib/liblagom-js.so.0
0x797061f0d88b JS::VM::VM(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >, AK::Array<AK::String, 1ul>) 0x531> at /usr/pkg/lib/liblagom-js.so.0
0x797061f0f0f1 JS::VM::create(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >) 0xeb> at /usr/pkg/lib/liblagom-js.so.0
0x7970628f1a71 Web::Bindings::initialize_main_thread_vm() 0x12c> at /usr/pkg/lib/liblagom-web.so.0
0x987679 serenity_main(Main::Arguments) 0x90dad0> at /usr/pkg/libexec/WebContent
0x98b9b4 <main+0x90d117> at /usr/pkg/libexec/WebContent
119877.791 [33;1mWebSocket(29584)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119877.791 [33;1mRequestServer(4944)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119877.792 [33;1mLadybird(2728)[0m: WebContent process crashed!
119877.925 [33;1mWebContent(28814)[0m: FontDatabase::load_all_fonts_from_uri('file:///usr/share/fonts'): open: No such file or directory (errno=2)
119877.928 [33;1mWebContent(28814)[0m: FontDatabase::load_all_fonts_from_uri('file:///home/wiz/.local/share/fonts'): open: No such file or directory (errno=2)
VERIFICATION FAILED: block != MAP_FAILED at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/Heap/BlockAllocator.cpp:60
0x7f541533405c <ak_verification_failed+0xc6> at /usr/pkg/lib/liblagom-ak.so.0
0x7f54156456b7 JS::BlockAllocator::allocate_block(char const*) 0xaf> at /usr/pkg/lib/liblagom-js.so.0
0x7f5415649287 JS::HeapBlock::create_with_cell_size(JS::Heap&, JS::CellAllocator&, unsigned long, char const*) 0x39> at /usr/pkg/lib/liblagom-js.so.0
0x7f5415645ae8 JS::CellAllocator::allocate_cell(JS::Heap&) 0x1b6> at /usr/pkg/lib/liblagom-js.so.0
0x7f54159c788b JS::VM::VM(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >, AK::Array<AK::String, 1ul>) 0x531> at /usr/pkg/lib/liblagom-js.so.0
0x7f54159c90f1 JS::VM::create(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >) 0xeb> at /usr/pkg/lib/liblagom-js.so.0
0x7f54163aba71 Web::Bindings::initialize_main_thread_vm() 0x12c> at /usr/pkg/lib/liblagom-web.so.0
0x9a3679 serenity_main(Main::Arguments) 0x929ad0> at /usr/pkg/libexec/WebContent
0x9a79b4 <main+0x929117> at /usr/pkg/libexec/WebContent
119877.968 [33;1mWebSocket(4636)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119877.968 [33;1mRequestServer(11805)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119877.969 [33;1mLadybird(2728)[0m: WebContent process crashed!
119878.105 [33;1mWebContent(15835)[0m: FontDatabase::load_all_fonts_from_uri('file:///usr/share/fonts'): open: No such file or directory (errno=2)
119878.108 [33;1mWebContent(15835)[0m: FontDatabase::load_all_fonts_from_uri('file:///home/wiz/.local/share/fonts'): open: No such file or directory (errno=2)
VERIFICATION FAILED: block != MAP_FAILED at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/Heap/BlockAllocator.cpp:60
0x7ed891ac205c <ak_verification_failed+0xc6> at /usr/pkg/lib/liblagom-ak.so.0
0x7ed891dd36b7 JS::BlockAllocator::allocate_block(char const*) 0xaf> at /usr/pkg/lib/liblagom-js.so.0
0x7ed891dd7287 JS::HeapBlock::create_with_cell_size(JS::Heap&, JS::CellAllocator&, unsigned long, char const*) 0x39> at /usr/pkg/lib/liblagom-js.so.0
0x7ed891dd3ae8 JS::CellAllocator::allocate_cell(JS::Heap&) 0x1b6> at /usr/pkg/lib/liblagom-js.so.0
0x7ed89215588b JS::VM::VM(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >, AK::Array<AK::String, 1ul>) 0x531> at /usr/pkg/lib/liblagom-js.so.0
0x7ed8921570f1 JS::VM::create(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >) 0xeb> at /usr/pkg/lib/liblagom-js.so.0
0x7ed892b39a71 Web::Bindings::initialize_main_thread_vm() 0x12c> at /usr/pkg/lib/liblagom-web.so.0
0xedf679 serenity_main(Main::Arguments) 0xe65ad0> at /usr/pkg/libexec/WebContent
0xee39b4 <main+0xe65117> at /usr/pkg/libexec/WebContent
119878.147 [33;1mWebSocket(3209)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119878.148 [33;1mRequestServer(11537)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119878.149 [33;1mLadybird(2728)[0m: WebContent process crashed!
119878.281 [33;1mWebContent(20355)[0m: FontDatabase::load_all_fonts_from_uri('file:///usr/share/fonts'): open: No such file or directory (errno=2)
119878.284 [33;1mWebContent(20355)[0m: FontDatabase::load_all_fonts_from_uri('file:///home/wiz/.local/share/fonts'): open: No such file or directory (errno=2)
VERIFICATION FAILED: block != MAP_FAILED at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/Heap/BlockAllocator.cpp:60
0x7ba60566605c <ak_verification_failed+0xc6> at /usr/pkg/lib/liblagom-ak.so.0
0x7ba6059776b7 JS::BlockAllocator::allocate_block(char const*) 0xaf> at /usr/pkg/lib/liblagom-js.so.0
0x7ba60597b287 JS::HeapBlock::create_with_cell_size(JS::Heap&, JS::CellAllocator&, unsigned long, char const*) 0x39> at /usr/pkg/lib/liblagom-js.so.0
0x7ba605977ae8 JS::CellAllocator::allocate_cell(JS::Heap&) 0x1b6> at /usr/pkg/lib/liblagom-js.so.0
0x7ba605cf988b JS::VM::VM(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >, AK::Array<AK::String, 1ul>) 0x531> at /usr/pkg/lib/liblagom-js.so.0
0x7ba605cfb0f1 JS::VM::create(AK::OwnPtr<JS::VM::CustomData, AK::DefaultDelete<JS::VM::CustomData> >) 0xeb> at /usr/pkg/lib/liblagom-js.so.0
0x7ba6066dda71 Web::Bindings::initialize_main_thread_vm() 0x12c> at /usr/pkg/lib/liblagom-web.so.0
0xf03679 serenity_main(Main::Arguments) 0xe89ad0> at /usr/pkg/libexec/WebContent
0xf079b4 <main+0xe89117> at /usr/pkg/libexec/WebContent
119878.323 [33;1mRequestServer(13040)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119878.323 [33;1mWebSocket(6756)[0m: Loaded 145 of 145 (100%) provided CA Certificates
119878.325 [33;1mLadybird(2728)[0m: WebContent process crashed!
119878.325 [33;1mLadybird(2728)[0m: WebContent has crashed 5 times in quick succession! Not restarting...
MAP_FAILED calls to mind mmap() - I should perhaps mention that NetBSD by default doesn't allow mapping writable mmap sections as executable (PAX mprotect), which annoys most JITs. The workaround is to double-map sections; the NetBSD mremap man page has example code for this.
However, turning this feature off didn't fix the problem, so perhaps that's a red herring. Any ideas?
That mmap should be just a
mmap(nullptr, HeapBlock::block_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
where HeapBlock::block_size is 4096.
https://github.com/SerenityOS/serenity/blob/a0dc9584de4dd5b8b355bed599ab5f54a5bb24b6/Userland/Libraries/LibJS/Heap/BlockAllocator.cpp#L58
perhaps NetBSD expects that the fd parameter is -1 for MAP_ANONYMOUS?
I think you're right, from NetBSD's mmap man page:
MAP_ANON Map anonymous memory not associated with any
specific file. The file descriptor is not
used for creating MAP_ANON regions, and must
be specified as -1. The mapped memory will
be zero filled.
MAP_ANONYMOUS Synonymous with MAP_ANON.
One patch later:
--- Userland/Libraries/LibJS/Heap/BlockAllocator.cpp.orig 2024-02-27 18:49:14.164744463 +0000
+++ Userland/Libraries/LibJS/Heap/BlockAllocator.cpp
@@ -52,8 +52,10 @@ void* BlockAllocator::allocate_block([[m
return block;
}
-#ifdef AK_OS_SERENITY
+#if defined(AK_OS_SERENITY)
auto* block = (HeapBlock*)serenity_mmap(nullptr, HeapBlock::block_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_RANDOMIZED | MAP_PRIVATE, 0, 0, HeapBlock::block_size, name);
+#elif defined(AK_OS_NETBSD)
+ auto* block = (HeapBlock*)mmap(nullptr, HeapBlock::block_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
#else
auto* block = (HeapBlock*)mmap(nullptr, HeapBlock::block_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
#endif
ladybird finishes startup, but shows me, for every page I tried including about:srcdoc:
Web page crashed
The web page $URL has crashed.
You can reload the page to try again.
I have two core dumps, one for RequestServer:
(gdb) bt
#0 0x00007d428ea9ffaf in _freeaddrinfo (ai=0x0) at /disk/storage-202004/archive/foreign/src/lib/libc/net/getaddrinfo.c:373
#1 0x00007d428f0c700d in Core::System::AddressInfoVector::AddrInfoDeleter::operator() () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/System.h:262
#2 AK::OwnPtr<addrinfo, Core::System::AddressInfoVector::AddrInfoDeleter>::clear () at /scratch/wip/ladybird-git/work/serenity/AK/OwnPtr.h:110
#3 AK::OwnPtr<addrinfo, Core::System::AddressInfoVector::AddrInfoDeleter>::~OwnPtr () at /scratch/wip/ladybird-git/work/serenity/AK/OwnPtr.h:45
#4 Core::System::AddressInfoVector::~AddressInfoVector () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/System.h:248
#5 Core::System::getaddrinfo () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/System.cpp:1526
#6 0x00007d428f0ba2ba in Core::Socket::resolve_host () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/Socket.cpp:69
#7 0x00007d428f0bb100 in Core::TCPSocket::connect () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/Socket.cpp:194
#8 0x00007d428f1a506c in TLS::TLSv12::connect () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibTLS/Socket.cpp:56
#9 0x000000000016c5eb in RequestServer::ConnectionCache::Proxy::tunnel<TLS::TLSv12, TLS::TLSv12> () at /scratch/wip/ladybird-git/work/serenity/Userland/Services/RequestServer/ConnectionCache.h:40
#10 0x000000000017c1d4 in RequestServer::ConnectionCache::get_or_create_connection<AK::HashMap<RequestServer::ConnectionCache::ConnectionKey, AK::NonnullOwnPtr<AK::Vector<AK::NonnullOwnPtr<RequestServer::ConnectionCache::Connection<TLS::TLSv12, TLS::TLSv12> >, 0ul> >, AK::Traits<RequestServer::ConnectionCache::ConnectionKey>, AK::Traits<AK::NonnullOwnPtr<AK::Vector<AK::NonnullOwnPtr<RequestServer::ConnectionCache::Connection<TLS::TLSv12, TLS::TLSv12> >, 0ul> > >, false>, AK::NonnullRefPtr<HTTP::HttpsJob> > ()
at /scratch/wip/ladybird-git/work/serenity/Userland/Services/RequestServer/ConnectionCache.h:201
#11 0x000000000017cb27 in RequestServer::Detail::start_request<AK::Badge<RequestServer::HttpsProtocol>, AK::ErrorOr<RequestServer::Protocol::Pipe, AK::Error> >(AK::Badge<RequestServer::HttpsProtocol>&&, int, RequestServer::ConnectionFromClient&, AK::ByteString const&, AK::URL const&, AK::HashMap<AK::ByteString, AK::ByteString, AK::Traits<AK::ByteString>, AK::Traits<AK::ByteString>, false> const&, AK::Span<unsigned char const>, AK::ErrorOr<RequestServer::Protocol::Pipe, AK::Error>&&, Core::ProxyData)::{lambda()#1}::operator()() const ()
at /scratch/wip/ladybird-git/work/serenity/Userland/Services/RequestServer/HttpCommon.h:107
#12 AK::Function<void ()>::CallableWrapper<RequestServer::Detail::start_request<AK::Badge<RequestServer::HttpsProtocol>, AK::ErrorOr<RequestServer::Protocol::Pipe, AK::Error> >(AK::Badge<RequestServer::HttpsProtocol>&&, int, RequestServer::ConnectionFromClient&, AK::ByteString const&, AK::URL const&, AK::HashMap<AK::ByteString, AK::ByteString, AK::Traits<AK::ByteString>, AK::Traits<AK::ByteString>, false> const&, AK::Span<unsigned char const>, AK::ErrorOr<RequestServer::Protocol::Pipe, AK::Error>&&, Core::ProxyData)::{lambda()#1}>::call() ()
at /scratch/wip/ladybird-git/work/serenity/AK/Function.h:182
#13 0x00007d428f0decd7 in AK::Function<void ()>::operator()() const () at /scratch/wip/ladybird-git/work/serenity/AK/Function.h:115
#14 0x00007d428f0c9c87 in Core::ThreadEventQueue::process () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/ThreadEventQueue.cpp:108
#15 0x00007d428f0acb19 in Core::EventLoopImplementationUnix::pump () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp:293
#16 Core::EventLoopImplementationUnix::exec () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp:285
#17 0x00007d428f0a8999 in Core::EventLoop::exec () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/EventLoop.cpp:88
#18 0x00000000001403f3 in serenity_main () at /scratch/wip/ladybird-git/work/serenity/Ladybird/RequestServer/main.cpp:61
#19 0x000000000014ef60 in main () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibMain/Main.cpp:43
and one for WebContent:
(gdb) bt
#0 ak_verification_failed () at /scratch/wip/ladybird-git/work/serenity/AK/Assertions.cpp:108
#1 0x00007f24cbdeddeb in determine_navigation_params_policy_container () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Navigable.cpp:523
#2 determine_navigation_params_policy_container () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Navigable.cpp:504
#3 0x00007f24cbdfb28b in create_navigation_params_by_fetching () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Navigable.cpp:977
#4 Web::HTML::Navigable::populate_session_history_entry_document(JS::GCPtr<Web::HTML::SessionHistoryEntry>, Web::HTML::SourceSnapshotParams const&, Web::HTML::TargetSnapshotParams const&, AK::Optional<AK::String>, AK::Variant<AK::Empty, Web::HTML::NavigationParams, Web::HTML::NonFetchSchemeNavigationParams>, Web::HTML::CSPNavigationType, bool, AK::Function<void ()>) ()
at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Navigable.cpp:1053
#5 0x00007f24cbdfbdcf in operator() () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Navigable.cpp:1416
#6 0x00007f24cc8cf1d0 in JS::SafeFunction<void ()>::operator()() const () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/SafeFunction.h:85
#7 AK::Function<void ()>::CallableWrapper<JS::SafeFunction<void ()> >::call() () at /scratch/wip/ladybird-git/work/serenity/AK/Function.h:182
#8 0x00007f24caba0cd7 in AK::Function<void ()>::operator()() const () at /scratch/wip/ladybird-git/work/serenity/AK/Function.h:115
#9 0x00007f24cab8bc87 in Core::ThreadEventQueue::process () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/ThreadEventQueue.cpp:108
#10 0x00000000004218ab in Ladybird::EventLoopManagerQt::event_target_received_event () at /scratch/wip/ladybird-git/work/serenity/Ladybird/Qt/EventLoopImplementationQt.cpp:154
#11 0x0000000000421e7c in Ladybird::EventLoopImplementationQtEventTarget::event () at /scratch/wip/ladybird-git/work/serenity/Ladybird/Qt/EventLoopImplementationQtEventTarget.cpp:13
#12 0x00007f24cd4689dd in doNotify (event=0x7f24b64f0980, receiver=0x7f24c52a8a80) at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1217
#13 QCoreApplication::notify (event=0x7f24b64f0980, receiver=0x7f24c52a8a80, this=<optimized out>)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1200
#14 QCoreApplication::notifyInternal2 (receiver=0x7f24c52a8a80, event=0x7f24b64f0980) at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1121
#15 0x00007f24cd468c9c in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1539
#16 0x00007f24cd46cb73 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x7f24c52853c0)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1901
#17 0x00007f24cd46cec4 in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1760
#18 0x00007f24cd6b7e6d in postEventSourceDispatch (s=s@entry=0x7f24c5243000) at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventdispatcher_glib.cpp:243
#19 0x00007f24c945e6fa in g_main_dispatch (context=context@entry=0x7f24c524a240) at ../glib/gmain.c:3476
#20 0x00007f24c9461b5c in g_main_context_dispatch_unlocked (context=0x7f24c524a240) at ../glib/gmain.c:4284
#21 g_main_context_iterate_unlocked (context=context@entry=0x7f24c524a240, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4349
#22 0x00007f24c946241b in g_main_context_iteration (context=0x7f24c524a240, may_block=may_block@entry=1) at ../glib/gmain.c:4414
#23 0x00007f24cd6b7670 in QEventDispatcherGlib::processEvents (this=0x7f24c52a8a50, flags=...)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventdispatcher_glib.cpp:393
#24 0x00007f24cd47440a in QEventLoop::exec (this=0x7f24c521f870, flags=...) at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.6.2/src/corelib/global/qflags.h:34
#25 0x00007f24cab6a999 in Core::EventLoop::exec () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/EventLoop.cpp:88
#26 0x0000000000428cc8 in serenity_main () at /scratch/wip/ladybird-git/work/serenity/Ladybird/WebContent/main.cpp:141
#27 0x000000000042c9b4 in main () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibMain/Main.cpp:43
about:srcdoc is a known issue https://github.com/SerenityOS/serenity/issues/23216
hitting issues in getaddrinfo/freeaddrinfo is unexpected though.
It looks like we copy struct addrinfo into a vector from getaddrinfo, and then free the pointer we got from getaddrinfo with freeaddrinfo later.
https://github.com/SerenityOS/serenity/blob/a0dc9584de4dd5b8b355bed599ab5f54a5bb24b6/Userland/Libraries/LibCore/System.h#L243-L267
https://github.com/SerenityOS/serenity/blob/a0dc9584de4dd5b8b355bed599ab5f54a5bb24b6/Userland/Libraries/LibCore/System.cpp#L1507
C++ is not my forte, but from a short review this looks fine. I assume:
TRY(addresses.try_append(*result));
makes a copy of the result and doesn't move it?
What is a site that should definitely work (for testing)?
The same patch to mmap with MAP_ANONYMOUS is also needed to make Ladybird work on FreeBSD (again). I'll include it as a distribution patch into the port.
Since @ADKaster was so nice proposing a pull request with fixes, I wanted to try it out, but the build fails early for me right now:
[69/2584] Linking CXX executable bin/GenerateIDNAData
FAILED: bin/GenerateIDNAData
: && /scratch/wip/ladybird-git/work/.cwrapper/bin/c++ -O2 -g -fstack-clash-protection -I/usr/pkg/qt6/include -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/harfbuzz -I/usr/pkg/include/freetype2 -I/usr/pkg/include/libdrm -I/usr/pkg/include/gstreamer-1.0 -L/usr/pkg/gcc12/lib/gcc/x86_64--netbsd/12.3.0 -Wl,-R/usr/pkg/gcc12/lib/gcc/x86_64--netbsd/12.3.0 -Wl,-zrelro -Wl,-znow -L/usr/pkg/qt6/lib -L/usr/pkg/qt6/plugins -Wl,-R/usr/pkg/qt6/lib -Wl,-R/usr/pkg/qt6/plugins -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib Lagom/Tools/CodeGenerators/LibUnicode/CMakeFiles/GenerateIDNAData.dir/GenerateIDNAData.cpp.o -o bin/GenerateIDNAData lib/liblagom-filesystem.so.0.0.0 lib/liblagom-main.a lib/liblagom-coreminimal.so.0.0.0 lib/liblagom-ak.so.0.0.0 -lpthread && :
/usr/bin/ld: lib/liblagom-coreminimal.so.0.0.0: undefined reference to `shm_open'
/usr/bin/ld: lib/liblagom-coreminimal.so.0.0.0: undefined reference to `shm_unlink'
On NetBSD, shm_open and friends are in librt, i.e. need linking against -lrt.
I now need:
--- Userland/Libraries/LibCore/CMakeLists.txt.orig 2024-05-09 19:06:10.996535513 +0000
+++ Userland/Libraries/LibCore/CMakeLists.txt
@@ -15,7 +15,7 @@ set(SOURCES
)
serenity_lib(LibCoreMinimal coreminimal)
-target_link_libraries(LibCoreMinimal PRIVATE LibSystem)
+target_link_libraries(LibCoreMinimal PRIVATE LibSystem -lrt)
set(SOURCES
AnonymousBuffer.cpp
So I tried ladybird with the proposed patches from the pull request, the one in the comment https://github.com/SerenityOS/serenity/issues/23375#issuecomment-2103255960 and the last one from comment https://github.com/SerenityOS/serenity/issues/23375#issuecomment-1967342898 (constexpr) on NetBSD, and it starts up and shows the search bar with some icons for Bing, Duckduckgo etc. but does nothing when I click on them and core dumps when I enter "https://github.com/" in the URL bar. Only one core dump though, for RequestServer.
Sounds like the problem with getaddrinfo is still there. Still not sure what we're doing wrong with those, though I haven't looked into it very much.
Re: librt, does this patch do the trick?
diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt
index dc89743d2a..d7a5023bed 100644
--- a/Meta/Lagom/CMakeLists.txt
+++ b/Meta/Lagom/CMakeLists.txt
@@ -360,7 +360,8 @@ add_serenity_subdirectory(Userland/Libraries/LibCore)
target_link_libraries(LibCore PRIVATE Threads::Threads)
if (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
# NetBSD has its shm_open and shm_unlink functions in librt so we need to link that
- target_link_libraries(LibCore PRIVATE librt.so)
+ target_link_libraries(LibCore PRIVATE rt)
+ target_link_libraries(LibCoreMinimal PRIVATE rt)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
# Solaris has socket and networking related functions in two extra libraries
And/or does changing LibCore to LibCoreMinimal fix it? (i.e. do we only need librt on the minimal lib)
Re: addrinfo: Does this patch fix it?
diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h
index a57d1f8faf..f190672f71 100644
--- a/Userland/Libraries/LibCore/System.h
+++ b/Userland/Libraries/LibCore/System.h
@@ -263,7 +263,7 @@ private:
}
struct AddrInfoDeleter {
- void operator()(struct addrinfo* ptr) { ::freeaddrinfo(ptr); }
+ void operator()(struct addrinfo* ptr) { if (ptr) ::freeaddrinfo(ptr); }
};
Vector<struct addrinfo> m_addresses {};
Most LibCs we target don't seem to mind if we call ::freeaddrinfo(null)
You might be on the right track, I just found https://github.com/NetBSD/src/blob/9bda4630351909a1a74baa7c5b3e2fbb1553b941/lib/libc/net/getaddrinfo.c#L42-L44 I'll try it and report back.
And/or does changing LibCore to LibCoreMinimal fix it? (i.e. do we only need librt on the minimal lib)
Thanks.
--- Meta/Lagom/CMakeLists.txt.orig 2024-05-09 21:15:08.421089885 +0000
+++ Meta/Lagom/CMakeLists.txt
@@ -360,7 +360,7 @@ add_serenity_subdirectory(Userland/Libra
target_link_libraries(LibCore PRIVATE Threads::Threads)
if (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
# NetBSD has its shm_open and shm_unlink functions in librt so we need to link that
- target_link_libraries(LibCore PRIVATE librt.so)
+ target_link_libraries(LibCoreMinimal PRIVATE rt)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
# Solaris has socket and networking related functions in two extra libraries
is enough.
Re: addrinfo: Does this patch fix it?
Yes! It seems to do more now. But then it dies in WebContent. Backtrace:
#0 AK::RefCountedBase::deref_base () at /scratch/wip/ladybird-git/work/serenity/AK/RefCounted.h:47
47 /scratch/wip/ladybird-git/work/serenity/AK/RefCounted.h: No such file or directory.
(gdb) bt
#0 AK::RefCountedBase::deref_base () at /scratch/wip/ladybird-git/work/serenity/AK/RefCounted.h:47
#1 AK::RefCounted<JS::SourceCode>::unref () at /scratch/wip/ladybird-git/work/serenity/AK/RefCounted.h:61
#2 AK::unref_if_not_null<JS::SourceCode const> () at /scratch/wip/ladybird-git/work/serenity/AK/NonnullRefPtr.h:32
#3 AK::RefPtr<JS::SourceCode const>::clear () at /scratch/wip/ladybird-git/work/serenity/AK/RefPtr.h:223
#4 AK::RefPtr<JS::SourceCode const>::~RefPtr () at /scratch/wip/ladybird-git/work/serenity/AK/RefPtr.h:103
#5 JS::ASTNode::~ASTNode () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/AST.h:54
#6 JS::Statement::~Statement () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/AST.h:154
#7 JS::ErrorStatement::~ErrorStatement () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/AST.h:223
#8 0x00007e8bd30edea3 in Web::DOM::Element::run_attribute_change_steps () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/DOM/Element.cpp:446
#9 0x00007e8bd311001d in Web::DOM::NamedNodeMap::append_attribute () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp:275
#10 0x00007e8bd3e339c5 in operator()<Web::HTML::HTMLToken::Attribute> ()
at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp:710
#11 call () at /scratch/wip/ladybird-git/work/serenity/AK/Function.h:192
#12 AK::Function<AK::IterationDecision (Web::HTML::HTMLToken::Attribute const&)>::operator()(Web::HTML::HTMLToken::Attribute const&) const ()
at /scratch/wip/ladybird-git/work/serenity/AK/Function.h:125
#13 Web::HTML::HTMLToken::for_each_attribute(AK::Function<AK::IterationDecision (Web::HTML::HTMLToken::Attribute const&)>) const ()
at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h:231
#14 0x00007e8bd32b3ba5 in Web::HTML::HTMLParser::create_element_for ()
at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp:707
#15 0x00007e8bd32b4cde in Web::HTML::HTMLParser::insert_foreign_element ()
at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp:762
#16 0x00007e8bd32be5d9 in Web::HTML::HTMLParser::insert_html_element ()
at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp:793
#17 Web::HTML::HTMLParser::handle_in_head () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp:935
#18 0x00007e8bd32c3344 in Web::HTML::HTMLParser::run () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp:202
#19 0x00007e8bd32c3f47 in Web::HTML::HTMLParser::run () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp:223
#20 0x00007e8bd3e8ca40 in JS::SafeFunction<void ()>::operator()() const () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibJS/SafeFunction.h:85
#21 AK::Function<void ()>::CallableWrapper<JS::SafeFunction<void ()> >::call() () at /scratch/wip/ladybird-git/work/serenity/AK/Function.h:192
#22 0x00007e8bd1f0f237 in AK::Function<void ()>::operator()() const () at /scratch/wip/ladybird-git/work/serenity/AK/Function.h:125
#23 0x00007e8bd1efdb89 in Core::ThreadEventQueue::process () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/ThreadEventQueue.cpp:108
#24 0x0000000000528e8b in Ladybird::EventLoopManagerQt::event_target_received_event ()
at /scratch/wip/ladybird-git/work/serenity/Ladybird/Qt/EventLoopImplementationQt.cpp:154
#25 0x00000000005294fa in Ladybird::EventLoopImplementationQtEventTarget::event ()
at /scratch/wip/ladybird-git/work/serenity/Ladybird/Qt/EventLoopImplementationQtEventTarget.cpp:13
#26 0x00007e8bd4bd4616 in doNotify (event=<optimized out>, receiver=<optimized out>)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1235
#27 QCoreApplication::notify (event=<optimized out>, receiver=<optimized out>, this=<optimized out>)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1218
#28 QCoreApplication::notifyInternal2 (receiver=0x7e8bcc63aa50, event=0x7e8bc71f3a30)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1134
#29 0x00007e8bd4bd494c in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1575
#30 0x00007e8bd4bd866c in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x7e8bcc6173c0)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1932
#31 0x00007e8bd4bd89be in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1789
#32 0x00007e8bd4e2cc2f in postEventSourceDispatch (s=s@entry=0x7e8bcc5d5000)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qeventdispatcher_glib.cpp:244
#33 0x00007e8bd0804b0d in g_main_dispatch (context=context@entry=0x7e8bcc5dc240) at ../glib/gmain.c:3344
#34 0x00007e8bd0807f68 in g_main_context_dispatch_unlocked (context=0x7e8bcc5dc240) at ../glib/gmain.c:4152
#35 g_main_context_iterate_unlocked (context=context@entry=0x7e8bcc5dc240, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
at ../glib/gmain.c:4217
#36 0x00007e8bd0808833 in g_main_context_iteration (context=0x7e8bcc5dc240, may_block=may_block@entry=1) at ../glib/gmain.c:4282
#37 0x00007e8bd4e2c3aa in QEventDispatcherGlib::processEvents (this=0x7e8bcc63aa20, flags=...)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qeventdispatcher_glib.cpp:394
#38 0x00007e8bd4bdfe5a in QEventLoop::exec (this=0x7e8bcc5b28d0, flags=...) at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.0/src/corelib/global/qflags.h:34
#39 0x00007e8bd1ee46f9 in Core::EventLoop::exec () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/EventLoop.cpp:88
#40 0x0000000000530301 in serenity_main () at /scratch/wip/ladybird-git/work/serenity/Ladybird/WebContent/main.cpp:171
#41 0x0000000000534916 in main () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibMain/Main.cpp:43
That's when I try to visit https://github.com
I saw the commit and thought I'd give it another try. Most patches seem merged, so I just removed all local changes. Compilation currently fails with multiple instances of:
In file included from /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/SystemTheme.h:17,
from /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/Palette.h:15,
from /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibSyntax/Highlighter.h:11,
from /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibSyntax/Language.cpp:9:
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/Color.h: In member function 'constexpr u8 Gfx::Color::luminosity() const':
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/Color.h:321:28: error: call to non-'constexpr' function 'I AK::Rounding::round_to(float) [with I = unsigned char]'
321 | return round_to<u8>(red() * 0.2126f + green() * 0.7152f + blue() * 0.0722f);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
That's with gcc 10.5.0 in case it matters.
We bumped our minimum required gcc version to 13.x recently :sweat_smile: . That or clang-17+
Ah, I forgot that the package was already using gcc 12. I've now switched it to gcc 13, and see:
In file included from /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.cpp:12:
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.h:26:2: in 'constexpr' expansion of '<lambda closure object>Gfx::Detail::<lambda()>().Gfx::Detail::<lambda()>()'
/scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.h:24:40: error: call to non-'constexpr' function 'unsigned int popcount(unsigned int)'
24 | coverage_lut[sample] = popcount(sample);
| ~~~~~~~~^~~~~~~~
NetBSD has its own popcount: https://man.netbsd.org/popcount.3 Can you please rename ladybird's one or make it compatible?
Ah hmm. Does qualifying that call as AK::popcount fix the build error?
That does indeed work! Thanks:
--- Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.h.orig 2024-06-06 21:18:50.814506936 +0000
+++ Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.h
@@ -21,7 +21,7 @@ namespace Detail {
static auto constexpr coverage_lut = [] {
Array<u8, 256> coverage_lut {};
for (u32 sample = 0; sample <= 255; sample++)
- coverage_lut[sample] = popcount(sample);
+ coverage_lut[sample] = AK::popcount(sample);
return coverage_lut;
}();
Compared to last time I built this, liblagom-gui.so is not installed any longer. Just mentioning this to check if this is intended or a local issue.
Also, progress! I visited github.com again and it showed the page! :) While I was scrolling down, ladybird died though :(
(gdb) bt
#0 ak_verification_failed () at /scratch/wip/ladybird-git/work/serenity/AK/Assertions.cpp:108
#1 0x0000000000685b48 in AK::ErrorOr<IPC::File, AK::Error>::release_value_but_fixme_should_propagate_errors () at /scratch/wip/ladybird-git/work/serenity/AK/Error.h:202
#2 Ladybird::WebContentView::initialize_client () at /scratch/wip/ladybird-git/work/serenity/Ladybird/Qt/WebContentView.cpp:571
#3 0x00007817d19169de in WebView::ViewImplementation::handle_web_content_process_crash ()
at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibWebView/ViewImplementation.cpp:450
#4 0x00007817cd508402 in AK::Function<void ()>::operator()() const () at /scratch/wip/ladybird-git/work/serenity/AK/Function.h:125
#5 0x00007817cd4f68de in Core::ThreadEventQueue::process () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/ThreadEventQueue.cpp:108
#6 0x000000000066a7fd in Ladybird::EventLoopManagerQt::event_target_received_event ()
at /scratch/wip/ladybird-git/work/serenity/Ladybird/Qt/EventLoopImplementationQt.cpp:154
#7 0x000000000066ae6c in Ladybird::EventLoopImplementationQtEventTarget::event ()
at /scratch/wip/ladybird-git/work/serenity/Ladybird/Qt/EventLoopImplementationQtEventTarget.cpp:13
#8 0x00007817d0f9f958 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x7817c6cb7510, e=0x7817c6c6ccb0)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.1/src/widgets/kernel/qapplication.cpp:3287
#9 0x00007817d004262f in QCoreApplication::notifyInternal2 (receiver=0x7817c6cb7510, event=0x7817c6c6ccb0)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.1/src/corelib/kernel/qcoreapplication.cpp:1134
#10 0x00007817d004294c in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.1/src/corelib/kernel/qcoreapplication.cpp:1575
#11 0x00007817d004666c in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x7817c7ac83c0)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.1/src/corelib/kernel/qcoreapplication.cpp:1932
#12 0x00007817d00469be in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.1/src/corelib/kernel/qcoreapplication.cpp:1789
#13 0x00007817d029a67f in postEventSourceDispatch (s=s@entry=0x7817c6ca50e0)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.1/src/corelib/kernel/qeventdispatcher_glib.cpp:244
#14 0x00007817cbe9bb0d in g_main_dispatch (context=context@entry=0x7817c6d64180) at ../glib/gmain.c:3344
#15 0x00007817cbe9ef68 in g_main_context_dispatch_unlocked (context=0x7817c6d64180) at ../glib/gmain.c:4152
#16 g_main_context_iterate_unlocked (context=context@entry=0x7817c6d64180, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4217
#17 0x00007817cbe9f833 in g_main_context_iteration (context=0x7817c6d64180, may_block=may_block@entry=1) at ../glib/gmain.c:4282
#18 0x00007817d0299dfa in QEventDispatcherGlib::processEvents (this=0x7817c7a93e40, flags=...)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.1/src/corelib/kernel/qeventdispatcher_glib.cpp:394
#19 0x00007817d004de5a in QEventLoop::exec (this=this@entry=0x7f7fff25f6d0, flags=..., flags@entry=...)
at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.1/src/corelib/global/qflags.h:34
#20 0x00007817d004bbe4 in QCoreApplication::exec () at /scratch/x11/qt6-qtbase/work/qtbase-everywhere-src-6.7.1/src/corelib/global/qflags.h:74
#21 0x00007817cd4dd79d in Core::EventLoop::exec () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibCore/EventLoop.cpp:88
#22 0x00000000006893c0 in serenity_main () at /scratch/wip/ladybird-git/work/serenity/Ladybird/Qt/main.cpp:210
#23 0x000000000068ba48 in main () at /scratch/wip/ladybird-git/work/serenity/Userland/Libraries/LibMain/Main.cpp:43
Please move this issue to https://github.com/LadybirdBrowser/ladybird if itβs still relevant.
It is, I opened a new one at https://github.com/LadybirdBrowser/ladybird/issues/438
Thanks.