Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to compile Ungoogled Chromium by the official instructions #3156

Closed
TCH68k opened this issue Jan 21, 2025 · 69 comments
Closed

Not possible to compile Ungoogled Chromium by the official instructions #3156

TCH68k opened this issue Jan 21, 2025 · 69 comments

Comments

@TCH68k
Copy link

TCH68k commented Jan 21, 2025

I found the instructions here: https://github.com/ungoogled-software/ungoogled-chromium/blob/master/docs/building.md

I've did before the instructions:

export PKG_CONFIG_PATH="$PKG_CONFIG_PATH"":/usr/lib/x86_64-linux-gnu/pkgconfig/:/opt/gtk3/lib/pkgconfig/"
export CPATH="$CPATH"":/opt/gtk3/include/gtk-3.0/:/opt/gtk3/include/gtk-3.0/unix-print/"
export PATH="$PATH"":""$HOME""/ungoogled-chromium/build/src/third_party/depot_tools/"
cd /root
git clone https://github.com/ungoogled-software/ungoogled-chromium/
cd ungoogled-chromium

Then i've performed as told:

mkdir -p build/download_cache
./utils/downloads.py retrieve -c build/download_cache -i downloads.ini
./utils/downloads.py unpack -c build/download_cache -i downloads.ini -- build/src
./utils/prune_binaries.py build/src pruning.list
./utils/patches.py apply build/src patches
./utils/domain_substitution.py apply -r domain_regex.list -f domain_substitution.list -c build/domsubcache.tar.gz build/src
mkdir -p build/src/out/Default
cd build/src
./tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles -j16 -o out/Default/
cat ../../flags.gn /u/ugc/flags.gn > out/Default/args.gn

Up to this point, everything worked. But then, when i executed ./out/Default/gn gen out/Default --fail-on-unused-args:

ERROR at //build/config/rust.gni:129:24: Script returned non-zero exit code.
      rustc_revision = exec_script("//tools/rust/update_rust.py",
                       ^----------
Current dir: /root/ungoogled-chromium/build/src/out/Default/
Command: python3 /root/ungoogled-chromium/build/src/tools/rust/update_rust.py --print-package-version
Returned 1 and printed out:

The expected Rust version is bca5fdebe0e539d123f33df5f2149d5976392e76-1-llvmorg-20-init-9764-gb81d8e90 but the actual version is None
Did you run "gclient sync"?

See //BUILD.gn:18:1: whence it was imported.
import("//build/config/rust.gni")
^-------------------------------

Okay, do gclient sync:

Running depot tools as root is sad.
Error: client not configured; see 'gclient config'

Okay, let's see gclient config:

Running depot tools as root is sad.
Usage: gclient.py config [options] [url]

gclient.py: error: Inconsistent arguments. Use either --spec or one or 2 args

I tried to look up this. I found this: http://stackoverflow.com/questions/8684282/gclient-runhooks-fails
By that topic, i saved the suggested content

solutions = [
  {
    "managed": False,
    "name": "src",
    "url": "https://chromium.googlesource.com/chromium/src.git",
    "custom_deps": {},
    "deps_file": ".DEPS.git",
    "safesync_url": "",
  },
]

to .gclient in build/src. Then did gclient sync. It worked, but it started to download Chromium and everything again. I thought that was done at

mkdir -p build/download_cache
./utils/downloads.py retrieve -c build/download_cache -i downloads.ini
./utils/downloads.py unpack -c build/download_cache -i downloads.ini -- build/src

Question is: when do i have to call gclient sync? And is it https://chromium.googlesource.com/chromium/src.git the correct value for the prop url in gclient?

@PF4Public
Copy link
Contributor

What is your OS, etc?

@TCH68k
Copy link
Author

TCH68k commented Jan 21, 2025

Whoops, sorry. It is Debian 11 on AMD64. Compilers available: GCC 10, CLang 19. Python is 3.9.2. Libc is 2.31. I don't know if there is anything else relevant.

@TCH68k
Copy link
Author

TCH68k commented Jan 21, 2025

Thanks for the links, but i did not find on these pages when i should call gclient sync and what is the correct value for the url prop. Any chance you would share your buildscript please? (Or any working buildscript. Or at least a tutorial with gclient usage.)

@PF4Public
Copy link
Contributor

Any chance you would share your buildscript please?

Here it is: https://github.com/PF4Public/gentoo-overlay/blob/master/www-client/ungoogled-chromium/ungoogled-chromium-132.0.6834.83_p1.ebuild :D But it is very Gentoo-specific.

I would suggest you follow the steps in PR mentioned, more specifically these: ungoogled-software/ungoogled-chromium-debian#328 (comment)

@TCH68k
Copy link
Author

TCH68k commented Jan 21, 2025

Thanks! Woof, this is six and a half times bigger than my original - now not working - buildscript for UGC 116. :D
But it contains no gclient call... What gclient sync is for anyway?

I've checked the Debian repo's script, but i am not sure if that is what i need. I am building a portable UGC, with no pulseaudio/gnome stuff and gtk3 included from an isolated - non system-wide - place.

@PF4Public
Copy link
Contributor

PF4Public commented Jan 21, 2025

In that case you may find https://github.com/ungoogled-software/ungoogled-chromium-portablelinux useful for you.

gclient is used if you're planning to pull the whole codebase via VCS from Google. It is superficial if you're just building it for yourself. Google publishes tarballs with all the sources you need for a build.

@TCH68k
Copy link
Author

TCH68k commented Jan 21, 2025

Yep, that was the first i've checked, but i do not get this docker stuff, i never used it. Will UGC run only from docker, or it is just for building?

Thanks, finally i know! So, i do not need gclient at all...but then, what happens when i call ./out/Default/gn gen out/Default --fail-on-unused-args? Why does it asks if i ran gclient sync? Or it is just another missing dependency what would be pulled with gclient, but can be obtained without it too?
What is that dependency? Rust is installed, Rust plugin for CLang installed...what does it miss? I found no Rust plugin for Python.

@PF4Public
Copy link
Contributor

or it is just for building?

just for building

I am building a portable UGC, with no pulseaudio/gnome stuff and gtk3 included from an isolated - non system-wide - place.

You may combine the approaches in Debian repo with using the sysroot via use_sysroot=true to achieve that. Which is what ungoogled-chromium-portablelinux actually uses: https://github.com/ungoogled-software/ungoogled-chromium-portablelinux/blob/a002defa2bac341d719057b4d2a2dd9c5c3c26f9/flags.gn#L15. Besides you may glance through the build.sh there too.

what happens when i call

Let me quote the instructions you were following: # NOTE: flags.gn contains only a subset of what is needed to run the build. # If you have additional GN flags to add, make sure to add them now.. This is a common repository, which mostly contains common code for every platform. You'll need additional flags in order to make it all work. See for example Arch: https://github.com/ungoogled-software/ungoogled-chromium-archlinux/blob/32be5fe087d77b2bbb79b76fddc5936ab186f355/PKGBUILD#L190-L210 or macOS: https://github.com/ungoogled-software/ungoogled-chromium-macos/blob/master/flags.macos.gn. You will need additional flags. Good starting point in this regard for you might be Debian Chromium build rules. And also do not forget the fine manual, which comes into play at the 6th step of ungoogled-chromium instructions you mentioned.

@TCH68k
Copy link
Author

TCH68k commented Jan 22, 2025

I know the flags must be filled, i just forgot to share my flags.gn, sorry about that. This is used in cat ../../flags.gn /u/ugc/flags.gn > build/src/out/Default/args.gn:

is_official_build=true
is_chrome_branded=false
is_chrome_for_testing=false
is_chrome_for_testing_branded=false

is_clang=true
is_component_build=false
optimize_webui=true

is_debug=false
symbol_level=0
blink_symbol_level=0
v8_symbol_level=0
v8_enable_backtrace=false
enable_iterator_debugging=false
blink_enable_generated_code_formatting=false

dcheck_always_on=false
is_cfi=false
use_thin_lto=false
angle_build_tests=false
build_dawn_tests=false
build_libsrtp_tests=false
enable_assistant_integration_tests=false
enable_downstream_media_tests=false
enable_nocompile_tests=false
enable_perfetto_integration_tests=false
enable_perfetto_unittests=false
enable_soda_integration_tests=false
force_enable_fieldtrial_testing_config=false
internal_gles2_conform_tests=false
internal_khronos_glcts_tests=false
rtc_include_tests=false
skia_enable_skshaper_tests=false
tint_build_unittests=false
use_base_test_suite=false
use_rts=false

use_gnome_keyring=false
use_pulseaudio=false
link_pulseaudio=false
use_alsa=true
use_cups=true
use_goma=false
use_kerberos=false
use_gio=true
use_sysroot=false
enable_vr=false
use_bluez=true

enable_ffmpeg_video_decoders=true
media_use_ffmpeg=true
proprietary_codecs=true
ffmpeg_branding="Chrome"
use_webaudio_ffmpeg=true
use_webaudio_pffft=false
enable_dav1d_decoder=false
rtc_include_dav1d_in_internal_decoder_factory=false
enable_av1_decoder=true
enable_libaom=true
use_libgav1_parser=true

use_vaapi=false
use_vaapi_x11=false

ozone_auto_platforms=false
ozone_platform="x11"
ozone_platform_cast=false
ozone_platform_drm=false
ozone_platform_flatland=false
ozone_platform_gbm=false
ozone_platform_headless=false
ozone_platform_scenic=false
ozone_platform_wayland=false
ozone_platform_x11=true
use_ozone=true

use_gtk=true
use_aura=true
use_qt=false

use_sysroot is false in this flaglist, but there must be a reason for that, because this list was suitable to build UGC 116 without pulse/gnome and with the isolated gtk3, when it came out. (I still use that.) And i think i made it by the Debian rules and my buildscript which i used then was based on the build instructions you've linked.
And all the prerequisites listed there are installed. What can be this error message about the lack of Rust then?

@TCH68k
Copy link
Author

TCH68k commented Jan 23, 2025

In the meantime i found that the mentioned version (bca5fdebe0e539d123f33df5f2149d5976392e76-1-llvmorg-20-init-9764-gb81d8e90) refers to this Rust commit: https://fuchsia.googlesource.com/third_party/rust/+/bca5fdebe0e539d123f33df5f2149d5976392e76

But why does the buildsystem even need Rust? And even if this version is not available in Debian 11, why does it report that the available version is None, if it is installed? A Python module is missing?

@PF4Public
Copy link
Contributor

But why does the buildsystem even need Rust?

Chromium has some code written in Rust since several major versions ago.

@TCH68k
Copy link
Author

TCH68k commented Jan 24, 2025

Okay, but what does it miss now? Why cannot it see Rust? What should i install, or do to debug this? Setting enable_rust to false did not work.

@PF4Public
Copy link
Contributor

You're missing additional platform-specific patches. What I've written about flags also applies to patches. In this particular case you're missing this one: https://salsa.debian.org/chromium-team/chromium/-/blob/master/debian/patches/disable/clang-version-check.patch, but there might be others that you also need to apply.

Please keep in mind, that what we are discussing has nothing to do with ungoogled-chromium patches and as such does not fit as an issue report for this repository.

@TCH68k
Copy link
Author

TCH68k commented Jan 25, 2025

I see, thanks. I put this code into my script, right after cd build/src and before ./tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles -j16 -o out/Default/:

for D in bullseye disable fixes system
do
	for F in `ls -1 '../../deb-patches/chromium/debian/patches/'"$D"'/'`
	do
		echo
		echo 'Patching: '"$D"'/'"$F"
		echo
		patch -p1 < '../../deb-patches/chromium/debian/patches/'"$D"'/'"$F"
	done
done

And of course i cloned down https://salsa.debian.org/chromium-team/chromium to deb-patches in the main directory. (/root/ungoogled-chromium)
The result is the same. No difference. I've double checked tools/clang/scripts/update.py and it has been patched (False instead of PACKAGE_VERSION != stamp_version) and still no change. But now as i grep-ed for 'Did you run "gclient sync"?', it hit me, that this patch patched a different file than the error reporting comes from. (tools/clang/scripts/update.py instead of tools/rust/update_rust.py) After i've replaced stamp_version != GetRustClangRevision() to False in line 97 (and removed the unused args), /out/Default/gn gen out/Default --fail-on-unused-args finished successfully...but i have no idea if this was this simple or the compilation will fail because of this. Just because a similar bug was averted like this in a different script, it is not guaranteed that it will work here too.

Why not? I am having issues with building it. :P
Jokes aside, where i could turn to? At least you guys help me. (For which i am really grateful.) You've helped me with building v116 too. But v116 now no longer works with Github; it throws HTTP 422 errors into the console when i try to comment or open a new ticket. I need to updgrade and the only place i know i can ask about Ungoogled Chromium is this.

Well, i am off to build UGC. Wish me luck... (And thanks for the help.)

@TCH68k
Copy link
Author

TCH68k commented Jan 25, 2025

As i feared, it was not a solution to switch off the Rust-detecting. ninja -C out/Default chrome chromedriver chrome_sandbox dies with this error message:

ninja: error: '../../third_party/rust-toolchain/bin/bindgen', needed by 'gen/base/logging_log_severity_bindgen_generator/bindings.rs', missing and no known rule to make it

@TCH68k
Copy link
Author

TCH68k commented Jan 25, 2025

I've installed bindgen and symlinked it: ln -s /usr/bin/bindgen /root/ungoogled-chromium/build/src/third_party/rust-toolchain/bin/bindgen
It allowed the process to continue, but then it failed by another problem:

ninja: error: '../../third_party/llvm-build/Release+Asserts/lib/clang/20/lib/linux/libclang_rt.builtins-x86_64.a', needed by 'obj/third_party/protobuf/libprotoc_lib.a', missing and no known rule to make it

What does this mean? Why does not it use the system's CLang/LLVM stuff? CLang/LLVM 20 is installed.

@TCH68k
Copy link
Author

TCH68k commented Feb 5, 2025

Any idea what can be the problem?

@PF4Public
Copy link
Contributor

Why does not it use the system's CLang/LLVM stuff?

you need another patch for that, I suppose

@TCH68k
Copy link
Author

TCH68k commented Feb 6, 2025

But i've already applied all patches from this repository found in the subdirs of bullseye, disable, fixes and system. Which other directories should be applied?
I can tell, that bookworm, i386 and ppc64le should not and i assume that ungoogled should not, since i cloned your repository, so it is already ungoogled.

I am not sure about debianization. There is a CLang patch inside, but all it does is setting -fuse-ld= from lld to lld-19. This is unnecessary, since lld is a symlink to lld-19 here. The rest of this directory seems irrelevant.

What do i miss?

@TCH68k
Copy link
Author

TCH68k commented Feb 17, 2025

Any idea? Who can help me with this?

@PF4Public
Copy link
Contributor

Any idea?

I might have an idea should I see more than a single error line. Sometimes it is indicative what happens moments before the error. Ideally the whole build log of course.

@TCH68k
Copy link
Author

TCH68k commented Feb 18, 2025

Got it. On thursday, i think i can do another test-build.

@TCH68k
Copy link
Author

TCH68k commented Feb 20, 2025

Okay, both my current "buildscript" (renamed to txt) and it's result are attached.

Edit: My extra flags are also attached.

error-2502201546.log

tb.txt

flags.txt

@PF4Public
Copy link
Contributor

Perhaps this patch might help you further: https://github.com/PF4Public/gentoo-overlay/blob/master/www-client/ungoogled-chromium/files/chromium-132-no-link-builtins.patch

Also take note that not all of the patches are applied, which might lead to problems later.

@TCH68k
Copy link
Author

TCH68k commented Feb 21, 2025

Unfortunately it changed nothing. Same error message as before.

I know that not all patches have been applied. I asked in one of my previous post, that which remaining patch directories i should use too. The only remaining ones which could be relevant are ungoogled which i suppose is not needed as i cloned this repository, so it should be already "ungoogled" and debianization which seemingly contain irrelevant patches.
Just to be sure, i added that two directories to the list and gave it another run. Nothing has changed. (There were som rejections, i guess because of patching something which was already there, due to the usage of the already "ungoogled" repository.)

@PF4Public
Copy link
Contributor

Are you sure you need to do the bootstrapping of gn? I couldn't find that step in Debian's rules file.

@TCH68k
Copy link
Author

TCH68k commented Feb 22, 2025

No, i am not sure. I copied the instructions from here: https://github.com/ungoogled-software/ungoogled-chromium/blob/master/docs/building.md, and it says: "5. Build GN. If you are using depot_tools to checkout Chromium or you already have a GN binary, you should skip this step."
I am not sure, if i use depot_tools to do the checkout (i doubt it, since i followed the instructions from this page and the first step suggests that i do not, because "In most of our supported platforms, we instead use a custom tool to do this.", so, it has probably been done via ./utils/downloads.py), but i do not think i already have a GN binary. Where would i have it? command -v gn gives back an empty string and i do not think the repos would provide a binary, for that would be OS/CPU-dependent.

@PF4Public
Copy link
Contributor

@TCH68k I would suggest you try building vanilla Chromium on Debian first (with which I cannot help you) and after that return to building ungoogled-variant.

@TCH68k
Copy link
Author

TCH68k commented Feb 24, 2025

Okay. Any hint about who can?

@TCH68k
Copy link
Author

TCH68k commented Feb 26, 2025

Sorry, but i have no experience with either Rust, or Chromium's codebase, and only a very little with Python. I am not sure, what am i doing; it is like assembling a truck, blindfolded. I thought you meant i should search in the source file you've linked.

The patches, you've enlisted did not change anything if applied. If i set enable_rust to false, then the build cannot even start, as ./out/Default/gn gen out/Default --fail-on-unused-args fails with this error message:

ERROR at //build/rust/cargo_crate.gni:436:24 (//build/toolchain/linux:clang_x64_for_rust_host_build_tools): Undefined identifier
        rebase_path("${rust_sysroot}/bin", root_build_dir),
                       ^-----------
See //third_party/rust/proc_macro2/v1/BUILD.gn:11:1: whence it was called.
cargo_crate("lib") {
^-------------------
See //build/rust/chromium_prelude/BUILD.gn:25:7: which caused the file to be included.
      "//third_party/rust/proc_macro2/v1:lib",
      ^--------------------------------------
ninja: Entering directory `out/Default'
ninja: error: loading 'build.ninja': No such file or directory

I applied that two patches too, what i've found, but no change in either case.

@PF4Public
Copy link
Contributor

ERROR at //build/rust/cargo_crate.gni:436:24 (//build/toolchain/linux:clang_x64_for_rust_host_build_tools): Undefined identifier
rebase_path("${rust_sysroot}/bin", root_build_dir),

https://github.com/PF4Public/gentoo-overlay/blob/master/www-client/ungoogled-chromium/files/chromium-127-cargo_crate.patch

@TCH68k
Copy link
Author

TCH68k commented Feb 27, 2025

Thanks, that worked! I think we have advanced to a next part in the buildscript, for now i've got a much lengthier error message about missing Rust dependencies. (Log attached.) I tried to search in the patchlist for files with names like "dependencies", "prelude", "toolchain", but no luck.

ugc-133-rust-deps-error.log

@PF4Public
Copy link
Contributor

PF4Public commented Feb 28, 2025

@TCH68k
Copy link
Author

TCH68k commented Mar 1, 2025

Thanks, it worked. Now, the error message is

ninja: error: '../../third_party/node/linux/node-linux-x64/bin/node', needed by 'gen/components/neterror/resources/bundled/neterror.rollup.js', missing and no known rule to make it

I swear i do not resist, (not even by one milliohm :P ), but what should i search for? For me it was not trivial that i need to look up "cloud_authenticator" and "qrcode". Yes, the log contained these as dependencies, but it also contained "clap_builder", "codespan_reporting" and "fend_core". How did you know, that you do not need to search for those? How did you know, that you should look only for the first two? I do not know this code base at all. Neither Rust, nor Python build environments.

For instance, now - based on the error message - i tried to search for "node", but it yielded zero patches related to nodejs. I even tried to search for "rollup" and "neterror", but neither of these queries brought up anything at all. :(

And i found no node-related patches among the patch files in the files directory either.

@TCH68k
Copy link
Author

TCH68k commented Mar 1, 2025

Okay, by linking /usr/bin/node to third_party/node/linux/node-linux-x64/bin/node manually, the error is gone and another came:

ninja: error: '../../third_party/devtools-frontend/src/node_modules/rollup3/dist/bin/rollup', needed by 'resources/inspector_overlay/main.js', missing and no known rule to make it

So, i installed the rollup package (and along with it, half the Debian repo... :( ) and after i made the dir and linked the rollup binary to it's place, finally the build has started! And failed immediately, because of bits/version.h did not exist in the C include directory.
I've found no information about this missing header file. Is this linux/version.h? I've symlinked it, but got a ton of other errors, so i do not know if it was it, or not.

Log attached. It seems, that for some reason it tries to use GCC 10's C++ stdlib, instead of CLang's.

ugc-build-errors.log

@PF4Public
Copy link
Contributor

not even by one milliohm :P

:D

How did you know, that you do not need to search for those?

Brute-force is an option if you don't know what to search for ;)

but what should i search for?
For instance, now - based on the error message - i tried to search for "node", but it yielded zero patches related to nodejs. I even tried to search for "rollup" and "neterror", but neither of these queries brought up anything at all. :(

third_party/node/linux/node-linux-x64/bin/node obviously :)

I do not know this code base at all. Neither Rust, nor Python build environments.

Guess what? I wasn't born with this knowledge either!

GCC 10's C++ stdlib

I remember I had issues building against gcc-13, switching to gcc-14 helped.

use_custom_libcxx=false forces it to use system libc/c++ try disabling those.

@TCH68k
Copy link
Author

TCH68k commented Mar 1, 2025

Brute-force is an option if you don't know what to search for ;)

Okay, then i think i will search for tits first, maybe i'll find some. :P

third_party/node/linux/node-linux-x64/bin/node obviously :)

That link also gave no hits at all. Wrong arguments, or was it a joke?

Guess what? I wasn't born with this knowledge either!

Sure, but you did not acquired it in a blink of an eye. And i only would like to compile and use Ungoogled Chromium, not developing it. :P

I remember I had issues building against gcc-13, switching to gcc-14 helped.

But i am building against CLang 19.

use_custom_libcxx=false forces it to use system libc/c++ try disabling those.

Okay, i took

use_custom_libcxx=false
use_custom_libcxx_for_host=false

out of flags.gn. Then it started to complain about bits/enable_special_members.h. (Log attached.) Which seems to be a GCC header. (libstdc++-10-dev:amd64 package: /usr/include/c++/10/bits/enable_special_members.h) I have it among GCC's headers. If i link it to bits/enable_special_members.h, then compiling yields a ton of syntax and other errors caused by that file.

I think the problem is, that while i use external CLang 19, it still tries to build against GCC's libc++, bundled or external.

ugc-133-build-errors2.log

@PF4Public
Copy link
Contributor

I think the problem is, that while i use external CLang 19, it still tries to build against GCC's libc++, bundled or external.

Yes, that is true. Your log is too short (for me) to diagnose it. It should use optional from Chromium sources, it uses your system's libstdc++ instead, hence the error.

That link also gave no hits at all. Wrong arguments, or was it a joke?

IDK, worksforme:

Image

i only would like to compile and use Ungoogled Chromium

I was thinking the same a long time ago, and eventually… I ended up here, haha

@TCH68k
Copy link
Author

TCH68k commented Mar 2, 2025

Yes, that is true. Your log is too short (for me) to diagnose it.

That was all the log i got from starting the build. But i attached the full log now, including the output of patching, etc. Perhaps one of the failed patches are the culprit?

It should use optional from Chromium sources, it uses your system's libstdc++ instead, hence the error.

optional? Is that something to set in flags.gn?

IDK, worksforme:

My bad, i had to login to be able to use that search link. However, it still gave no patches, just that one row highlighted in the buildscripts. (Also, for me, it was not obvious that i should search for the full path, not just the binary name. :/ )

I was thinking the same a long time ago, and eventually… I ended up here, haha

ROFL...well, true, but unlike me, at least you do know now, what to do.

ugc-133-build-errors2-full.log

@PF4Public
Copy link
Contributor

Perhaps one of the failed patches are the culprit?

I don't see a gn invocation. Each time you change flags, you need to call it again.

optional? Is that something to set in flags.gn?

This optional: https://en.cppreference.com/w/cpp/header/optional

it still gave no patches, just that one row highlighted in the buildscripts

Which says you need to create a symlink: ln -s

@TCH68k
Copy link
Author

TCH68k commented Mar 2, 2025

I don't see a gn invocation.

It is there:

ninja: Entering directory `/root/ungoogled-chromium/build/src/out/Release/gn_build'
[199/199] LINK gn
Done. Made 24091 targets from 3659 files in 14790ms
ninja: Entering directory `out/Default'

Each time you change flags, you need to call it again.

That's okay, i always redo the whole process from the patching. (I have a snapshot of the downloaded stuff in a .tar.xz.) Attached my current buildscript.

This optional: https://en.cppreference.com/w/cpp/header/optional

Oh. Then should not it use CLang 19's one from my system, instead of GCC's, or the bundled one in Chromium's source?

Which says you need to create a symlink: ln -s

I saw that, but i had no idea what ${EPREFIX} should be and why it is not set. But i symlinked my external binaries into their places anyway.

tb.txt

@PF4Public
Copy link
Contributor

PF4Public commented Mar 2, 2025

Oh. Then should not it use CLang 19's one from my system, instead of GCC's, or the bundled one in Chromium's source?

You don't need debian/patches/fixes/absl-optional.patch if you're building against builtin libc++

but i had no idea what ${EPREFIX} should be

Because it is Gentoo specific

@TCH68k
Copy link
Author

TCH68k commented Mar 3, 2025

Because it is Gentoo specific

Thanks, that is good to know.

You don't need debian/patches/fixes/absl-optional.patch if you're building against builtin libc++

Yes, thank you, that nailed it. No C/C++ compiler errors so far, but i've ran into a node.js problem. (Full log is attached.) Now, i do understand, that it cannot find the fs/promise node.js module, but why? I have node v12 and it is there since v10. (I've also installed everything fs and promise related from the node packages from the Debian repo, but no effect.)
I've found some infos on the net, which says that this can occur, when node cannot understand the syntax (old-new problem), but i found no patches in the UGC repository for this.

I so hope, that this is the last problem... (...and hope dies last.)

ugc-133-build-errors3.log

@PF4Public
Copy link
Contributor

but i found no patches in the UGC repository for this

Why would you expect ungoogled-chromium to fix this for you? 12 is almost two years old and not even LTS: https://nodejs.org/en/about/previous-releases. And even bookworm has 18: https://packages.debian.org/bookworm/nodejs

@TCH68k
Copy link
Author

TCH68k commented Mar 3, 2025

I did not expected anything. I've checked for patches, just in case. I don't know what Bookworm has, because i use Bullseye and Bullseye has 12. What is the minimum requirements considering nodejs' version?

@PF4Public
Copy link
Contributor

What is the minimum requirements considering nodejs' version?

To be honest, I have no idea. I'm building with 22, I think. Try updating to 18 first, maybe that is sufficient.

@TCH68k
Copy link
Author

TCH68k commented Mar 3, 2025

In the meantime, i downloaded the latest (23.9) and put into /opt. Did npm -g install rollup and linked both binaries to their place. It turned out, that rollup needed to linked to another place too: third_party/node/node_modules/rollup/dist/bin/rollup
I hope, that it will not fail, because rollup is version 4 and the path (third_party/devtools-frontend/src/node_modules/rollup3/dist/bin/rollup) suggests that v3 would be needed.

It then failed because terser was not installed. I installed it and continued. Now however, it failed again because of terser:

[2147/45180] ACTION //third_party/devtools-frontend/src/inspector_overlay:build_inspector_overlay(//build/toolchain/linux:clang_x64)
FAILED: resources/inspector_overlay/main.js
python3 ../../third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py main.js 82000 --input_path gen/third_party/devtools-frontend/src/inspector_overlay --output_path resources/inspector_overlay --rollup_plugin ../../third_party/devtools-frontend/src/inspector_overlay/loadCSS.rollup.js
Usage: ../../third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py filename_1 max_size_1 filename_2 max_size_2 ... filename_N max_size_N --input_path <input_path> --output_path <output_path>
Traceback (most recent call last):
  File "/root/ungoogled-chromium/build/src/out/Default/../../third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py", line 106, in <module>
    sys.exit(main(sys.argv))
  File "/root/ungoogled-chromium/build/src/out/Default/../../third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py", line 91, in main
    rollup(input_path, output_path, filename, max_size,
  File "/root/ungoogled-chromium/build/src/out/Default/../../third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py", line 66, in rollup
    raise Exception("rollup failed: " + error)
Exception: rollup failed: [!] Error: Cannot find entry for plugin "terser". The plugin needs to export a function either as "default" or "terser" for Rollup to recognize it.
    at loadAndRegisterPlugin (/opt/node.js/23.9.0/lib/node_modules/rollup/dist/shared/loadConfigFile.js:406:15)
    at async addPluginsFromCommandOption (/opt/node.js/23.9.0/lib/node_modules/rollup/dist/shared/loadConfigFile.js:347:21)
    at async Object.addCommandPluginsToInputOptions (/opt/node.js/23.9.0/lib/node_modules/rollup/dist/shared/loadConfigFile.js:332:5)
    at async loadConfigFromCommand (/opt/node.js/23.9.0/lib/node_modules/rollup/dist/bin/rollup:1743:5)
    at async getConfigs (/opt/node.js/23.9.0/lib/node_modules/rollup/dist/bin/rollup:1825:12)
    at async runRollup (/opt/node.js/23.9.0/lib/node_modules/rollup/dist/bin/rollup:1793:43)

I am not familiar with node.js. What is this export problem can be?

BTW, is there any way i can tell the process, how many threads it should use for compiling? Maybe it can do it faster if i give it more cores.

Edit: I've installed rollup v3.29.4, thinking maybe v4 is the cause, but nothing changed.

Edit 2: Okay, it was not terser, but rollup's plugin-terser.

@TCH68k
Copy link
Author

TCH68k commented Mar 4, 2025

Compilation almost reached 60%, when two errors occurred. I attached the surrounding log of those errors, but here are the two exact error lines:

../../third_party/blink/renderer/platform/fonts/font_face_creation_params.h:71:9: error: no matching constructor for initialization of 'std::optional<std::string>' (aka 'optional<basic_string<char>>')
../../third_party/blink/renderer/platform/fonts/font_face_creation_params.h:87:12: error: no viable conversion from returned value of type 'const value_type' (aka 'const std::string') to function return type 'const WTF::String'

I do not know WTF this WTF type is, but it surely has stopped compilation. :P Perhaps this patch i applied is the cause? (https://github.com/PF4Public/gentoo-overlay/blob/master/www-client/ungoogled-chromium/files/font-gc-r4.patch)

Edit: Seems so, restored the original file and the build continues.

ugc-133-build-errors4.log

@TCH68k
Copy link
Author

TCH68k commented Mar 4, 2025

The compilation is nearly done, but with the fonts, another error has came up (full error log attached):

../../third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc:214:36: error: no member named 'Utf8' in 'std::string'

I tried to search for this file, but all the patches it shown are not applied here. Despite this, there is a third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc.orig, which means it is patched and the difference is exactly the .Utf8() call.
For now, i will restore the original one, but i assume, that is not the proper way of fixing it. I guess converting these entities from std::string to WTF::String would be, but currently, the compiler throws a WTF, if meets a WTF. :P

ugc-133-build-errors5.log

@TCH68k
Copy link
Author

TCH68k commented Mar 4, 2025

And another two error occurred. (Log attached.) This time these:

../../third_party/blink/renderer/platform/audio/fft_frame_stub.cc:38:3: error: use of undeclared identifier 'NOTREACHED'
../../third_party/blink/renderer/platform/audio/fft_frame_stub.cc:64:16: error: out-of-line definition of 'Initialize' does not match any declaration in 'blink::FFTFrame'

Searching for FFTFrame or fft_frame_stub.cc gives no result and searching for NOTREACHED only gives irrelevant patches.

Compilation is around 94% done. (47179 / 50413)

ugc-133-build-errors6.log

@PF4Public
Copy link
Contributor

is there any way i can tell the process, how many threads it should use for compiling?

https://ninja-build.org/manual.html#_running_ninja:~:text=ninja%20%2Dh%20prints%20help%20output.%20Many%20of%20Ninja%E2%80%99s%20flags%20intentionally%20match%20those%20of%20Make%3B%20e.g%20ninja%20%2DC%20build%20%2Dj%2020%20changes%20into%20the%20build%20directory%20and%20runs%2020%20build%20commands%20in%20parallel.%20(Note%20that%20Ninja%20defaults%20to%20running%20commands%20in%20parallel%20anyway%2C%20so%20typically%20you%20don%E2%80%99t%20need%20to%20pass%20%2Dj.)

I do not know WTF this WTF type is, but it surely has stopped compilation.

As you've found out, you don't need it too if you're building with clang and libc++. I'm happy to see you progressing!

which means it is patched and the difference is exactly the .Utf8() call.

I guess it wasn't cleanly reverted.

../../third_party/blink/renderer/platform/audio/fft_frame_stub.cc:38:3: error: use of undeclared identifier 'NOTREACHED'

Interesting why you encountered this. Perhaps your flag combination. Looks similar to https://issues.chromium.org/issues/40702940. Try adding #include "base/check_op.h" and #include "base/notreached.h" similarly to their fix in https://chromium-review.googlesource.com/c/chromium/src/+/2283215

@TCH68k
Copy link
Author

TCH68k commented Mar 4, 2025

https://ninja-build.org/manual.html#_running_ninja:~:text=ninja%20%2Dh%20prints%20help%20output.%20Many%20of%20Ninja%E2%80%99s%20flags%20intentionally%20match%20those%20of%20Make%3B%20e.g%20ninja%20%2DC%20build%20%2Dj%2020%20changes%20into%20the%20build%20directory%20and%20runs%2020%20build%20commands%20in%20parallel.%20(Note%20that%20Ninja%20defaults%20to%20running%20commands%20in%20parallel%20anyway%2C%20so%20typically%20you%20don%E2%80%99t%20need%20to%20pass%20%2Dj.)

Thanks. I wonder how many was the default.

As you've found out, you don't need it too if you're building with clang and libc++. I'm happy to see you progressing!

Me too, lol! Jokes aside, i have more experience with C/C++, so at least i can start somewhere. I had no idea what to do, when it was about the Rust or Python ecosystems/dependencies.

Interesting why you encountered this. Perhaps your flag combination. Looks similar to https://issues.chromium.org/issues/40702940. Try adding #include "base/check_op.h" and #include "base/notreached.h" similarly to their fix in https://chromium-review.googlesource.com/c/chromium/src/+/2283215

Yep, i figured out that in the meantime, that by putting #include "base/notreached.h" into third_party/blink/renderer/platform/audio/fft_frame_stub.cc, the NOTREACHED problem is solved. And by commenting out the incriminated 64th line (void FFTFrame::Initialize() {} which was an empty stub anyway), so is the Initialize one. But i am not sure about this latter one.

And now another font one (log attached):

../../third_party/blink/renderer/platform/fonts/linux/font_cache_linux.cc:115:21: error: no matching constructor for initialization of 'FontFaceCreationParams'

And once again, there is a third_party/blink/renderer/platform/fonts/linux/font_cache_linux.cc.orig there, which differs from the patched file in this. Reverted again, solved again. I think this too was not reverted, if it was supposed to.

ugc-133-build-errors7.log

@TCH68k
Copy link
Author

TCH68k commented Mar 4, 2025

And as i was afraid, commenting out void FFTFrame::Initialize() {} was a bad idea:

[2677/2681] LINK ./v8_context_snapshot_generator
FAILED: v8_context_snapshot_generator
"python3" "../../build/toolchain/gcc_link_wrapper.py" --output="./v8_context_snapshot_generator" -- /usr/bin/clang++ -fuse-ld=lld-19 -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--icf=all -Wl,--color-diagnostics -Wl,--undefined-version -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -Wl,-z,defs -Wl,--as-needed -nostdlib++ -rdynamic -pie -Wl,--disable-new-dtags -Wl,--icf=none -o "./v8_context_snapshot_generator" -Wl,--start-group @"./v8_context_snapshot_generator.rsp" -Wl,--end-group   -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4 -ldbus-1 -latomic -lresolv -lgio-2.0 -lexpat -luuid -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrender -lXrandr -lXtst -lxcb -lxkbcommon -lgbm -lXi -lpci -latk-1.0 -latk-bridge-2.0 -ludev -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lcairo -lasound -lm -lz -latspi -Wl,--start-group  -Wl,--end-group
ld.lld-19: error: undefined symbol: blink::FFTFrame::Initialize(float)
>>> referenced by base_audio_context.cc
>>>               webaudio/base_audio_context.o:(blink::BaseAudioContext::Initialize()) in archive obj/third_party/blink/renderer/modules/webaudio/libwebaudio.a

ld.lld-19: error: undefined symbol: blink::FFTFrame::MinFFTSize()
>>> referenced by hrtf_panner.cc
>>>               platform/hrtf_panner.o:(blink::HRTFPanner::HRTFPanner(float, unsigned int, blink::HRTFDatabaseLoader*)) in archive obj/third_party/blink/renderer/platform/libblink_platform.a
>>> referenced by hrtf_panner.cc
>>>               platform/hrtf_panner.o:(blink::HRTFPanner::HRTFPanner(float, unsigned int, blink::HRTFDatabaseLoader*)) in archive obj/third_party/blink/renderer/platform/libblink_platform.a
>>> referenced by hrtf_panner.cc
>>>               platform/hrtf_panner.o:(blink::HRTFPanner::HRTFPanner(float, unsigned int, blink::HRTFDatabaseLoader*)) in archive obj/third_party/blink/renderer/platform/libblink_platform.a
>>> referenced 4 more times
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

If commented out, linking fails, if not, compilation fails. Yay... :(

../../third_party/blink/renderer/platform/audio/fft_frame_stub.cc:65:16: error: out-of-line definition of 'Initialize' does not match any declaration in 'blink::FFTFrame'
   65 | void FFTFrame::Initialize() {}
      |                ^~~~~~~~~~

@TCH68k
Copy link
Author

TCH68k commented Mar 4, 2025

Okay, from third_party/blink/renderer/platform/audio/pffft/fft_frame_pffft.cc, it turned out, that instead of commenting out, it needed to change from

void FFTFrame::Initialize() {}

to

void FFTFrame::Initialize(float sample_rate) {}

unsigned FFTFrame::MinFFTSize() {}

and now chrome is finally linked and running! (I hope this will not cause crashes or something similarly unpleasant.)

I will try to package it now.

@TCH68k
Copy link
Author

TCH68k commented Mar 4, 2025

It does work! And i managed to run Manifest v2 extensions too! FTR there are the flags to set:

Enable:
chrome://flags/#allow-legacy-mv2-extensions

Disable
chrome://flags/#extension-manifest-v2-deprecation-unsupported
chrome://flags/#extension-manifest-v2-deprecation-warning
chrome://flags/#extension-manifest-v2-deprecation-disabled

But strangely, commenting here on GitHub still does not work and neither the CloudFlare botchecking widget GitLab uses. I had disabled all my extensions and even /etc/hosts and they still do not work. But neither they do from UGC 116, so something else it must be, than Chromium.

Anyway, finally we're done.

@PF4Public: Thank you very much for your enormous amount of help and patience! I really appreciate it: i could never compile UGC without you.

@TCH68k TCH68k closed this as completed Mar 4, 2025
@PF4Public
Copy link
Contributor

But strangely, commenting here on GitHub still does not work and neither the CloudFlare botchecking widget GitLab uses. I had disabled all my extensions and even /etc/hosts and they still do not work. But neither they do from UGC 116, so something else it must be, than Chromium.

have you tried empty profile? perhaps the migration from such an old version didn't go well

@TCH68k
Copy link
Author

TCH68k commented Mar 5, 2025

I tried it now. Still does not work. It throws HTTP 422 errors unto the console upon previewing or commenting. verified-fetch.ts:25 But both in UGC 116 and 133 with empty profile and no extensions. Edit: Weird, if i copy the script's address from the console, then the link i get points to a 404. Even weirder, i can download it, but if i put it into the adddress bar, then 404. Attached it instead.

Edit: And as for CloudFlare, i attached a screenshot. But i am sure, this is not a bug of UGC. The Pale Moon guys also complaining of CF deliberately running malicious code to crash PM. (And any kind of browser they do not want to let in; including Chome-based ones with not the "proper" user-agent.)

verified-fetch.txt

Image

@TCH68k
Copy link
Author

TCH68k commented Mar 5, 2025

I've figured out what was the cause of GitHub's 422 errors in both UGC 116 and 133: the --disable-web-security flag. If i run them without that flag, then i can comment on GitHub. GitHub changed something recently, because before that, it worked with this flag too.

Sadly CloudFlare still does not work in either. I tried to remove other flags, but no effect. It still gives an infinite check-circle-check-circle-etc. process in 116 and instantly a dead computer icon in 133. But i am cent-percent sure, that it is CF's fault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants