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

Troubleshooting ungoogled-chromium Build on Ubuntu 22.04 #341

Open
saaraahfar opened this issue Feb 11, 2024 · 2 comments
Open

Troubleshooting ungoogled-chromium Build on Ubuntu 22.04 #341

saaraahfar opened this issue Feb 11, 2024 · 2 comments

Comments

@saaraahfar
Copy link

saaraahfar commented Feb 11, 2024

I'm working on setting up ungoogled-chromium on a fresh Ubuntu 22.04.3 LTS (Jammy Jellyfish) install, and I'm running into a couple of roadblocks. Any help would be greatly appreciated!

  1. Compiler Dependencies Missing

Initially, I hit a snag with missing compiler dependencies, getting an error about "Unmet build dependencies" from dpkg-checkbuilddeps. Thankfully, with some guidance from the community, I was able to add the necessary LLVM repository to get 'clang-16', 'lld-16', and their related development packages.

  1. Current Build Error - Invalid Substitution Type

After sorting out the dependencies, a new error cropped up during the build process:

ERROR at //build/nocompile.gni:149:9: Invalid substitution type.
        args += [ "{{cflags}}" ] 

It seems the substitution {{cflags}} isn't appropriate for something working on a source file like this. I've checked the build script at //third_party/blink/renderer/platform/BUILD.gn:2013:3 but couldn't pinpoint the issue.

Steps Taken:

  • Followed the installation instructions provided by ungoogled-chromium.
  • Successfully added the LLVM repository to install the required compiler toolchain.
  • Tried clean rebuilds after sorting out dependencies.

System Information:

  • OS: Ubuntu 22.04.3 LTS (Jammy Jellyfish)
  • Kernel: 6.1.58+
@iskunk
Copy link
Contributor

iskunk commented Feb 13, 2024

Hello @saaraahfar,

There are a number of steps involved in getting (ungoogled-)chromium to build on Ubuntu jammy, I'm afraid, of which installing clang-16 et al. is only one. The "Invalid substitution type" error is due to jammy's older version of GN.

@jhonny-oliveira and I have been building Chromium on jammy (and later) for the XtraDeb PPA, and the short answer would be to point you to the script we maintain that applies most of the necessary changes automatically. The script, and its associated patches, should be commented in enough detail to serve as documentation for the changes. But I am happy to answer questions, if needed.

Note that this script operates on the Debian (sid/unstable) version of the Chromium source tree, not the Google upstream source. If you wish to build the upstream source, then you'll need to adapt the changes. And either way, the ungoogled-chromium changes remain an entirely separate matter. This repo has a framework to apply them cleanly to the Debian patched source, under the convert/ subdirectory.

Also, as of Chromium 121, in addition to clang-16, you will need a newer nodejs package than what jammy has available, or else you'll get this error:

FAILED: gen/chrome/browser/resources/new_tab_page_instant/tsconfig_build_ts.json gen/chrome/browser/resources/new_tab_page_instant/build_ts_manifest.json gen/chrome/browser/resources/new_tab_page_instant/tsc/most_visited_title.js 
python3 ../../tools/typescript/ts_library.py --root_gen_dir ../../../.. --root_src_dir ../../../../../../../ --root_dir gen/chrome/browser/resources/new_tab_page_instant/preprocessed --gen_dir gen/chrome/browser/resources/new_tab_page_instant --out_dir gen/chrome/browser/resources/new_tab_page_instant/tsc --output_suffix build_ts --in_files most_visited_title.ts --definitions ../../../../../../../chrome/browser/resources/new_tab_page_instant/embedded_search.d.ts --path_mappings /tools/typescript/definitions/\*\|../../../../../../../tools/typescript/definitions/\*
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/out/Release/../../tools/typescript/ts_library.py", line 283, in <module>
    main(sys.argv[1:])
  File "/<<PKGBUILDDIR>>/out/Release/../../tools/typescript/ts_library.py", line 245, in main
    node.RunNode([
  File "/<<PKGBUILDDIR>>/third_party/node/node.py", line 34, in RunNode
    raise RuntimeError('Command \'%s\' failed\n%s' % (' '.join(cmd), err))
RuntimeError: Command '/<<PKGBUILDDIR>>/third_party/node/linux/node-linux-x64/bin/node /<<PKGBUILDDIR>>/third_party/devtools-frontend/src/node_modules/typescript/bin/tsc --project gen/chrome/browser/resources/new_tab_page_instant/tsconfig_build_ts.json' failed
/<<PKGBUILDDIR>>/third_party/devtools-frontend/src/node_modules/typescript/lib/tsc.js:93
  for (let i = startIndex ?? 0; i < array.length; i++) {
                           ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/<<PKGBUILDDIR>>/third_party/devtools-frontend/src/node_modules/typescript/bin/tsc:2:1)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

As it happens, this is a very recent development---I've been working on it the past few days, and just yesterday uploaded the necessary packages to this section of the XtraDeb PPA. The Node.js-related packages are taken from lunar, and four out of the five need minor modifications to build on jammy (which are recorded in a separate script in the aforementioned xtradeb-convert repo).

And with all that said... if you are more intent on obtaining the latest ungoogled-chromium for Ubuntu rather than necessarily building it yourself, the XtraDeb repo should have it soon. The Node.js issue threw us for a loop, and we missed an update, but we are getting back on top of it again.

@iskunk
Copy link
Contributor

iskunk commented Feb 20, 2024

@saaraahfar, were you able to get your build working?

The XtraDeb "apps" PPA now has ungoogled-chromium 121.0.6167.160 packages available, if you are amenable to using an existing build.

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