LadybirdBrowser / ancient-history

The Ladybird web browser
BSD 2-Clause "Simplified" License
1.62k stars 102 forks source link

Build on FreeBSD fails #19

Closed probonopd closed 2 years ago

probonopd commented 2 years ago
# FreeBSD 13.0-RELEASE
sudo pkg install llvm14
git clone https://github.com/awesomekling/ladybird
cd ladybird
nano CMakeLists.txt # Edit Qt 6 down to Qt 5
rm -rf Build || true
env CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang14 cmake -GNinja -B Build 
env CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang14 cmake --build Build

(...)

Building CXX object _deps/lagom-build/...__/__/Userland/Libraries/LibCore/DateTime.cpp.o
FAILED: _deps/lagom-build/CMakeFiles/LibCore.dir/__/__/Userland/Libraries/LibCore/DateTime.cpp.o 
/usr/local/bin/clang14 -DLibCore_EXPORTS -I/tmp/ladybird/Build/serenity/Userland/Libraries -I/tmp/ladybird/Build/serenity -I/tmp/ladybird/Build/_deps/lagom-build -I/tmp/ladybird/Build/serenity/Meta/Lagom/../.. -I/tmp/ladybird/Build/serenity/Meta/Lagom/../../Userland -I/tmp/ladybird/Build/serenity/Meta/Lagom/../../Userland/Libraries -I/tmp/ladybird/Build/serenity/Meta/Lagom/../../Userland/Services -I/tmp/ladybird/Build -I/tmp/ladybird/Build/Libraries -I/tmp/ladybird/Build/Services -fPIC -ggnu-pubnames -Wall -Wextra -Werror -Wno-implicit-const-int-float-conversion -Wno-literal-suffix -Wno-maybe-uninitialized -Wno-unknown-warning-option -fsigned-char -fno-exceptions -fdiagnostics-color=always -fPIC -g -O2 -fno-semantic-interposition -Wno-overloaded-virtual -Wno-user-defined-literals -fconstexpr-steps=16777216 -Wno-unused-private-field -std=c++20 -MD -MT _deps/lagom-build/CMakeFiles/LibCore.dir/__/__/Userland/Libraries/LibCore/DateTime.cpp.o -MF _deps/lagom-build/CMakeFiles/LibCore.dir/__/__/Userland/Libraries/LibCore/DateTime.cpp.o.d -o _deps/lagom-build/CMakeFiles/LibCore.dir/__/__/Userland/Libraries/LibCore/DateTime.cpp.o -c /tmp/ladybird/Build/serenity/Userland/Libraries/LibCore/DateTime.cpp
/tmp/ladybird/Build/serenity/Userland/Libraries/LibCore/DateTime.cpp:254:39: error: use of undeclared identifier 'daylight'
                builder.append(tzname[daylight]);
                                      ^
1 error generated.
ADKaster commented 2 years ago

see https://github.com/SerenityOS/serenity/pull/14369

probonopd commented 2 years ago

Thanks @ADKaster, but that seems to build SerenityOS whereas I am trying to build ladybird for FreeBSD.

Wuzado commented 2 years ago

Ladybird depends on libraries and code from the SerenityOS project. Ultimately, this is basically a wrapper over the LibWeb engine used there.

The issue you're running into seems to be addressed in the linked PR - to be precise, here: https://github.com/SerenityOS/serenity/pull/14369/files#diff-5b3a84cacba5232a3bf59b58051a9039e195c631c5f786b3073c87843b3c61a1

BertalanD commented 2 years ago

I dd some digging yesterday, and the following things need to be done to get the FreeBSD build working:

These are on top of what the linked PR does.

Another issue is that FreeBSD seems to only come with Qt 5, and Ladybird is a Qt 6 project, so not only the build script, but also some source code has to be modified to be compatible with the older version.

BertalanD commented 2 years ago

Can you try building from this PR? https://github.com/SerenityOS/serenity/pull/14539

You need to clone my fork of Serenity, check out the freebsd branch, and point CMake to it with the SERENITY_SOURCE_DIR option.

probonopd commented 2 years ago

Getting further, but still errors out on timezone-related issues:

git clone https://github.com/awesomekling/ladybird
git clone https://github.com/BertalanD/serenity
cd serenity 
git checkout freebsd
cd ../ladybird 
sed -i '' -e 's|Qt6|Qt5|g' CMakeLists.txt
env SERENITY_SOURCE_DIR=$(readlink -f ../serenity) CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang14 cmake -GNinja -B Build 
env SERENITY_SOURCE_DIR=$(readlink -f ../serenity) CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang14 cmake --build Build  

[0/2] Re-checking globbed directories...
[27/2534] Building CXX object _deps/lagom-build...__/__/Userland/Libraries/LibCore/DateTime.cpp.o
FAILED: _deps/lagom-build/CMakeFiles/LibCore.dir/__/__/Userland/Libraries/LibCore/DateTime.cpp.o 
/usr/local/bin/clang14 -DLibCore_EXPORTS -I/tmp/ladybird/Build/serenity/Userland/Libraries -I/tmp/ladybird/Build/serenity -I/tmp/ladybird/Build/_deps/lagom-build -I/tmp/ladybird/Build/serenity/Meta/Lagom/../.. -I/tmp/ladybird/Build/serenity/Meta/Lagom/../../Userland -I/tmp/ladybird/Build/serenity/Meta/Lagom/../../Userland/Libraries -I/tmp/ladybird/Build/serenity/Meta/Lagom/../../Userland/Services -I/tmp/ladybird/Build -I/tmp/ladybird/Build/Libraries -I/tmp/ladybird/Build/Services -fPIC -ggnu-pubnames -Wall -Wextra -Werror -Wno-implicit-const-int-float-conversion -Wno-literal-suffix -Wno-maybe-uninitialized -Wno-unknown-warning-option -fsigned-char -fno-exceptions -fdiagnostics-color=always -fPIC -g -O2 -fno-semantic-interposition -Wno-overloaded-virtual -Wno-user-defined-literals -fconstexpr-steps=16777216 -Wno-unused-private-field -std=c++20 -MD -MT _deps/lagom-build/CMakeFiles/LibCore.dir/__/__/Userland/Libraries/LibCore/DateTime.cpp.o -MF _deps/lagom-build/CMakeFiles/LibCore.dir/__/__/Userland/Libraries/LibCore/DateTime.cpp.o.d -o _deps/lagom-build/CMakeFiles/LibCore.dir/__/__/Userland/Libraries/LibCore/DateTime.cpp.o -c /tmp/ladybird/Build/serenity/Userland/Libraries/LibCore/DateTime.cpp
/tmp/ladybird/Build/serenity/Userland/Libraries/LibCore/DateTime.cpp:254:39: error: use of undeclared identifier 'daylight'
                builder.append(tzname[daylight]);
                                      ^
1 error generated.                                                                               
[29/2534] Building CXX object _deps/lagom-build.../__/Userland/Libraries/LibCore/ConfigFile.cpp.o
ninja: build stopped: subcommand failed.

# Was a replacement forgotten? Does the following fix it?
sed -i '' -e 's|daylight|0|g' Build/serenity/Userland/Libraries/LibCore/DateTime.cpp

env SERENITY_SOURCE_DIR=$(readlink -f ../serenity) CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang14 cmake --build Build  

[186/2506] Linking CXX executable _deps/lagom-b...CodeGenerators/LibTimeZone/GenerateTimeZoneData
FAILED: _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData 
: && /usr/local/bin/clang14  -fuse-ld=lld -Xlinker --gdb-index _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/CMakeFiles/GenerateTimeZoneData.dir/GenerateTimeZoneData.cpp.o -o _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData  -Wl,-rpath,/tmp/ladybird/Build/_deps/lagom-build:  _deps/lagom-build/liblagom-main.so.0.0.0  _deps/lagom-build/liblagom-core.so.0.0.0  -lpthread  -lcrypt && :
ld.lld: error: undefined symbol: operator delete(void*)
>>> referenced by NonnullOwnPtr.h:143 (serenity/AK/NonnullOwnPtr.h:143)
>>>               _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/CMakeFiles/GenerateTimeZoneData.dir/GenerateTimeZoneData.cpp.o:(serenity_main(Main::Arguments))
>>> referenced by NonnullOwnPtr.h:143 (serenity/AK/NonnullOwnPtr.h:143)
>>>               _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/CMakeFiles/GenerateTimeZoneData.dir/GenerateTimeZoneData.cpp.o:(serenity_main(Main::Arguments))
>>> referenced by NonnullOwnPtr.h:143 (serenity/AK/NonnullOwnPtr.h:143)
>>>               _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/CMakeFiles/GenerateTimeZoneData.dir/GenerateTimeZoneData.cpp.o:(serenity_main(Main::Arguments))
>>> referenced 26 more times

ld.lld: error: undefined symbol: operator new(unsigned long)
>>> referenced by Stream.h:526 (serenity/Userland/Libraries/LibCore/Stream.h:526)
>>>               _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/CMakeFiles/GenerateTimeZoneData.dir/GenerateTimeZoneData.cpp.o:(AK::ErrorOr<AK::NonnullOwnPtr<Core::Stream::BufferedSeekable<Core::Stream::File> >, AK::Error> Core::Stream::BufferedHelper<Core::Stream::File>::create_buffered<Core::Stream::BufferedSeekable>(AK::NonnullOwnPtr<Core::Stream::File>, unsigned long))

ld.lld: error: undefined symbol: vtable for __cxxabiv1::__si_class_type_info
>>> referenced by GenerateTimeZoneData.cpp
>>>               _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/CMakeFiles/GenerateTimeZoneData.dir/GenerateTimeZoneData.cpp.o:(typeinfo for Core::Stream::BufferedSeekable<Core::Stream::File>)
>>> referenced by GenerateTimeZoneData.cpp
>>>               _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/CMakeFiles/GenerateTimeZoneData.dir/GenerateTimeZoneData.cpp.o:(typeinfo for AK::Function<bool (char)>::CallableWrapper<parse_zone(AK::StringView, (anonymous namespace)::TimeZoneData&)::$_0>)
>>> referenced by GenerateTimeZoneData.cpp
>>>               _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/CMakeFiles/GenerateTimeZoneData.dir/GenerateTimeZoneData.cpp.o:(typeinfo for AK::Function<bool (char)>::CallableWrapper<parse_zone_continuation(AK::StringView, (anonymous namespace)::TimeZoneData&, AK::Vector<(anonymous namespace)::TimeZoneOffset, 0ul>&)::$_1>)
>>> referenced 2 more times
>>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)

ld.lld: error: undefined symbol: vtable for __cxxabiv1::__class_type_info
>>> referenced by GenerateTimeZoneData.cpp
>>>               _deps/lagom-build/Tools/CodeGenerators/LibTimeZone/CMakeFiles/GenerateTimeZoneData.dir/GenerateTimeZoneData.cpp.o:(typeinfo for AK::Function<bool (char)>::CallableWrapperBase)
>>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)

ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to operator new(unsigned long) [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to operator delete(void*) [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to vtable for __cxxabiv1::__class_type_info [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to vtable for __cxxabiv1::__si_class_type_info [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to __signbit [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to std::nothrow [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to operator new(unsigned long, std::nothrow_t const&) [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to vtable for __cxxabiv1::__vmi_class_type_info [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to __cxa_guard_acquire [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to __cxa_guard_release [--no-allow-shlib-undefined]
ld.lld: error: _deps/lagom-build/liblagom-core.so.0.0.0: undefined reference to __cxa_pure_virtual [--no-allow-shlib-undefined]
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
[188/2506] Building CXX object _deps/lagom-buil..._/Userland/Libraries/LibXML/Parser/Parser.cpp.o
ninja: build stopped: subcommand failed.
BertalanD commented 2 years ago

Looks like you're invoking the compiler in C mode instead of C++ mode, so it doesn't try to link against libc++ implicitly.

Please try changing CXX=/usr/local/bin/clang14 to point to a clang++ binary. It looks like SERENITY_SOURCE_DIR can only be set as a CMake option (-DSERENITY_SOURCE_DIR=whatever), CMake will just ignore the environment variable. Good luck!

probonopd commented 2 years ago

Thanks for the hints. So this gets me much further:

git clone https://github.com/awesomekling/ladybird
git clone https://github.com/BertalanD/serenity
cd serenity 
git checkout freebsd
cd ../ladybird 
sed -i '' -e 's|Qt6|Qt5|g' CMakeLists.txt
env CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang++14 cmake -DSERENITY_SOURCE_DIR=$(readlink -f ../serenity) -GNinja -B Build 
# env CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang++14 cmake -DSERENITY_SOURCE_DIR=$(readlink -f ../serenity) --build Build # CMake Error: Unknown argument --build
env CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang++14 ninja -C Build run

Errors only towards the end:

[2527/2535] Building CXX object CMakeFiles/ladybird.dir/RequestManagerQt.cpp.o
FAILED: CMakeFiles/ladybird.dir/RequestManagerQt.cpp.o 
/usr/local/bin/clang++14 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -I/tmp/ladybird/Build/ladybird_autogen/include -I/tmp/serenity/Userland/Libraries -I/tmp/serenity -I/tmp/ladybird/Build/_deps/lagom-build -isystem /usr/local/include/qt5 -isystem /usr/local/include/qt5/QtWidgets -isystem /usr/local/include/qt5/QtGui -isystem /usr/local/include -isystem /usr/local/include/qt5/QtCore -isystem /usr/local/lib/qt5/mkspecs/freebsd-clang -isystem /usr/local/include/qt5/QtNetwork -ggnu-pubnames -Wall -Wextra -Werror -Wno-implicit-const-int-float-conversion -Wno-literal-suffix -Wno-maybe-uninitialized -Wno-unknown-warning-option -fsigned-char -fno-exceptions -fdiagnostics-color=always -fPIC -g -O2 -fno-semantic-interposition -Wno-expansion-to-defined -std=c++20 -MD -MT CMakeFiles/ladybird.dir/RequestManagerQt.cpp.o -MF CMakeFiles/ladybird.dir/RequestManagerQt.cpp.o.d -o CMakeFiles/ladybird.dir/RequestManagerQt.cpp.o -c /tmp/ladybird/RequestManagerQt.cpp
In file included from /tmp/ladybird/RequestManagerQt.cpp:7:
In file included from /tmp/ladybird/RequestManagerQt.h:11:
In file included from /tmp/serenity/Userland/Libraries/LibWeb/Loader/ResourceLoader.h:11:
In file included from /tmp/serenity/AK/HashMap.h:9:
In file included from /tmp/serenity/AK/HashTable.h:10:
In file included from /tmp/serenity/AK/Error.h:10:
/tmp/serenity/AK/StringView.h:326:77: error: user-defined literal suffixes not starting with '_' are reserved [-Werror,-Wuser-defined-literals]
[[nodiscard]] ALWAYS_INLINE AK_STRING_VIEW_LITERAL_CONSTEVAL AK::StringView operator"" sv(char const* cstring, size_t length)
                                                                            ^
1 error generated.                                                                               
[2528/2535] Building CXX object CMakeFiles/ladybird.dir/ladybird_autogen/mocs_compilation.cpp.o
FAILED: CMakeFiles/ladybird.dir/ladybird_autogen/mocs_compilation.cpp.o 
/usr/local/bin/clang++14 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -I/tmp/ladybird/Build/ladybird_autogen/include -I/tmp/serenity/Userland/Libraries -I/tmp/serenity -I/tmp/ladybird/Build/_deps/lagom-build -isystem /usr/local/include/qt5 -isystem /usr/local/include/qt5/QtWidgets -isystem /usr/local/include/qt5/QtGui -isystem /usr/local/include -isystem /usr/local/include/qt5/QtCore -isystem /usr/local/lib/qt5/mkspecs/freebsd-clang -isystem /usr/local/include/qt5/QtNetwork -ggnu-pubnames -Wall -Wextra -Werror -Wno-implicit-const-int-float-conversion -Wno-literal-suffix -Wno-maybe-uninitialized -Wno-unknown-warning-option -fsigned-char -fno-exceptions -fdiagnostics-color=always -fPIC -g -O2 -fno-semantic-interposition -Wno-expansion-to-defined -std=c++20 -MD -MT CMakeFiles/ladybird.dir/ladybird_autogen/mocs_compilation.cpp.o -MF CMakeFiles/ladybird.dir/ladybird_autogen/mocs_compilation.cpp.o.d -o CMakeFiles/ladybird.dir/ladybird_autogen/mocs_compilation.cpp.o -c /tmp/ladybird/Build/ladybird_autogen/mocs_compilation.cpp
In file included from /tmp/ladybird/Build/ladybird_autogen/mocs_compilation.cpp:2:
In file included from /tmp/ladybird/Build/ladybird_autogen/EWIEGA46WW/moc_BrowserWindow.cpp:10:
In file included from /tmp/ladybird/Build/ladybird_autogen/EWIEGA46WW/../../../BrowserWindow.h:7:
In file included from /tmp/ladybird/Build/ladybird_autogen/EWIEGA46WW/../../../Tab.h:12:
In file included from /tmp/ladybird/Build/ladybird_autogen/EWIEGA46WW/../../../History.h:9:
In file included from /tmp/serenity/AK/URL.h:10:
In file included from /tmp/serenity/AK/String.h:9:
In file included from /tmp/serenity/AK/Format.h:9:
In file included from /tmp/serenity/AK/CheckedFormatString.h:13:
/tmp/serenity/AK/StringView.h:326:77: error: user-defined literal suffixes not starting with '_' are reserved [-Werror,-Wuser-defined-literals]
[[nodiscard]] ALWAYS_INLINE AK_STRING_VIEW_LITERAL_CONSTEVAL AK::StringView operator"" sv(char const* cstring, size_t length)
                                                                            ^
1 error generated.                                                                               
[2529/2535] Building CXX object CMakeFiles/ladybird.dir/BrowserWindow.cpp.o
FAILED: CMakeFiles/ladybird.dir/BrowserWindow.cpp.o 
/usr/local/bin/clang++14 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -I/tmp/ladybird/Build/ladybird_autogen/include -I/tmp/serenity/Userland/Libraries -I/tmp/serenity -I/tmp/ladybird/Build/_deps/lagom-build -isystem /usr/local/include/qt5 -isystem /usr/local/include/qt5/QtWidgets -isystem /usr/local/include/qt5/QtGui -isystem /usr/local/include -isystem /usr/local/include/qt5/QtCore -isystem /usr/local/lib/qt5/mkspecs/freebsd-clang -isystem /usr/local/include/qt5/QtNetwork -ggnu-pubnames -Wall -Wextra -Werror -Wno-implicit-const-int-float-conversion -Wno-literal-suffix -Wno-maybe-uninitialized -Wno-unknown-warning-option -fsigned-char -fno-exceptions -fdiagnostics-color=always -fPIC -g -O2 -fno-semantic-interposition -Wno-expansion-to-defined -std=c++20 -MD -MT CMakeFiles/ladybird.dir/BrowserWindow.cpp.o -MF CMakeFiles/ladybird.dir/BrowserWindow.cpp.o.d -o CMakeFiles/ladybird.dir/BrowserWindow.cpp.o -c /tmp/ladybird/BrowserWindow.cpp
In file included from /tmp/ladybird/BrowserWindow.cpp:8:
In file included from /tmp/ladybird/BrowserWindow.h:7:
In file included from /tmp/ladybird/Tab.h:12:
In file included from /tmp/ladybird/History.h:9:
In file included from /tmp/serenity/AK/URL.h:10:
In file included from /tmp/serenity/AK/String.h:9:
In file included from /tmp/serenity/AK/Format.h:9:
In file included from /tmp/serenity/AK/CheckedFormatString.h:13:
/tmp/serenity/AK/StringView.h:326:77: error: user-defined literal suffixes not starting with '_' are reserved [-Werror,-Wuser-defined-literals]
[[nodiscard]] ALWAYS_INLINE AK_STRING_VIEW_LITERAL_CONSTEVAL AK::StringView operator"" sv(char const* cstring, size_t length)
                                                                            ^
/tmp/ladybird/BrowserWindow.cpp:31:55: error: bitwise operation between different enumeration types ('Qt::Modifier' and 'Qt::Key') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
    new_tab_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_T));
                                             ~~~~~~~~ ^ ~~~~~~~~~
/tmp/ladybird/BrowserWindow.cpp:35:52: error: bitwise operation between different enumeration types ('Qt::Modifier' and 'Qt::Key') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
    quit_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q));
                                          ~~~~~~~~ ^ ~~~~~~~~~
/tmp/ladybird/BrowserWindow.cpp:42:59: error: bitwise operation between different enumeration types ('Qt::Modifier' and 'Qt::Key') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
    view_source_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_U));
                                                 ~~~~~~~~ ^ ~~~~~~~~~
4 errors generated.                                                                              
ninja: build stopped: subcommand failed.
BertalanD commented 2 years ago

The -Wuser-defined-literals part should be handled by https://github.com/awesomekling/ladybird/commit/7e573aadc1b09237897fa5b45830bd38e070b65c.

A quick search shows that the proper way to do the key sequences for Qt 5 would be to use the + operator instead of &? (see example in https://doc.qt.io/qt-5/qkeysequence.html#details). If that doesn't work, maybe just silence the warning then?

probonopd commented 2 years ago

Thanks, I also need the following changes (could they be considered for the pull request?)

# Change from Qt6-only to Qt5/Qt6 compatible notation
sed -i '' -e 's|Qt::CTRL & Qt::Key_T|tr("Ctrl+T")|g' ./BrowserWindow.cpp
sed -i '' -e 's|Qt::CTRL & Qt::Key_Q|tr("Ctrl+Q")|g' ./BrowserWindow.cpp
sed -i '' -e 's|Qt::CTRL & Qt::Key_U|tr("Ctrl+U")|g' ./BrowserWindow.cpp
sed -i '' -e 's|position()|localPos()|g' ./WebView.cpp

Builds and runs. :+1

image

However, trying to run (without building) fails:

FreeBSD% ./Build/ladybird
Set favicon path to /home/user/.config/.lagom/res/icons/16x16/app-browser.png
Assertion failed: (!is_error()), function release_value_but_fixme_should_propagate_errors, file /tmp/serenity/AK/Error.h, line 97.
zsh: abort      Build/ladybird

Notes (not sure whether FreeBSD specific):

Assertion failed: (node_ptr), function append, file /tmp/serenity/Userland/Libraries/LibRegex/RegexMatcher.cpp, line 341.
Subprocess aborted
kleinesfilmroellchen commented 2 years ago

(1) The internal renderer is LibGfx which does understand TTF but the default font is SerenityOS's Katica bitmap font (which is always pixelated). QT does not render anything except the tab bar.

(2) (3) looks like a Browser / WebContent issue not specific to anything.

BertalanD commented 2 years ago

Yay 🥳

About the crash: Ladybird needs the SERENITY_SOURCE_DIR environment variable to point to the SerenityOS source tree's root in order to find some resources.

About the Regex crash: it's the same mmap(MAP_ANONYMOUS) FreeBSD incompatibility issue I've fixed in a couple places. I'll force push my branch with the fix in a few minutes.

probonopd commented 2 years ago

Need

# Change from Qt6-only to Qt5/Qt6 compatible notation
sed -i '' -e 's@Qt::CTRL | Qt::Key_T@tr("Ctrl+T")@g' ./BrowserWindow.cpp
sed -i '' -e 's@Qt::CTRL | Qt::Key_Q@tr("Ctrl+Q")@g' ./BrowserWindow.cpp
sed -i '' -e 's@Qt::CTRL | Qt::Key_U@tr("Ctrl+U")@g' ./BrowserWindow.cpp

This time, no more crash, but GitHub looks like this:

image

Twitter:

image

kleinesfilmroellchen commented 2 years ago

@probonopd Ladybird appears to be working completely for you now. These websites are not expected to look any different. @awesomekling could you close this issue as solved?

probonopd commented 2 years ago

Not sure how closing issues is handled in this repo, but I'd think that this is resolved once the tr("Ctrl+T") style is used and once https://github.com/SerenityOS/serenity/pull/14539 is merged, since only then Ladybird can successfully be compiled on FreeBSD.

Thanks everyone for your tremendous help!

diegoiast commented 2 years ago

The keyboard shortcuts issue will not be fixed, you need to compile against Qt6. See https://github.com/awesomekling/ladybird/pull/25

probonopd commented 2 years ago

Qt6 is not available on FreeBSD at this time.

kellytk commented 2 years ago

Qt6 is now available. (on latest)

probonopd commented 2 years ago

Would still be nice if we can keep the minimally required version at 5 though.

awesomekling commented 2 years ago

Supporting Qt5 is not a goal. Closing this as the issues have been resolved as far as I understand :)

kellytk commented 2 years ago

Where please are FreeBSD installation instructions documented?

probonopd commented 2 years ago

Above :-)

probonopd commented 2 years ago

Supporting Qt5 is not a goal. Closing this as the issues have been resolved as far as I understand :)

Please reopen, since Qt6 is available in Quarterly FreeBSD packages now. When trying to compile using it following the build instructions, I am running into issues. Any hints appreciated.

sudo pkg install qt6
# To my suprise, this is relatively moderate:
# The process will require 176 MiB more space.
# 31 MiB to be downloaded.

git clone --depth 1 https://github.com/awesomekling/ladybird
git clone --depth 1 https://github.com/awesomekling/serenity

cd ./ladybird

env CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang++14 cmake -DSERENITY_SOURCE_DIR=$(readlink -f ../serenity) -GNinja -B Build 

CMake Error at cmake/InstallRules.cmake:37 (install):
  install TARGETS given target "Qt6::Core" which does not exist.                                 
Call Stack (most recent call first):                                                             
  CMakeLists.txt:121 (include)    

# Cannot proceed due to the error above

env CC=/usr/local/bin/clang14 CXX=/usr/local/bin/clang++14 ninja -C Build run

Reference: