ladybird icon indicating copy to clipboard operation
ladybird copied to clipboard

Windows support

Open diegoiast opened this issue 1 year ago • 18 comments

This is a meta issue to track all the issues needed for a Windows support.

Goals:

  1. We aim to support clang-cl. This is the first priority.
  2. Later on, cl, from 2022. This is a very low priority.
  3. If we manage to get some mingw toolchain to compile the program - I am happy. But this is not a goal.
  4. Windows 11 support only (no EOL OS will be supported)

Status:

  • Windows CI/CD is working, see: https://github.com/LadybirdBrowser/ladybird/actions/workflows/ci-windows.yml
  • UI is working as of - https://github.com/LadybirdBrowser/ladybird/pull/5981
  • Scrolling is slow, fonts not optimal.

Please do not comment on this issue unless you have something to contribute. This issue is one of the boss-issues - it will take time. Problems and goals will change, nothing is written in stone, provide code if you can.

diegoiast avatar Jun 04 '24 06:06 diegoiast

Could std::chrono be used as a replacement for the POSIX-only sys/time.h, as it's present in the C++ 20 standard?

asutoshvariar avatar Jul 05 '24 13:07 asutoshvariar

We have a patch hiding in one of those mentioned branches to make AK::Time and AK::Duration work well on windows, so that's not an issue at the moment.

ADKaster avatar Jul 05 '24 15:07 ADKaster

[[no_unique_address]] not supported (am I using a wrong compiler? I use MSVC 2022 and its clang-cl)

A separate msvc::no_unique_address attribute must currently be used instead for ABI reasons: https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/#msvc-extensions-and-abi

This is true in clang-cl too, using a recent-enough version: https://github.com/llvm/llvm-project/pull/65675

seanmiddleditch avatar Jul 14 '24 18:07 seanmiddleditch

Why find an alternative to fontconfig? It works on windows and even compiles with clang-cl. It needs to have config files shipped for it as windows doesn't provide any. It is used in GIMP for example.

R-Goc avatar Aug 12 '24 21:08 R-Goc

Have anyone tried to build Ladybird in Cygwin/MSYS2? They provide some POSIX compatibility layer for Windows.

niutech avatar Aug 13 '24 09:08 niutech

As stated in the first post of the issue, Cygwin and Mingw are not a goal. Native windows with clang-cl and wsl2 with wslg are the only two windows configurations we will support in this repository.

ADKaster avatar Aug 13 '24 10:08 ADKaster

Maybe a github discussions tab, or other way of collaboration could be opened to avoid spamming this tracking issue. This will need more work. (Also how to get cmake to find ICU data?)

R-Goc avatar Aug 13 '24 13:08 R-Goc

@R-Goc I'm currently trying to prepare a native windows build, I've downloaded the icu4c library and have added an environment variable ICU_ROOT to point to the root folder of the ICU lib (where include, lib folders are located). This should be enough for CMake to find it.

Currently "stuck" on PkgConfig and JPEG.

bojantorbica avatar Aug 13 '24 14:08 bojantorbica

pkgconfig looks like is only needed as a build tool so I guess the version distributed with MinGW (like in w64devkit) should work. How did you deal with skia?

R-Goc avatar Aug 13 '24 14:08 R-Goc

Hi all,

This is not the place for such discussions. The project has a discord channel. Use that instead of this issue.

  • PkgConfig is a unix thingie. Not a Windows one. I don't think its the correct way.
  • The package manager used by ladybird is vcpkg, all 3rd parties should be consumed via vcpkg
  • Lagom needs a lot of fixes to compile won MSVC/Clang (or MinGW).
  • The last time I checked this - I found that ffmpeg is pulled needed to build. There was a decision not to pull this from the package manager, as ffpmped is GPL, and this would "taint" the code to be GPL (instead of 2BSD License). I have not followed what happened since.
  • Project is still not stable (development wise speaking only, meaning the code/build-system is very volatile on a daily basis). I put some time off until the build system stabilizes, and then I can continue with the port.
  • If you have a PR, please link this issue.

diegoiast avatar Aug 13 '24 15:08 diegoiast

@diegoiast I have got the checks of 2 and 3 working in this pr if or when it is merged(✅) Platform Windows: Get CMake working to build Windows-native build #1695](https://github.com/LadybirdBrowser/ladybird/pull/1695) vcpkg can build font-config and other library's except FFMPEG this is disabled for this config. the PR sets up CMake to be able to construct the browser with ClangCL but was Working with MSVC first.

