ungoogled-software / ungoogled-chromium

Google Chromium, sans integration with Google
BSD 3-Clause "New" or "Revised" License
20.76k stars 843 forks source link

Cross-compiling to Windows #1140

Open HarukaMa opened 4 years ago

HarukaMa commented 4 years ago

Is your feature request related to a problem? Please describe. I was trying to cross-compile a Windows version of ungoogled chromium, but it seems that currently all patches was targeted to native, ungoogled-software build procedures.

Specifically, Windows platform patches was trying to patch some files which was not present when the code was checked out by gclient, and some patches directly assumes that the compiling process is running on Windows. Also, .tlb files are pruned but expected to be rebuilt using midl on Windows, but that is just not possible on other platforms.

Describe the solution you'd like Somehow make the project cross-compile friendly. Could be quite difficult though.

Describe alternatives you've considered State that cross-compiling is just not possible somewhere?

Additional context I'm having a feeling this is just not possible as tlb pruning effectively is preventing cross-compiling to windows from working. Didn't try cross-compiling to linux though.

PF4Public commented 4 years ago

As far as I know, clang could theoretically compile native Windows binaries inside Linux, provided that it has access to Windows libraries and headers.

HarukaMa commented 4 years ago

I was able to compile a Windows version on macOS after following official Chromium document and manually copying over removed .tlb files and downloading some tools from CIPD. It seems that more manual intervention is needed when using ungoogled-software download methods as it doesn't run those hooks in DEPS and some tools required to cross compile in thirdparty/ is missing.

Eloston commented 4 years ago

So if it is possible on macOS, is it also possible on Linux? How about macOS on Linux?

ghost commented 4 years ago

It is possible to cross-compile win32 and win64 binaries from Linux via mingw but it requires effort relative to the size of the project and its dependencies and only supports GCC AFAIK. Does upstream even support cross-compiling?

HarukaMa commented 4 years ago

According to https://chromium.googlesource.com/chromium/src.git/+/master/docs/win_cross.md, there should not be any problem for chromium itself if using completely vanilla chromium code.

There was only one thing to modify when I was cross compiling (nul -> /dev/null) on the upstream code, all other issues come from ungoogled chromium unfortunately.

Eloston commented 4 years ago

This could be an interesting endeavor. We can open another issue on ungoogled-chromium-windows to fix any issues there.

What problems would we need to fix here?