ungoogled-software / ungoogled-chromium

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

Mesa-related segmentation fault on Arch #540

Closed maxbla closed 5 years ago

maxbla commented 6 years ago

ungoogled-chromium version: 69.0.3497.100-3

Configuration and/or platform(s): Arch Linux, AMDGPU driver

Problem description

After installing ungoogled chromium from the aur (I tried both compiling for myself and the binary), I get the following error message:

$ chromium
mesa: for the -simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the -global-isel-abort option: may only occur zero or one times!
[3417:3417:0930/184129.266980:ERROR:sandbox_linux.cc(379)] InitializeSandbox() called with multiple threads in process gpu-process.
Segmentation fault (core dumped)

I ran pacman -Syu, then restarted my computer in an attempt to remedy the problem, but it didn't help. googled (aka normal) chromium 69.0.3497.100-1 from the official repositories runs properly. What additional information could I provide to help in diagnosing this problem?

Eloston commented 6 years ago

69.0.3497.100-3

This version doesn't exist. Do you mean 69.0.3497.100-2?

What additional information could I provide to help in diagnosing this problem?

Unless someone knows what those Mesa errors mean, we would probably need to use a debug build to get a stack trace and possibly use gdb. I believe setting is_debug=true GN flag should be sufficient (it's false by default in the PKGBUILD).

maxbla commented 6 years ago

This version doesn't exist. Do you mean 69.0.3497.100-2?

The version number listed on the AUR here is 69.0.3497.100-3

I'll run chromium --version when I am back at my home computer to see what the real version number is.

I believe setting is_debug=true GN flag should be sufficient (it's false by default in the PKGBUILD)

Where do I put is_dubug=true in the PKGBUILD? It appears as if gn is a google-specific build tool, and I don't know how to use it.

Eloston commented 6 years ago

The version number listed on the AUR here is 69.0.3497.100-3

That isn't maintained by us. The PKGBUILD maintained by us is available simply as ungoogled-chromium.

Where do I put is_dubug=true in the PKGBUILD? It appears as if gn is a google-specific build tool, and I don't know how to use it.

You need to build from source using the PKGBUILD generated from our build instructions, or the PKGBUILD from ungoogled-chromium in the AUR.

maxbla commented 6 years ago

Sorry for the confusion.

I initially installed ungoogled-chromium 69.0.3497.100-2, encountered the runtime error, then installed ungoogled-chromium-bin 69.0.3497.100-3 in the hopes that my toolchain was the issue. I had the same error message with the *-bin distribution as the source ungoogled-chromium package on the AUR.

I am now looking through ungoogled-chromium's PKGBUILD from a computer where ungoogled-chromium is not installed and I don't know where to add is_dubug=true

Eloston commented 6 years ago

I am now looking through ungoogled-chromium's PKGBUILD from a computer where ungoogled-chromium is not installed and I don't know where to add is_dubug=true

Replacing the only instance of is_debug=false to is_debug=true should work. Though, I'm not sure if the debug symbols will be included in the final package or not; you might have to run the browser from the build output directory.

maxbla commented 6 years ago

Hm... can you give me a line number? My pkgbuild looks like this.

# Maintainer: Seppia <REDACTED>
# Contributors: Eloston
# Derived from official Chromium and Inox PKGBUILDS and ungoogled-chromium buildkit

pkgname=ungoogled-chromium
pkgver=69.0.3497.100
pkgrel=2
_launcher_ver=6
pkgdesc="Modifications to Google Chromium for removing Google integration and enhancing privacy, control, and transparency"
arch=('x86_64')
url="https://github.com/Eloston/ungoogled-chromium"
license=('BSD')
depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
         'ttf-font' 'systemd' 'dbus' 'libpulse' 'pciutils' 'json-glib'
         'desktop-file-utils' 'hicolor-icon-theme')
makedepends=('python' 'python2' 'gperf' 'yasm' 'mesa' 'ninja' 'git'
             'clang' 'lld' 'gn' 'llvm' 'libva' 'quilt')
optdepends=('pepper-flash: support for Flash content'
            'kdialog: needed for file dialogs in KDE'
            'gnome-keyring: for storing passwords in GNOME keyring'
            'kwallet: for storing passwords in KWallet'
            'libva-intel-driver: for hardware video acceleration with Intel GPUs'
            'libva-mesa-driver: for hardware video acceleration with AMD/ATI GPUs'
            'libva-vdpau-driver: for hardware video acceleration with NVIDIA GPUs')
provides=('chromium')
conflicts=('chromium')
source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
        chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz
        'https://github.com/Eloston/ungoogled-chromium/archive/69.0.3497.100-2.tar.gz')
sha256sums=('e3391560e73e25fb4afc3f2dd5616607e2dbfc58aa88251a2c5d6b7096fe9e35'
            '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
            '5aae8b05b8d366afb929627831e4d156a6cad917238c94a2a725b04c6ff59821')

# Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
# Keys are the names in the above script; values are the dependencies in Arch
declare -gA _system_libs=(
  [ffmpeg]=ffmpeg
  [flac]=flac
  [fontconfig]=fontconfig
  [freetype]=freetype2
  [harfbuzz-ng]=harfbuzz
  [icu]=icu
  [libdrm]=
  [libevent]=libevent
  [libjpeg]=libjpeg
  #[libpng]=libpng            # https://crbug.com/752403#c10
  [libvpx]=libvpx
  [libwebp]=libwebp
  [libxml]=libxml2
  [libxslt]=libxslt
  [opus]=opus
  [re2]=re2
  [snappy]=snappy
  [yasm]=
  [zlib]=minizip
)
_unwanted_bundled_libs=(
  ${!_system_libs[@]}
  ${_system_libs[libjpeg]+libjpeg_turbo}
)
depends+=(${_system_libs[@]})

prepare() {
  local _buildkit_cli="$srcdir/$pkgname-$pkgver-$pkgrel/run_buildkit_cli.py"
  local _config_bundle="$srcdir/$pkgname-$pkgver-$pkgrel/config_bundles/archlinux"

  cd "$srcdir/chromium-$pkgver"

  msg2 'Pruning binaries'
  python "$_buildkit_cli" prune -b "$_config_bundle" ./
  msg2 'Applying patches'
  python "$_buildkit_cli" patches apply -b "$_config_bundle" ./
  msg2 'Applying domain substitution'
  python "$_buildkit_cli" domains apply -b "$_config_bundle" -c domainsubcache.tar.gz ./

  # Force script incompatible with Python 3 to use /usr/bin/python2
  sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py

  # Remove bundled libraries for which we will use the system copies; this
  # *should* do what the remove_bundled_libraries.py script does, with the
  # added benefit of not having to list all the remaining libraries
  local _lib
  for _lib in ${_unwanted_bundled_libs[@]}; do
    find -type f -path "*third_party/$_lib/*" \
      \! -path "*third_party/$_lib/chromium/*" \
      \! -path "*third_party/$_lib/google/*" \
      \! -path './base/third_party/icu/*' \
      \! -path './third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h' \
      \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
      \! -path './third_party/yasm/run_yasm.py' \
      \! -regex '.*\.\(gn\|gni\|isolate\)' \
      -delete
  done

  python2 build/linux/unbundle/replace_gn_files.py \
    --system-libraries "${!_system_libs[@]}"
}

build() {
  make -C chromium-launcher-$_launcher_ver

  cd "$srcdir/chromium-$pkgver"

  if check_buildoption ccache y; then
    # Avoid falling back to preprocessor mode when sources contain time macros
    export CCACHE_SLOPPINESS=time_macros
  fi

  export CC=clang
  export CXX=clang++
  export AR=llvm-ar
  export NM=llvm-nm

  mkdir -p out/Default

  local _buildkit_cli="$srcdir/$pkgname-$pkgver-$pkgrel/run_buildkit_cli.py"
  local _config_bundle="$srcdir/$pkgname-$pkgver-$pkgrel/config_bundles/archlinux"

  python "$_buildkit_cli" gnargs print -b "$_config_bundle" \
    > "$srcdir/chromium-$pkgver/out/Default/args.gn"

  # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  CFLAGS+='   -Wno-builtin-macro-redefined'
  CXXFLAGS+=' -Wno-builtin-macro-redefined'
  CPPFLAGS+=' -D__DATE__=  -D__TIME__=  -D__TIMESTAMP__='

  msg2 'Configuring Chromium'
  gn gen out/Default --script-executable=/usr/bin/python2 --fail-on-unused-args
  msg2 'Building Chromium'
  ninja -C out/Default chrome chrome_sandbox chromedriver
}

package() {
  cd chromium-launcher-$_launcher_ver
  make PREFIX=/usr DESTDIR="$pkgdir" install
  install -Dm644 LICENSE \
    "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"

  cd "$srcdir/chromium-$pkgver"

  install -D out/Default/chrome "$pkgdir/usr/lib/chromium/chromium"
  install -Dm4755 out/Default/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  ln -s /usr/lib/$pkgname/chromedriver "$pkgdir/usr/bin/chromedriver"

  install -Dm644 chrome/installer/linux/common/desktop.template \
    "$pkgdir/usr/share/applications/chromium.desktop"
  install -Dm644 chrome/app/resources/manpage.1.in \
    "$pkgdir/usr/share/man/man1/chromium.1"
  sed -i \
    -e "s/@@MENUNAME@@/Chromium/g" \
    -e "s/@@PACKAGE@@/chromium/g" \
    -e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
    "$pkgdir/usr/share/applications/chromium.desktop" \
    "$pkgdir/usr/share/man/man1/chromium.1"

  cp \
    out/Default/{chrome_{100,200}_percent,resources}.pak \
    out/Default/{*.bin,chromedriver} \
    "$pkgdir/usr/lib/chromium/"
  install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Default/locales/*.pak

  if [[ -z ${_system_libs[icu]+set} ]]; then
    cp out/Default/icudtl.dat "$pkgdir/usr/lib/chromium/"
  fi

  for size in 22 24 48 64 128 256; do
    install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
      "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  done

  for size in 16 32; do
    install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
      "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  done

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
}

# vim:set ts=2 sw=2 et:
Eloston commented 6 years ago

Whoops, I forgot I changed that. You'll need to edit $srcdir/chromium-$pkgver/out/Default/args.gn then with sed or similar.

xsmile commented 6 years ago

@maxbla You can additionally try to run the chromium-vaapi-bin package from the AUR. The only difference to the official package is the VA-API patch which is included in ungoogled-chromium, too. Should it fail to run, then we have a suspect.

maxbla commented 6 years ago

Just to confirm,

$ chromium --version
Chromium 69.0.3497.100 Arch Linux

That's for your AUR package.

I installed chromium-vaapi (built from source) and got the same error messages, but no segfault and the browser worked

$ chromium
mesa: for the -simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the -global-isel-abort option: may only occur zero or one times!
[5083:5083:1003/031023.072107:ERROR:sandbox_linux.cc(379)] InitializeSandbox() called with multiple threads in process gpu-process.
[72:72:1003/031119.435021:ERROR:webthread_impl_for_utility_thread.cc(19)] Not implemented reached in virtual blink::ThreadScheduler *blink::scheduler::WebThreadImplForUtilityThread::Scheduler() const

So it seems the segfault is unrelated to the displayed error messages.

maxbla commented 6 years ago

You'll need to edit $srcdir/chromium-$pkgver/out/Default/args.gn then with sed or similar.

This is a pain because that .gn file doesn't yet exist after the pkgbuild's prepare phase. I guess it is generated by this line in the PKGBUILD's build gn gen out/Default --script-executable=/usr/bin/python2 --fail-on-unused-args.

Also I can't run makepkg multiple times, as the second (and further times) it gives an error.

The next patch would create the file third_party/ungoogled/ungoogled_switches.h,
which already exists!  Skipping patch.
1 out of 1 hunk ignored
2018-10-03 04:35:11,890 - ERROR: Unexpected exception caught.
Traceback (most recent call last):
  File "/home/max/Downloads/AUR/ungoogled-chromium/src/ungoogled-chromium-69.0.3497.100-1/buildkit/cli.py", line 384, in main
    args.callback(args=args)
  File "/home/max/Downloads/AUR/ungoogled-chromium/src/ungoogled-chromium-69.0.3497.100-1/buildkit/cli.py", line 232, in _apply_callback
    patch_bin_path=args.patch_bin)
  File "/home/max/Downloads/AUR/ungoogled-chromium/src/ungoogled-chromium-69.0.3497.100-1/buildkit/patches.py", line 95, in apply_patches
    subprocess.run(cmd, check=True)
  File "/usr/lib/python3.7/subprocess.py", line 468, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/patch', '-p1', '--ignore-whitespace', '-i', '/home/max/Downloads/AUR/ungoogled-chromium/src/ungoogled-chromium-69.0.3497.100-1/patches/ungoogled-chromium/add-third-party-ungoogled.patch', '-d', '.', '--no-backup-if-mismatch', '--forward']' returned non-zero exit status 1.
==> ERROR: A failure occurred in prepare().
    Aborting...

Do you want me to file an issue about this makepkg error? How should I proceed with the debug build/Can you give me step-by-step instructions on how to make a debug build on arch?

ghost commented 6 years ago

Alternatively you can sed-fix the gn_flags.map file located in config_bundles/common/.

Add this into prepare(), close to the other sed there.

sed -i -E 's/(is_debug=)[a-z]+/\1true/' ${_config_bundle/archlinux/common}/gn_flags.map
Eloston commented 6 years ago

You can also edit it right after it is generated by buildkit, where the output of gnargs print is redirected to that location.

maxbla commented 6 years ago

I tried @ian-moone's suggestion (thanks), but can you please hold my hand a little bit more? I got this error

  -> Configuring Chromium
ERROR at //build/config/BUILDCONFIG.gn:168:1: Assertion failed.
assert(!(is_debug && is_official_build), "Can't do official debug builds")
^-----
Can't do official debug builds
==> ERROR: A failure occurred in build().
    Aborting...

I don't know what I'm doing with this build system, but it's not very intuitive. In BUILDCONFIG.gn (./src/chromium-69.0.3497.100/build/config/BUILDCONFIG.gn), I found is_official_build = false on line 131, but the failed assertion suggests that is_official_build = true.

ghost commented 6 years ago

I found is_official_build = false on line 131, but the failed assertion suggests that is_official_build = true.

Hm... Ok, then try this one:

sed -i -E \
    -e 's/(is_debug=)[a-z]+/\1true/' \
    -e 's/(is_official_build=)[a-z]+/\1false/' \
     ${_config_bundle/archlinux/common}/gn_flags.map
maxbla commented 6 years ago

I got much of the way through compiling this time, then...

/usr/bin/ld.lld: error: duplicate symbol: download::QuarantineFile(base::FilePath const&, GURL const&, GURL const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
>>> defined at quarantine.cc
>>>            quarantine/quarantine.o:(download::QuarantineFile(base::FilePath const&, GURL const&, GURL const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)) in archive obj/components/download/quarantine/libquarantine.a
>>> defined at quarantine_linux.cc
>>>            quarantine/quarantine_linux.o:(.text+0x0) in archive obj/components/download/quarantine/libquarantine.a

/usr/bin/ld.lld: error: duplicate symbol: download::IsFileQuarantined(base::FilePath const&, GURL const&, GURL const&)
>>> defined at quarantine.cc
>>>            quarantine/quarantine.o:(download::IsFileQuarantined(base::FilePath const&, GURL const&, GURL const&)) in archive obj/components/download/quarantine/libquarantine.a
>>> defined at quarantine_linux.cc
>>>            quarantine/quarantine_linux.o:(.text+0x2A0) in archive obj/components/download/quarantine/libquarantine.a
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
[15596/19271] CXX obj/v8/torque/TorqueParser.o
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...

I'm done trying things on my own. I'll try simple suggestions, but I don't have time to try to understand the build system (and I don't really want to learn it). If someone tells me a way that they successfully made a debug build of this on Arch, I'm all ears.

Eloston commented 6 years ago

I haven't made a debug build in ages, so I don't know what's needed to make it work for recent versions.

My guess is that this error resulted from jumbo. Maybe we need to disable jumbo (use_jumbo_build=false) in debug builds to fix the error? Alternatively, this could be a bug in patches/ungoogled-chromium/disable-download-quarantine.patch.

Eloston commented 5 years ago

Closing since version 70 has been out for a while. Let us know if you still encounter this error.