pheonixfirewingz avatar Oct 11 '24 01:10 pheonixfirewingz

This is a meta issue to track all the issues needed for a Windows support.

Goals:

  1. We aim to support clang-cl. This is the first priority.
  2. Later on, cl, from 2022. This is a very low priority.
  3. If we manage to get some mingw toolchain to compile the program - I am happy. But this is not a goal.

Problems:

  • [x] ~Some compiler flags are not compatible with clang-cl.~ (Meta/Windows: fix compilation flags for clang-cl #77)
  • [ ] We need a package manager to handle building 3rd parties (ICU, fontconfig?, Skia, WABT, more?)
  • [ ] We need to find an alternative to fontconfig.
  • [ ] 'sys/time.h' not found
  • [ ] [[no_unique_address]] not supported (am I using a wrong compiler? I use MSVC 2022 and its clang-cl)
  • [ ] We need to pull code from previous attempts of this kind of work. (cherry-picks, rebase etc).
  • [ ] Need to understand how to run the commit linters on the local machine, as we don't want developers to spam the CI/CD with phantom builds, just to fix a typo on the commit log (yes, that is directed at me)

Known forks, branches:

  • https://github.com/cammo1123/serenity/tree/WindowsJS2.0
  • https://github.com/abuneri/serenity/tree/windows-ladybird

Please do not comment on this issue unless you have something to contribute. This issue is one of the boss-issues - it will take time. Problems and goals will change, nothing is written in stone, provide code if you can.

updated list

  • [x] ~Some compiler flags are not compatible with clang-cl.~ (Meta/Windows: fix compilation flags for clang-cl #77)
  • [X] We need a package manager to handle building 3rd parties (ICU, fontconfig?, Skia, WABT, more?)
  • [X] We need to find an alternative to fontconfig.
  • [ ] 'sys/time.h' not found
  • [ ] [[no_unique_address]] not supported (am I using a wrong compiler? I use MSVC 2022 and its clang-cl)
  • [ ] We need to pull code from previous attempts of this kind of work. (cherry-picks, rebase etc).
  • [ ] Need to understand how to run the commit linters on the local machine, as we don't want developers to spam the CI/CD with phantom builds, just to fix a typo on the commit log (yes, that is directed at me)

pheonixfirewingz avatar Oct 11 '24 20:10 pheonixfirewingz

[[no_unique_address]] is a known thing. In short because of compatibility it is a noop. On msvc and clang-cl which attempts to match cl, you need to use [[msvc::no_unique_address]]. See https://github.com/llvm/llvm-project/issues/49358 for reference. So to support it, realistically you need to do it C style with a macro that replaces the attribute depending on the compiler. Maybe some time in the future when MSVC decides to break ABI again this would be changed, but no clue when or even if that would happen.

R-Goc avatar Oct 11 '24 22:10 R-Goc

Planning on doing anything regarding pthreads? ./Meta/Lagom/CMakeLists.txt line 231 is explicitly looking for pthreads for windows. or is the project dependent on MinGW for the time being?

mozahzah avatar Mar 17 '25 19:03 mozahzah

This is already solved. There are no plans for mingw or cygwin support. For pthreads a library called pthreads-win32 or similar is used. You can look at vcpkg. Also a better place for questions is discord.

R-Goc avatar Mar 17 '25 20:03 R-Goc

I have a question

If this is Windows,will it support Windows 7,8,8.1,10 and 11? I think 7 is currently the minimum required for most modern apps to compile these days although this is changing as 7 extended updates and 8.1 is ended support,so 10 is required...

LeoKids avatar May 07 '25 18:05 LeoKids

When support happens, it will be most likely only Windows 10 & 11 that would be cared about, as the older OS's are not supported. I know when I did the initial work to get the build system working, I did not care for anything lower than 10, as I didn't have Windows 10 or lower installed to make sure it worked.

pheonixfirewingz avatar May 07 '25 18:05 pheonixfirewingz

I have no intention of helping to maintain support for EOL Windows versions in this (upstream) repository. If some company paying Microsoft for EOL enterprise support comes knocking with an engineer and patches, that's different, though.

ADKaster avatar May 07 '25 23:05 ADKaster