diff mbox series

[v6,4/4] chromium: new package

Message ID 20180710234212.4297-5-joseph.kogut@gmail.com
State Changes Requested
Headers show
Series chromium: new package | expand

Commit Message

Joseph Kogut July 10, 2018, 11:42 p.m. UTC
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
 DEVELOPERS                                    |   1 +
 package/Config.in                             |   1 +
 ...iler_cpu_abi-for-buildroot-toolchain.patch | 102 ++++++++++++
 .../0002-Fix-arm-build-with-glibc-2.27.patch  |  28 ++++
 package/chromium/Config.in                    |  64 ++++++++
 package/chromium/chromium.hash                |   3 +
 package/chromium/chromium.mk                  | 146 ++++++++++++++++++
 package/chromium/toolchain/BUILD.gn           |  71 +++++++++
 8 files changed, 416 insertions(+)
 create mode 100644 package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
 create mode 100644 package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
 create mode 100644 package/chromium/Config.in
 create mode 100644 package/chromium/chromium.hash
 create mode 100644 package/chromium/chromium.mk
 create mode 100644 package/chromium/toolchain/BUILD.gn

Comments

Martin Bark July 14, 2018, 7:11 p.m. UTC | #1
Joseph,

On 11 July 2018 at 00:42, Joseph Kogut <joseph.kogut@gmail.com> wrote:
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> ---
>  DEVELOPERS                                    |   1 +
>  package/Config.in                             |   1 +
>  ...iler_cpu_abi-for-buildroot-toolchain.patch | 102 ++++++++++++
>  .../0002-Fix-arm-build-with-glibc-2.27.patch  |  28 ++++
>  package/chromium/Config.in                    |  64 ++++++++
>  package/chromium/chromium.hash                |   3 +
>  package/chromium/chromium.mk                  | 146 ++++++++++++++++++
>  package/chromium/toolchain/BUILD.gn           |  71 +++++++++
>  8 files changed, 416 insertions(+)
>  create mode 100644 package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
>  create mode 100644 package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
>  create mode 100644 package/chromium/Config.in
>  create mode 100644 package/chromium/chromium.hash
>  create mode 100644 package/chromium/chromium.mk
>  create mode 100644 package/chromium/toolchain/BUILD.gn
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 05d2bdde20..e3dde531b4 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1058,6 +1058,7 @@ F:        package/rabbitmq-c/
>  N:     Joseph Kogut <joseph.kogut@gmail.com>
>  F:     package/at-spi2-atk/
>  F:     package/at-spi2-core/
> +F:     package/chromium/
>  F:     package/gconf/
>  F:     package/libnss/
>  F:     package/lld/
> diff --git a/package/Config.in b/package/Config.in
> index 20fe5ad8ff..2515975df3 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -14,6 +14,7 @@ menu "Audio and video applications"
>         source "package/aumix/Config.in"
>         source "package/bellagio/Config.in"
>         source "package/bluez-alsa/Config.in"
> +       source "package/chromium/Config.in"
>         source "package/dvblast/Config.in"
>         source "package/dvdauthor/Config.in"
>         source "package/dvdrw-tools/Config.in"
> diff --git a/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch b/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
> new file mode 100644
> index 0000000000..1848b0bd14
> --- /dev/null
> +++ b/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
> @@ -0,0 +1,102 @@
> +From 3d5106d1d4720e1be8a4bd977be38743d6fb1f3c Mon Sep 17 00:00:00 2001
> +From: Joseph Kogut <joseph.kogut@gmail.com>
> +Date: Sun, 10 Jun 2018 09:59:11 -0700
> +Subject: [PATCH] modify compiler_cpu_abi for buildroot toolchain
> +
> +Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> +---
> + build/config/compiler/BUILD.gn | 36 +++++++++++++++++++---------------
> + 1 file changed, 20 insertions(+), 16 deletions(-)
> +
> +diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
> +index 461e62da2..27c9f29ed 100644
> +--- a/build/config/compiler/BUILD.gn
> ++++ b/build/config/compiler/BUILD.gn
> +@@ -683,6 +683,10 @@ config("compiler_cpu_abi") {
> +         "-march=x86-64",
> +       ]
> +       ldflags += [ "-m64" ]
> ++      if (is_clang) {
> ++        cflags += ["--target=x86_64-buildroot-linux-gnu"]
> ++        ldflags += ["--target=x86_64-buildroot-linux-gnu"]
> ++      }
> +     } else if (current_cpu == "x86") {
> +       cflags += [ "-m32" ]
> +       ldflags += [ "-m32" ]
> +@@ -695,8 +699,8 @@ config("compiler_cpu_abi") {
> +       }
> +     } else if (current_cpu == "arm") {
> +       if (is_clang && !is_android && !is_nacl) {
> +-        cflags += [ "--target=arm-linux-gnueabihf" ]
> +-        ldflags += [ "--target=arm-linux-gnueabihf" ]
> ++        cflags += [ "--target=arm-buildroot-linux-gnueabihf" ]
> ++        ldflags += [ "--target=arm-buildroot-linux-gnueabihf" ]
> +       }
> +       if (!is_nacl) {
> +         cflags += [
> +@@ -709,18 +713,18 @@ config("compiler_cpu_abi") {
> +       }
> +     } else if (current_cpu == "arm64") {
> +       if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
> +-        cflags += [ "--target=aarch64-linux-gnu" ]
> +-        ldflags += [ "--target=aarch64-linux-gnu" ]
> ++        cflags += [ "--target=aarch64-buildroot-linux-gnu" ]
> ++        ldflags += [ "--target=aarch64-buildroot-linux-gnu" ]
> +       }
> +     } else if (current_cpu == "mipsel" && !is_nacl) {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +           if (is_android) {
> +-            cflags += [ "--target=mipsel-linux-android" ]
> +-            ldflags += [ "--target=mipsel-linux-android" ]
> ++            cflags += [ "--target=mipsel-buildroot-linux-android" ]
> ++            ldflags += [ "--target=mipsel-buildroot-linux-android" ]
> +           } else {
> +-            cflags += [ "--target=mipsel-linux-gnu" ]
> +-            ldflags += [ "--target=mipsel-linux-gnu" ]
> ++            cflags += [ "--target=mipsel-buildroot-linux-gnu" ]
> ++            ldflags += [ "--target=mipsel-buildroot-linux-gnu" ]
> +           }
> +         } else {
> +           cflags += [ "-EL" ]
> +@@ -799,8 +803,8 @@ config("compiler_cpu_abi") {
> +     } else if (current_cpu == "mips" && !is_nacl) {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +-          cflags += [ "--target=mips-linux-gnu" ]
> +-          ldflags += [ "--target=mips-linux-gnu" ]
> ++          cflags += [ "--target=mips-buildroot-linux-gnu" ]
> ++          ldflags += [ "--target=mips-buildroot-linux-gnu" ]
> +         } else {
> +           cflags += [ "-EB" ]
> +           ldflags += [ "-EB" ]
> +@@ -844,11 +848,11 @@ config("compiler_cpu_abi") {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +           if (is_android) {
> +-            cflags += [ "--target=mips64el-linux-android" ]
> +-            ldflags += [ "--target=mips64el-linux-android" ]
> ++            cflags += [ "--target=mips64el-buildroot-linux-android" ]
> ++            ldflags += [ "--target=mips64el-buildroot-linux-android" ]
> +           } else {
> +-            cflags += [ "--target=mips64el-linux-gnuabi64" ]
> +-            ldflags += [ "--target=mips64el-linux-gnuabi64" ]
> ++            cflags += [ "--target=mips64el-buildroot-linux-gnuabi64" ]
> ++            ldflags += [ "--target=mips64el-buildroot-linux-gnuabi64" ]
> +           }
> +         } else {
> +           cflags += [
> +@@ -905,8 +909,8 @@ config("compiler_cpu_abi") {
> +     } else if (current_cpu == "mips64") {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +-          cflags += [ "--target=mips64-linux-gnuabi64" ]
> +-          ldflags += [ "--target=mips64-linux-gnuabi64" ]
> ++          cflags += [ "--target=mips64-buildroot-linux-gnuabi64" ]
> ++          ldflags += [ "--target=mips64-buildroot-linux-gnuabi64" ]
> +         } else {
> +           cflags += [
> +             "-EB",
> +--
> +2.17.1
> +
> diff --git a/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch b/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
> new file mode 100644
> index 0000000000..8aebbd06c8
> --- /dev/null
> +++ b/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
> @@ -0,0 +1,28 @@
> +From aed4599c18586dfac46139a3c32011f804fdaef6 Mon Sep 17 00:00:00 2001
> +From: Joseph Kogut <joseph.kogut@gmail.com>
> +Date: Wed, 13 Jun 2018 13:59:24 -0700
> +Subject: [PATCH] Fix arm build with glibc 2.27
> +
> +Upstream patch from: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1060155
> +
> +Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> +---
> + third_party/crashpad/crashpad/compat/linux/sys/ptrace.h | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> +index 73861576d..e5c95c7cc 100644
> +--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> ++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> +@@ -34,7 +34,7 @@ static constexpr __ptrace_request PTRACE_GET_THREAD_AREA =
> + #endif  // !PTRACE_GET_THREAD_AREA && !PT_GET_THREAD_AREA && defined(__GLIBC__)
> +
> + // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
> +-#if !defined(PTRACE_GETVFPREGS) && \
> ++#if !defined(PTRACE_GETVFPREGS) && !defined(PT_GETVFPREGS) && \
> +     defined(__GLIBC__) && (defined(__arm__) || defined(__arm64__))
> + static constexpr __ptrace_request PTRACE_GETVFPREGS =
> +     static_cast<__ptrace_request>(27);
> +--
> +2.17.1
> +
> diff --git a/package/chromium/Config.in b/package/chromium/Config.in
> new file mode 100644
> index 0000000000..fa04d3bbd2
> --- /dev/null
> +++ b/package/chromium/Config.in
> @@ -0,0 +1,64 @@
> +config BR2_PACKAGE_CHROMIUM_ARCH_SUPPORTS
> +       bool
> +       default y if BR2_arm
> +       default y if BR2_aarch64
> +       default y if BR2_i386
> +       default y if BR2_x86_64
> +
> +config BR2_PACKAGE_CHROMIUM_TARGET_ARCH
> +       string
> +       default "arm" if BR2_arm
> +       default "arm64" if BR2_aarch64
> +       default "x86" if BR2_i386
> +       default "x64" if BR2_x86_64
> +

I tried building for an aarch64 target and it fails with the error

ERROR at //chrome/installer/linux/BUILD.gn:413:7: Assertion failed.
      assert(false, "Linux installer not configured for this architecture.")

Looking at chrome/installer/linux/BUILD.gn it seems only i386, x86_64,
arm, mipsel and mips64el target architectures are supported.  I think
you need to remove BR2_aarch64 and add BR2_mipsel and BR2_mips64el

> +menuconfig BR2_PACKAGE_CHROMIUM
> +       bool "chromium"

BR2_PACKAGE_CHROMIUM should depend on BR2_PACKAGE_CHROMIUM_ARCH_SUPPORTS

> +       depends on BR2_HOST_GCC_AT_LEAST_4_9 # gn requires -std=c++14
> +       depends on BR2_PACKAGE_HAS_LIBGL
> +       depends on BR2_PACKAGE_XORG7
> +       depends on BR2_TOOLCHAIN_USES_GLIBC
> +       select BR2_PACKAGE_AT_SPI2_ATK
> +       select BR2_PACKAGE_ALSA_LIB
> +       select BR2_PACKAGE_FREETYPE
> +       select BR2_PACKAGE_HARFBUZZ
> +       select BR2_PACKAGE_HOST_CLANG
> +       select BR2_PACKAGE_HOST_LLD
> +       select BR2_PACKAGE_HOST_NINJA
> +       select BR2_PACKAGE_HOST_NODEJS
> +       select BR2_PACKAGE_HOST_PYTHON
> +       select BR2_PACKAGE_JPEG
> +       select BR2_PACKAGE_LIBDRM
> +       select BR2_PACKAGE_LIBERATION # runtime
> +       select BR2_PACKAGE_LIBGLIB2
> +       select BR2_PACKAGE_LIBGTK2 if !BR2_PACKAGE_LIBGTK3_X11
> +       select BR2_PACKAGE_LIBKRB5
> +       select BR2_PACKAGE_LIBNSS
> +       select BR2_PACKAGE_LIBPNG
> +       select BR2_PACKAGE_XLIB_LIBXCOMPOSITE
> +       select BR2_PACKAGE_XLIB_LIBXCURSOR
> +       select BR2_PACKAGE_XLIB_LIBXI if !BR2_PACKAGE_LIBGTK3_X11
> +       select BR2_PACKAGE_XLIB_LIBXRANDR
> +       select BR2_PACKAGE_XLIB_LIBXSCRNSAVER
> +       select BR2_PACKAGE_XLIB_LIBXTST if !BR2_PACKAGE_LIBGTK3_X11
> +       help
> +         Chromium is an open-source Web browser project started by
> +         Google, to provide the source code for the proprietary
> +         Google Chrome browser.
> +
> +if BR2_PACKAGE_CHROMIUM
> +
> +config BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS
> +       bool "Enable proprietary codecs"
> +       help
> +         Enables proprietary codecs with additional licensing
> +         restrictions, such as MP3 and H264
> +
> +endif # BR2_PACKAGE_CHROMIUM
> +
> +comment "chromium needs toolchain w/ Glibc, host gcc >= 4.9.0"
> +       depends on !BR2_TOOLCHAIN_USES_GLIBC \
> +               || !BR2_HOST_GCC_AT_LEAST_4_9
> +
> +comment "chromium depends on X.org and needs an OpenGL backend"
> +       depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_HAS_LIBGL

and the comments should also depend on BR2_PACKAGE_CHROMIUM_ARCH_SUPPORTS

> diff --git a/package/chromium/chromium.hash b/package/chromium/chromium.hash
> new file mode 100644
> index 0000000000..4c39ac5c08
> --- /dev/null
> +++ b/package/chromium/chromium.hash
> @@ -0,0 +1,3 @@
> +# locally calculated
> +sha256 f8b1e5319163e378027826b12cf256b97423bb90e10e2013469d96e03bc9db8a  chromium-67.0.3396.79.tar.xz
> +sha256 845022e0c1db1abb41a6ba4cd3c4b674ec290f3359d9d3c78ae558d4c0ed9308  LICENSE
> diff --git a/package/chromium/chromium.mk b/package/chromium/chromium.mk
> new file mode 100644
> index 0000000000..465eef17ad
> --- /dev/null
> +++ b/package/chromium/chromium.mk
> @@ -0,0 +1,146 @@
> +################################################################################
> +#
> +# Chromium
> +#
> +################################################################################
> +
> +CHROMIUM_VERSION = 67.0.3396.79

The current stable release of chromium is 67.0.3396.99

> +CHROMIUM_SITE = https://commondatastorage.googleapis.com/chromium-browser-official
> +CHROMIUM_SOURCE = chromium-$(CHROMIUM_VERSION).tar.xz
> +CHROMIUM_LICENSE = BSD-Style
> +CHROMIUM_LICENSE_FILES = LICENSE
> +CHROMIUM_DEPENDENCIES = alsa-lib cairo cups dbus freetype harfbuzz \

cups should not be listed in CHROMIUM_DEPENDENCIES because you have it
optionally compiled in below

> +                       host-clang host-lld host-ninja host-nodejs host-python \
> +                       jpeg libdrm libglib2 libkrb5 libnss libpng pango \
> +                       xlib_libXcomposite xlib_libXScrnSaver xlib_libXcursor \
> +                       xlib_libXrandr zlib
> +
> +CHROMIUM_TOOLCHAIN_CONFIG_PATH = $(shell pwd)/package/chromium/toolchain
> +
> +CHROMIUM_OPTS = \
> +       host_toolchain=\"$(CHROMIUM_TOOLCHAIN_CONFIG_PATH):host\" \
> +       custom_toolchain=\"$(CHROMIUM_TOOLCHAIN_CONFIG_PATH):target\" \
> +       use_lld=true \
> +       is_clang=true \
> +       clang_use_chrome_plugins=false \
> +       treat_warnings_as_errors=false \
> +       use_gnome_keyring=false \
> +       linux_use_bundled_binutils=false \
> +       use_sysroot=true \
> +       target_sysroot=\"$(STAGING_DIR)\" \
> +       target_cpu=\"$(BR2_PACKAGE_CHROMIUM_TARGET_ARCH)\" \
> +       enable_nacl=false \
> +       use_dbus=true \
> +       use_system_zlib=true \
> +       use_system_libjpeg=true \
> +       use_system_libpng=true \
> +       use_system_libdrm=true \
> +       use_system_harfbuzz=true \
> +       use_system_freetype=true
> +
> +# tcmalloc has portability issues
> +CHROMIUM_OPTS += use_allocator=\"none\"
> +
> +# V8 snapshots require compiling V8 with the same word size as the target
> +# architecture, which means the host needs to have that toolchain available.
> +CHROMIUM_OPTS += v8_use_snapshot=false
> +
> +ifeq ($(BR2_ENABLE_DEBUG),y)
> +CHROMIUM_OPTS += is_debug=true
> +else
> +CHROMIUM_OPTS += is_debug=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_CUPS),y)
> +CHROMIUM_DEPENDENCIES += cups
> +CHROMIUM_OPTS += use_cups=true
> +else
> +CHROMIUM_OPTS += use_cups=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
> +CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DBUS),y)
> +CHROMIUM_OPTS += use_dbus=true
> +else
> +CHROMIUM_OPTS += use_dbus=false
> +endif

dbus is included in the CHROMIUM_DEPENDENCIES and the default
CHROMIUM_OPTS set use_dbus=true so is dbus really optional?  I think
you can remove this ifeq ($(BR2_PACKAGE_DBUS),y) section

> +
> +ifeq ($(BR2_PACKAGE_PCIUTILS),y)
> +CHROMIUM_DEPENDENCIES += pciutils
> +CHROMIUM_OPTS += use_libpci=true
> +else
> +CHROMIUM_OPTS += use_libpci=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_PULSEAUDIO),y)
> +CHROMIUM_DEPENDENCIES += pulseaudio
> +CHROMIUM_OPTS += use_pulseaudio=true
> +else
> +CHROMIUM_OPTS += use_pulseaudio=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_LIBGTK3_X11),y)
> +CHROMIUM_DEPENDENCIES += libgtk3
> +CHROMIUM_OPTS += use_gtk3=true
> +else
> +CHROMIUM_DEPENDENCIES += libgtk2 xlib_libXi xlib_libXtst
> +CHROMIUM_OPTS += use_gtk3=false
> +endif
> +
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
> +CHROMIUM_TARGET_LDFLAGS += --gcc-toolchain=$(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
> +else
> +CHROMIUM_TARGET_LDFLAGS += --gcc-toolchain=$(HOST_DIR)
> +endif
> +
> +CHROMIUM_TARGET_CFLAGS += $(CHROMIUM_TARGET_LDFLAGS)
> +CHROMIUM_TARGET_CXXFLAGS += $(CHROMIUM_TARGET_CFLAGS)
> +
> +define CHROMIUM_CONFIGURE_CMDS
> +       mkdir -p $(@D)/third_party/node/linux/node-linux-x64/bin
> +       ln -sf $(HOST_DIR)/bin/node $(@D)/third_party/node/linux/node-linux-x64/bin/

Given this is hard coded to node-linux-x64 does this mean chromium
will only build if BR2_HOSTARCH is x86_64  ?

> +
> +       ( cd $(@D); \
> +               $(TARGET_MAKE_ENV) \
> +               $(HOST_DIR)/bin/python2 tools/gn/bootstrap/bootstrap.py -s --no-clean; \
> +               HOST_AR="$(HOSTAR)" \
> +               HOST_NM="$(HOSTNM)" \
> +               HOST_CC="$(HOSTCC)" \
> +               HOST_CXX="$(HOSTCXX)" \
> +               HOST_CFLAGS="$(HOST_CFLAGS)" \
> +               HOST_CXXFLAGS="$(HOST_CXXFLAGS)" \
> +               TARGET_AR="ar" \
> +               TARGET_NM="nm" \
> +               TARGET_CC="clang" \
> +               TARGET_CXX="clang++" \
> +               TARGET_CFLAGS="$(CHROMIUM_TARGET_CFLAGS)" \
> +               TARGET_CXXFLAGS="$(CHROMIUM_TARGET_CXXFLAGS)" \
> +               TARGET_LDFLAGS="$(CHROMIUM_TARGET_LDFLAGS)" \
> +               out/Release/gn gen out/Release --args="$(CHROMIUM_OPTS)" \
> +                       --script-executable=$(HOST_DIR)/bin/python2 \
> +       )
> +endef
> +
> +define CHROMIUM_BUILD_CMDS
> +       ( cd $(@D); \
> +               $(TARGET_MAKE_ENV) \
> +               ninja -j$(PARALLEL_JOBS) -C out/Release chrome chrome_sandbox chromedriver \
> +       )
> +endef
> +
> +define CHROMIUM_INSTALL_TARGET_CMDS
> +       $(INSTALL) -D $(@D)/out/Release/chrome $(TARGET_DIR)/usr/lib/chromium/chromium
> +       $(INSTALL) -Dm4755 $(@D)/out/Release/chrome_sandbox \
> +               $(TARGET_DIR)/usr/lib/chromium/chrome-sandbox
> +       cp $(@D)/out/Release/{chrome_{100,200}_percent,resources}.pak \
> +               $(@D)/out/Release/chromedriver \
> +               $(TARGET_DIR)/usr/lib/chromium/
> +       $(INSTALL) -Dm644 -t $(TARGET_DIR)/usr/lib/chromium/locales \
> +               $(@D)/out/Release/locales/*.pak
> +       cp $(@D)/out/Release/icudtl.dat $(TARGET_DIR)/usr/lib/chromium/
> +endef
> +
> +$(eval $(generic-package))
> diff --git a/package/chromium/toolchain/BUILD.gn b/package/chromium/toolchain/BUILD.gn
> new file mode 100644
> index 0000000000..e8525bd67d
> --- /dev/null
> +++ b/package/chromium/toolchain/BUILD.gn
> @@ -0,0 +1,71 @@
> +import("//build/toolchain/gcc_toolchain.gni")
> +import("//build/config/sysroot.gni")
> +
> +gcc_toolchain("host") {
> +  cc = getenv("HOST_CC")
> +  cxx = getenv("HOST_CXX")
> +  ar = getenv("HOST_AR")
> +  nm = getenv("HOST_NM")
> +  ld = cxx
> +
> +  extra_cflags = getenv("HOST_CFLAGS")
> +  extra_cppflags = getenv("HOST_CPPFLAGS")
> +  extra_cxxflags = getenv("HOST_CXXFLAGS")
> +  extra_ldflags = getenv("HOST_LDFLAGS")
> +
> +  toolchain_args = {
> +    cc_wrapper = ""
> +    current_cpu = host_cpu
> +    current_os = host_os
> +    is_clang = false
> +    use_sysroot = false
> +    use_lld = false
> +  }
> +}
> +
> +gcc_toolchain("target") {
> +  cc = getenv("TARGET_CC")
> +  cxx = getenv("TARGET_CXX")
> +  ar = getenv("TARGET_AR")
> +  nm = getenv("TARGET_NM")
> +  ld = cxx
> +
> +  extra_cflags = getenv("TARGET_CFLAGS")
> +  extra_cppflags = getenv("TARGET_CPPFLAGS")
> +  extra_cxxflags = getenv("TARGET_CXXFLAGS")
> +  extra_ldflags = getenv("TARGET_LDFLAGS")
> +
> +  toolchain_args = {
> +    cc_wrapper = ""
> +    current_cpu = target_cpu
> +    current_os = target_os
> +    is_clang = is_clang
> +    use_sysroot = use_sysroot
> +  }
> +}
> +
> +gcc_toolchain("v8_snapshot") {
> +  cc = getenv("V8_CC")
> +  cxx = getenv("V8_CXX")
> +  ar = getenv("V8_AR")
> +  nm = getenv("V8_NM")
> +  ld = cxx
> +
> +  extra_cflags = getenv("V8_CFLAGS")
> +  extra_cppflags = getenv("V8_CPPFLAGS")
> +  extra_cxxflags = getenv("V8_CXXFLAGS")
> +  extra_ldflags = getenv("V8_LDFLAGS")
> +
> +  toolchain_args = {
> +    cc_wrapper = ""
> +    if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") {
> +      current_cpu = "x86"
> +    } else {
> +      current_cpu = "x64"
> +    }
> +    current_os = host_os
> +    is_clang = is_clang
> +    use_sysroot = false
> +  }
> +}
> +
> --
> 2.18.0
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

Thanks

Martin
Joseph Kogut July 14, 2018, 10:57 p.m. UTC | #2
Hi Martin,

On Sat, Jul 14, 2018 at 12:11 PM Martin Bark <martin@barkynet.com> wrote:
>
<snip>
>
> I tried building for an aarch64 target and it fails with the error
>
> ERROR at //chrome/installer/linux/BUILD.gn:413:7: Assertion failed.
>       assert(false, "Linux installer not configured for this architecture.")
>
> Looking at chrome/installer/linux/BUILD.gn it seems only i386, x86_64,
> arm, mipsel and mips64el target architectures are supported.  I think
> you need to remove BR2_aarch64 and add BR2_mipsel and BR2_mips64el
>

Can you try adding the argument "enable_linux_installer=false" to
CHROMIUM_OPTS in chromium.mk, then reconfiguring and rebuilding?

I believe the "linux installer" target here is simply packaging for
Debian and Fedora, which this package doesn't use.

> > +comment "chromium needs toolchain w/ Glibc, host gcc >= 4.9.0"
> > +       depends on !BR2_TOOLCHAIN_USES_GLIBC \
> > +               || !BR2_HOST_GCC_AT_LEAST_4_9
> > +
> > +comment "chromium depends on X.org and needs an OpenGL backend"
> > +       depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_HAS_LIBGL
>
> and the comments should also depend on BR2_PACKAGE_CHROMIUM_ARCH_SUPPORTS
>

> > +
> > +CHROMIUM_VERSION = 67.0.3396.79
>
> The current stable release of chromium is 67.0.3396.99
>

> > +CHROMIUM_DEPENDENCIES = alsa-lib cairo cups dbus freetype harfbuzz \
>
> cups should not be listed in CHROMIUM_DEPENDENCIES because you have it
> optionally compiled in below
>

Thanks for the tips, I'll fix these things in the next release.

> > +ifeq ($(BR2_PACKAGE_DBUS),y)
> > +CHROMIUM_OPTS += use_dbus=true
> > +else
> > +CHROMIUM_OPTS += use_dbus=false
> > +endif
>
> dbus is included in the CHROMIUM_DEPENDENCIES and the default
> CHROMIUM_OPTS set use_dbus=true so is dbus really optional?  I think
> you can remove this ifeq ($(BR2_PACKAGE_DBUS),y) section
>

I have this fixed in my WIP branch for next release.

> > +define CHROMIUM_CONFIGURE_CMDS
> > +       mkdir -p $(@D)/third_party/node/linux/node-linux-x64/bin
> > +       ln -sf $(HOST_DIR)/bin/node $(@D)/third_party/node/linux/node-linux-x64/bin/
>
> Given this is hard coded to node-linux-x64 does this mean chromium
> will only build if BR2_HOSTARCH is x86_64  ?
>

I haven't tried building on a different host arch, but this is likely
the case. I'm not aware of any other common processors using other
architectures that are fast enough to compile Chromium in a reasonable
amount of time. Additionally, compiling Chromium requires a minimum of
4 GiB of memory.

Is it reasonable to depend on BR2_HOSTARCH = x86_64, or is it worth
seeing what can be done to fix this?

Thanks,
Joseph
Martin Bark July 15, 2018, 9:54 p.m. UTC | #3
Joseph,

On 14 July 2018 at 23:57, Joseph Kogut <joseph.kogut@gmail.com> wrote:
> Hi Martin,
>
> On Sat, Jul 14, 2018 at 12:11 PM Martin Bark <martin@barkynet.com> wrote:
>>
> <snip>
>>
>> I tried building for an aarch64 target and it fails with the error
>>
>> ERROR at //chrome/installer/linux/BUILD.gn:413:7: Assertion failed.
>>       assert(false, "Linux installer not configured for this architecture.")
>>
>> Looking at chrome/installer/linux/BUILD.gn it seems only i386, x86_64,
>> arm, mipsel and mips64el target architectures are supported.  I think
>> you need to remove BR2_aarch64 and add BR2_mipsel and BR2_mips64el
>>
>
> Can you try adding the argument "enable_linux_installer=false" to
> CHROMIUM_OPTS in chromium.mk, then reconfiguring and rebuilding?
>
> I believe the "linux installer" target here is simply packaging for
> Debian and Fedora, which this package doesn't use.
>

Thanks, that go the build further.  Now it fails with the following
error.  Any ideas?



ERROR at //build/config/linux/pkg_config.gni:103:17: Script returned
non-zero exit code.
    pkgresult = exec_script(pkg_config_script, args, "value")
                ^----------
Current dir: /home/br-user/buildroot/output/build/chromium-67.0.3396.79/out/Release/
Command: /home/br-user/buildroot/output/host/bin/python2 --
/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py
-s /home/br-user/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot
-a arm64 --system_libdir lib nss -v -lssl3
Returned 1.
stderr:

Traceback (most recent call last):
  File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
line 232, in <module>
    sys.exit(main())
  File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
line 139, in main
    prefix = GetPkgConfigPrefixToStrip(options, args)
  File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
line 80, in GetPkgConfigPrefixToStrip
    "--variable=prefix"] + args, env=os.environ)
  File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
line 216, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
line 394, in __init__
    errread, errwrite)
  File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

See //third_party/nss/BUILD.gn:15:3: whence it was called.
  pkg_config("system_nss_no_ssl_config") {
  ^---------------------------------------
See //crypto/BUILD.gn:221:25: which caused the file to be included.
    public_configs += [ "//third_party/nss:system_nss_no_ssl_config" ]
                        ^-------------------------------------------
package/pkg-generic.mk:219: recipe for target
'/home/br-user/buildroot/output/build/chromium-67.0.3396.79/.stamp_configured'
failed
make: *** [/home/br-user/buildroot/output/build/chromium-67.0.3396.79/.stamp_configured]
Error 1


Thanks

Martin

>> > +comment "chromium needs toolchain w/ Glibc, host gcc >= 4.9.0"
>> > +       depends on !BR2_TOOLCHAIN_USES_GLIBC \
>> > +               || !BR2_HOST_GCC_AT_LEAST_4_9
>> > +
>> > +comment "chromium depends on X.org and needs an OpenGL backend"
>> > +       depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_HAS_LIBGL
>>
>> and the comments should also depend on BR2_PACKAGE_CHROMIUM_ARCH_SUPPORTS
>>
>
>> > +
>> > +CHROMIUM_VERSION = 67.0.3396.79
>>
>> The current stable release of chromium is 67.0.3396.99
>>
>
>> > +CHROMIUM_DEPENDENCIES = alsa-lib cairo cups dbus freetype harfbuzz \
>>
>> cups should not be listed in CHROMIUM_DEPENDENCIES because you have it
>> optionally compiled in below
>>
>
> Thanks for the tips, I'll fix these things in the next release.
>
>> > +ifeq ($(BR2_PACKAGE_DBUS),y)
>> > +CHROMIUM_OPTS += use_dbus=true
>> > +else
>> > +CHROMIUM_OPTS += use_dbus=false
>> > +endif
>>
>> dbus is included in the CHROMIUM_DEPENDENCIES and the default
>> CHROMIUM_OPTS set use_dbus=true so is dbus really optional?  I think
>> you can remove this ifeq ($(BR2_PACKAGE_DBUS),y) section
>>
>
> I have this fixed in my WIP branch for next release.
>
>> > +define CHROMIUM_CONFIGURE_CMDS
>> > +       mkdir -p $(@D)/third_party/node/linux/node-linux-x64/bin
>> > +       ln -sf $(HOST_DIR)/bin/node $(@D)/third_party/node/linux/node-linux-x64/bin/
>>
>> Given this is hard coded to node-linux-x64 does this mean chromium
>> will only build if BR2_HOSTARCH is x86_64  ?
>>
>
> I haven't tried building on a different host arch, but this is likely
> the case. I'm not aware of any other common processors using other
> architectures that are fast enough to compile Chromium in a reasonable
> amount of time. Additionally, compiling Chromium requires a minimum of
> 4 GiB of memory.
>
> Is it reasonable to depend on BR2_HOSTARCH = x86_64, or is it worth
> seeing what can be done to fix this?
>
> Thanks,
> Joseph
Joseph Kogut July 16, 2018, 4:29 p.m. UTC | #4
Martin,

On Sun, Jul 15, 2018 at 2:54 PM Martin Bark <martin@barkynet.com> wrote:
>
> Joseph,
>
> On 14 July 2018 at 23:57, Joseph Kogut <joseph.kogut@gmail.com> wrote:
> > Hi Martin,
> >
> > On Sat, Jul 14, 2018 at 12:11 PM Martin Bark <martin@barkynet.com> wrote:
> >>
> > <snip>
> >>
> >> I tried building for an aarch64 target and it fails with the error
> >>
> >> ERROR at //chrome/installer/linux/BUILD.gn:413:7: Assertion failed.
> >>       assert(false, "Linux installer not configured for this architecture.")
> >>
> >> Looking at chrome/installer/linux/BUILD.gn it seems only i386, x86_64,
> >> arm, mipsel and mips64el target architectures are supported.  I think
> >> you need to remove BR2_aarch64 and add BR2_mipsel and BR2_mips64el
> >>
> >
> > Can you try adding the argument "enable_linux_installer=false" to
> > CHROMIUM_OPTS in chromium.mk, then reconfiguring and rebuilding?
> >
> > I believe the "linux installer" target here is simply packaging for
> > Debian and Fedora, which this package doesn't use.
> >
>
> Thanks, that go the build further.  Now it fails with the following
> error.  Any ideas?
>
>
>
> ERROR at //build/config/linux/pkg_config.gni:103:17: Script returned
> non-zero exit code.
>     pkgresult = exec_script(pkg_config_script, args, "value")
>                 ^----------
> Current dir: /home/br-user/buildroot/output/build/chromium-67.0.3396.79/out/Release/
> Command: /home/br-user/buildroot/output/host/bin/python2 --
> /home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py
> -s /home/br-user/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot
> -a arm64 --system_libdir lib nss -v -lssl3
> Returned 1.
> stderr:
>
> Traceback (most recent call last):
>   File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
> line 232, in <module>
>     sys.exit(main())
>   File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
> line 139, in main
>     prefix = GetPkgConfigPrefixToStrip(options, args)
>   File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
> line 80, in GetPkgConfigPrefixToStrip
>     "--variable=prefix"] + args, env=os.environ)
>   File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
> line 216, in check_output
>     process = Popen(stdout=PIPE, *popenargs, **kwargs)
>   File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
> line 394, in __init__
>     errread, errwrite)
>   File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
> line 1047, in _execute_child
>     raise child_exception
> OSError: [Errno 2] No such file or directory
>
> See //third_party/nss/BUILD.gn:15:3: whence it was called.
>   pkg_config("system_nss_no_ssl_config") {
>   ^---------------------------------------
> See //crypto/BUILD.gn:221:25: which caused the file to be included.
>     public_configs += [ "//third_party/nss:system_nss_no_ssl_config" ]
>                         ^-------------------------------------------
> package/pkg-generic.mk:219: recipe for target
> '/home/br-user/buildroot/output/build/chromium-67.0.3396.79/.stamp_configured'
> failed
> make: *** [/home/br-user/buildroot/output/build/chromium-67.0.3396.79/.stamp_configured]
> Error 1
>

I think this issue, along with a few others, have since been resolved
in my chromium-v7-wip branch, which you can find at
https://github.com/jakogut/buildroot.
Martin Bark July 17, 2018, 11:43 a.m. UTC | #5
Joseph,

On 16 July 2018 at 17:29, Joseph Kogut <joseph.kogut@gmail.com> wrote:
> Martin,
>
> On Sun, Jul 15, 2018 at 2:54 PM Martin Bark <martin@barkynet.com> wrote:
>>
>> Joseph,
>>
>> On 14 July 2018 at 23:57, Joseph Kogut <joseph.kogut@gmail.com> wrote:
>> > Hi Martin,
>> >
>> > On Sat, Jul 14, 2018 at 12:11 PM Martin Bark <martin@barkynet.com> wrote:
>> >>
>> > <snip>
>> >>
>> >> I tried building for an aarch64 target and it fails with the error
>> >>
>> >> ERROR at //chrome/installer/linux/BUILD.gn:413:7: Assertion failed.
>> >>       assert(false, "Linux installer not configured for this architecture.")
>> >>
>> >> Looking at chrome/installer/linux/BUILD.gn it seems only i386, x86_64,
>> >> arm, mipsel and mips64el target architectures are supported.  I think
>> >> you need to remove BR2_aarch64 and add BR2_mipsel and BR2_mips64el
>> >>
>> >
>> > Can you try adding the argument "enable_linux_installer=false" to
>> > CHROMIUM_OPTS in chromium.mk, then reconfiguring and rebuilding?
>> >
>> > I believe the "linux installer" target here is simply packaging for
>> > Debian and Fedora, which this package doesn't use.
>> >
>>
>> Thanks, that go the build further.  Now it fails with the following
>> error.  Any ideas?
>>
>>
>>
>> ERROR at //build/config/linux/pkg_config.gni:103:17: Script returned
>> non-zero exit code.
>>     pkgresult = exec_script(pkg_config_script, args, "value")
>>                 ^----------
>> Current dir: /home/br-user/buildroot/output/build/chromium-67.0.3396.79/out/Release/
>> Command: /home/br-user/buildroot/output/host/bin/python2 --
>> /home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py
>> -s /home/br-user/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot
>> -a arm64 --system_libdir lib nss -v -lssl3
>> Returned 1.
>> stderr:
>>
>> Traceback (most recent call last):
>>   File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
>> line 232, in <module>
>>     sys.exit(main())
>>   File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
>> line 139, in main
>>     prefix = GetPkgConfigPrefixToStrip(options, args)
>>   File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
>> line 80, in GetPkgConfigPrefixToStrip
>>     "--variable=prefix"] + args, env=os.environ)
>>   File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
>> line 216, in check_output
>>     process = Popen(stdout=PIPE, *popenargs, **kwargs)
>>   File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
>> line 394, in __init__
>>     errread, errwrite)
>>   File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
>> line 1047, in _execute_child
>>     raise child_exception
>> OSError: [Errno 2] No such file or directory
>>
>> See //third_party/nss/BUILD.gn:15:3: whence it was called.
>>   pkg_config("system_nss_no_ssl_config") {
>>   ^---------------------------------------
>> See //crypto/BUILD.gn:221:25: which caused the file to be included.
>>     public_configs += [ "//third_party/nss:system_nss_no_ssl_config" ]
>>                         ^-------------------------------------------
>> package/pkg-generic.mk:219: recipe for target
>> '/home/br-user/buildroot/output/build/chromium-67.0.3396.79/.stamp_configured'
>> failed
>> make: *** [/home/br-user/buildroot/output/build/chromium-67.0.3396.79/.stamp_configured]
>> Error 1
>>
>
> I think this issue, along with a few others, have since been resolved
> in my chromium-v7-wip branch, which you can find at
> https://github.com/jakogut/buildroot.

I just tried out your chromium-v7-wip branch but unfortunately i get
the exact same error.  Note i'm building inside the
buildroot/base:20180318.1724 docker container.

Also, to get the code to build i had to change select
BR2_PACKAGE_JPEG_TURBO into BR2_PACKAGE_JPEG in
package/chromium/Config.in.  I think you should also change the
CHROMIUM_DEPENDENCIES from jpeg-turbo to jpeg and let the jpeg package
pick which jpeg library to use for the target.

Thanks

Martin
Hao HU July 26, 2018, 1:31 p.m. UTC | #6
Hello Joseph,

I have applied your v6 patch to the Buildroot 2018.05 and wanted to build
the chrome in a x86 arch. 

The Target option is like this :

/Target Architecture  : i386
Target Architecture Variant i586/

And I have added the following in the lld.mk

HOST_LLD_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_DYLIB_COMPONENTS=all

+ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
+CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
+endif 

And finally I have comment the following in the chromium.mk

+ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
+ # CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
+endif 

But now there is still a problem

/home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin/ld.lld:
error: can't create dynamic relocation R_386_32 against local symbol in
readonly segment; recompile object files with -fPIC
>>> defined in obj/third_party/ffmpeg/libffmpeg_yasm.a(ffmpeg_yasm/dct32.o)
>>> referenced by ../../third_party/ffmpeg/libavcodec/x86/dct32.asm
>>>               ffmpeg_yasm/dct32.o:(ff_dct32_float_sse) in archive
>>> obj/third_party/ffmpeg/libffmpeg_yasm.a

could you please tell me how to fix this problem?

thank you very much!

Hao





Joseph Kogut wrote
> Signed-off-by: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> ---
>  DEVELOPERS                                    |   1 +
>  package/Config.in                             |   1 +
>  ...iler_cpu_abi-for-buildroot-toolchain.patch | 102 ++++++++++++
>  .../0002-Fix-arm-build-with-glibc-2.27.patch  |  28 ++++
>  package/chromium/Config.in                    |  64 ++++++++
>  package/chromium/chromium.hash                |   3 +
>  package/chromium/chromium.mk                  | 146 ++++++++++++++++++
>  package/chromium/toolchain/BUILD.gn           |  71 +++++++++
>  8 files changed, 416 insertions(+)
>  create mode 100644
> package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
>  create mode 100644
> package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
>  create mode 100644 package/chromium/Config.in
>  create mode 100644 package/chromium/chromium.hash
>  create mode 100644 package/chromium/chromium.mk
>  create mode 100644 package/chromium/toolchain/BUILD.gn
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 05d2bdde20..e3dde531b4 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1058,6 +1058,7 @@ F:	package/rabbitmq-c/
>  N:	Joseph Kogut &lt;

> joseph.kogut@

> &gt;
>  F:	package/at-spi2-atk/
>  F:	package/at-spi2-core/
> +F:	package/chromium/
>  F:	package/gconf/
>  F:	package/libnss/
>  F:	package/lld/
> diff --git a/package/Config.in b/package/Config.in
> index 20fe5ad8ff..2515975df3 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -14,6 +14,7 @@ menu "Audio and video applications"
>  	source "package/aumix/Config.in"
>  	source "package/bellagio/Config.in"
>  	source "package/bluez-alsa/Config.in"
> +	source "package/chromium/Config.in"
>  	source "package/dvblast/Config.in"
>  	source "package/dvdauthor/Config.in"
>  	source "package/dvdrw-tools/Config.in"
> diff --git
> a/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
> b/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
> new file mode 100644
> index 0000000000..1848b0bd14
> --- /dev/null
> +++
> b/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
> @@ -0,0 +1,102 @@
> +From 3d5106d1d4720e1be8a4bd977be38743d6fb1f3c Mon Sep 17 00:00:00 2001
> +From: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> +Date: Sun, 10 Jun 2018 09:59:11 -0700
> +Subject: [PATCH] modify compiler_cpu_abi for buildroot toolchain
> +
> +Signed-off-by: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> +---
> + build/config/compiler/BUILD.gn | 36 +++++++++++++++++++---------------
> + 1 file changed, 20 insertions(+), 16 deletions(-)
> +
> +diff --git a/build/config/compiler/BUILD.gn
> b/build/config/compiler/BUILD.gn
> +index 461e62da2..27c9f29ed 100644
> +--- a/build/config/compiler/BUILD.gn
> ++++ b/build/config/compiler/BUILD.gn
> +@@ -683,6 +683,10 @@ config("compiler_cpu_abi") {
> +         "-march=x86-64",
> +       ]
> +       ldflags += [ "-m64" ]
> ++      if (is_clang) {
> ++        cflags += ["--target=x86_64-buildroot-linux-gnu"]
> ++        ldflags += ["--target=x86_64-buildroot-linux-gnu"]
> ++      }
> +     } else if (current_cpu == "x86") {
> +       cflags += [ "-m32" ]
> +       ldflags += [ "-m32" ]
> +@@ -695,8 +699,8 @@ config("compiler_cpu_abi") {
> +       }
> +     } else if (current_cpu == "arm") {
> +       if (is_clang && !is_android && !is_nacl) {
> +-        cflags += [ "--target=arm-linux-gnueabihf" ]
> +-        ldflags += [ "--target=arm-linux-gnueabihf" ]
> ++        cflags += [ "--target=arm-buildroot-linux-gnueabihf" ]
> ++        ldflags += [ "--target=arm-buildroot-linux-gnueabihf" ]
> +       }
> +       if (!is_nacl) {
> +         cflags += [
> +@@ -709,18 +713,18 @@ config("compiler_cpu_abi") {
> +       }
> +     } else if (current_cpu == "arm64") {
> +       if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
> +-        cflags += [ "--target=aarch64-linux-gnu" ]
> +-        ldflags += [ "--target=aarch64-linux-gnu" ]
> ++        cflags += [ "--target=aarch64-buildroot-linux-gnu" ]
> ++        ldflags += [ "--target=aarch64-buildroot-linux-gnu" ]
> +       }
> +     } else if (current_cpu == "mipsel" && !is_nacl) {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +           if (is_android) {
> +-            cflags += [ "--target=mipsel-linux-android" ]
> +-            ldflags += [ "--target=mipsel-linux-android" ]
> ++            cflags += [ "--target=mipsel-buildroot-linux-android" ]
> ++            ldflags += [ "--target=mipsel-buildroot-linux-android" ]
> +           } else {
> +-            cflags += [ "--target=mipsel-linux-gnu" ]
> +-            ldflags += [ "--target=mipsel-linux-gnu" ]
> ++            cflags += [ "--target=mipsel-buildroot-linux-gnu" ]
> ++            ldflags += [ "--target=mipsel-buildroot-linux-gnu" ]
> +           }
> +         } else {
> +           cflags += [ "-EL" ]
> +@@ -799,8 +803,8 @@ config("compiler_cpu_abi") {
> +     } else if (current_cpu == "mips" && !is_nacl) {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +-          cflags += [ "--target=mips-linux-gnu" ]
> +-          ldflags += [ "--target=mips-linux-gnu" ]
> ++          cflags += [ "--target=mips-buildroot-linux-gnu" ]
> ++          ldflags += [ "--target=mips-buildroot-linux-gnu" ]
> +         } else {
> +           cflags += [ "-EB" ]
> +           ldflags += [ "-EB" ]
> +@@ -844,11 +848,11 @@ config("compiler_cpu_abi") {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +           if (is_android) {
> +-            cflags += [ "--target=mips64el-linux-android" ]
> +-            ldflags += [ "--target=mips64el-linux-android" ]
> ++            cflags += [ "--target=mips64el-buildroot-linux-android" ]
> ++            ldflags += [ "--target=mips64el-buildroot-linux-android" ]
> +           } else {
> +-            cflags += [ "--target=mips64el-linux-gnuabi64" ]
> +-            ldflags += [ "--target=mips64el-linux-gnuabi64" ]
> ++            cflags += [ "--target=mips64el-buildroot-linux-gnuabi64" ]
> ++            ldflags += [ "--target=mips64el-buildroot-linux-gnuabi64" ]
> +           }
> +         } else {
> +           cflags += [
> +@@ -905,8 +909,8 @@ config("compiler_cpu_abi") {
> +     } else if (current_cpu == "mips64") {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +-          cflags += [ "--target=mips64-linux-gnuabi64" ]
> +-          ldflags += [ "--target=mips64-linux-gnuabi64" ]
> ++          cflags += [ "--target=mips64-buildroot-linux-gnuabi64" ]
> ++          ldflags += [ "--target=mips64-buildroot-linux-gnuabi64" ]
> +         } else {
> +           cflags += [
> +             "-EB",
> +-- 
> +2.17.1
> +
> diff --git a/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
> b/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
> new file mode 100644
> index 0000000000..8aebbd06c8
> --- /dev/null
> +++ b/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
> @@ -0,0 +1,28 @@
> +From aed4599c18586dfac46139a3c32011f804fdaef6 Mon Sep 17 00:00:00 2001
> +From: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> +Date: Wed, 13 Jun 2018 13:59:24 -0700
> +Subject: [PATCH] Fix arm build with glibc 2.27
> +
> +Upstream patch from:
> https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1060155
> +
> +Signed-off-by: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> +---
> + third_party/crashpad/crashpad/compat/linux/sys/ptrace.h | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> +index 73861576d..e5c95c7cc 100644
> +--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> ++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> +@@ -34,7 +34,7 @@ static constexpr __ptrace_request
> PTRACE_GET_THREAD_AREA =
> + #endif  // !PTRACE_GET_THREAD_AREA && !PT_GET_THREAD_AREA &&
> defined(__GLIBC__)
> + 
> + // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
> +-#if !defined(PTRACE_GETVFPREGS) && \
> ++#if !defined(PTRACE_GETVFPREGS) && !defined(PT_GETVFPREGS) && \
> +     defined(__GLIBC__) && (defined(__arm__) || defined(__arm64__))
> + static constexpr __ptrace_request PTRACE_GETVFPREGS =
> +     static_cast<__ptrace_request>(27);
> +-- 
> +2.17.1
> +
> diff --git a/package/chromium/Config.in b/package/chromium/Config.in
> new file mode 100644
> index 0000000000..fa04d3bbd2
> --- /dev/null
> +++ b/package/chromium/Config.in
> @@ -0,0 +1,64 @@
> +config BR2_PACKAGE_CHROMIUM_ARCH_SUPPORTS
> +	bool
> +	default y if BR2_arm
> +	default y if BR2_aarch64
> +	default y if BR2_i386
> +	default y if BR2_x86_64
> +
> +config BR2_PACKAGE_CHROMIUM_TARGET_ARCH
> +	string
> +	default "arm" if BR2_arm
> +	default "arm64" if BR2_aarch64
> +	default "x86" if BR2_i386
> +	default "x64" if BR2_x86_64
> +
> +menuconfig BR2_PACKAGE_CHROMIUM
> +	bool "chromium"
> +	depends on BR2_HOST_GCC_AT_LEAST_4_9 # gn requires -std=c++14
> +	depends on BR2_PACKAGE_HAS_LIBGL
> +	depends on BR2_PACKAGE_XORG7
> +	depends on BR2_TOOLCHAIN_USES_GLIBC
> +	select BR2_PACKAGE_AT_SPI2_ATK
> +	select BR2_PACKAGE_ALSA_LIB
> +	select BR2_PACKAGE_FREETYPE
> +	select BR2_PACKAGE_HARFBUZZ
> +	select BR2_PACKAGE_HOST_CLANG
> +	select BR2_PACKAGE_HOST_LLD
> +	select BR2_PACKAGE_HOST_NINJA
> +	select BR2_PACKAGE_HOST_NODEJS
> +	select BR2_PACKAGE_HOST_PYTHON
> +	select BR2_PACKAGE_JPEG
> +	select BR2_PACKAGE_LIBDRM
> +	select BR2_PACKAGE_LIBERATION # runtime
> +	select BR2_PACKAGE_LIBGLIB2
> +	select BR2_PACKAGE_LIBGTK2 if !BR2_PACKAGE_LIBGTK3_X11
> +	select BR2_PACKAGE_LIBKRB5
> +	select BR2_PACKAGE_LIBNSS
> +	select BR2_PACKAGE_LIBPNG
> +	select BR2_PACKAGE_XLIB_LIBXCOMPOSITE
> +	select BR2_PACKAGE_XLIB_LIBXCURSOR
> +	select BR2_PACKAGE_XLIB_LIBXI if !BR2_PACKAGE_LIBGTK3_X11
> +	select BR2_PACKAGE_XLIB_LIBXRANDR
> +	select BR2_PACKAGE_XLIB_LIBXSCRNSAVER
> +	select BR2_PACKAGE_XLIB_LIBXTST if !BR2_PACKAGE_LIBGTK3_X11
> +	help
> +	  Chromium is an open-source Web browser project started by
> +	  Google, to provide the source code for the proprietary
> +	  Google Chrome browser.
> +
> +if BR2_PACKAGE_CHROMIUM
> +
> +config BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS
> +	bool "Enable proprietary codecs"
> +	help
> +	  Enables proprietary codecs with additional licensing
> +	  restrictions, such as MP3 and H264
> +
> +endif # BR2_PACKAGE_CHROMIUM
> +
> +comment "chromium needs toolchain w/ Glibc, host gcc >= 4.9.0"
> +	depends on !BR2_TOOLCHAIN_USES_GLIBC \
> +		|| !BR2_HOST_GCC_AT_LEAST_4_9
> +
> +comment "chromium depends on X.org and needs an OpenGL backend"
> +	depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_HAS_LIBGL
> diff --git a/package/chromium/chromium.hash
> b/package/chromium/chromium.hash
> new file mode 100644
> index 0000000000..4c39ac5c08
> --- /dev/null
> +++ b/package/chromium/chromium.hash
> @@ -0,0 +1,3 @@
> +# locally calculated
> +sha256 f8b1e5319163e378027826b12cf256b97423bb90e10e2013469d96e03bc9db8a 
> chromium-67.0.3396.79.tar.xz
> +sha256 845022e0c1db1abb41a6ba4cd3c4b674ec290f3359d9d3c78ae558d4c0ed9308 
> LICENSE
> diff --git a/package/chromium/chromium.mk b/package/chromium/chromium.mk
> new file mode 100644
> index 0000000000..465eef17ad
> --- /dev/null
> +++ b/package/chromium/chromium.mk
> @@ -0,0 +1,146 @@
> +################################################################################
> +#
> +# Chromium
> +#
> +################################################################################
> +
> +CHROMIUM_VERSION = 67.0.3396.79
> +CHROMIUM_SITE =
> https://commondatastorage.googleapis.com/chromium-browser-official
> +CHROMIUM_SOURCE = chromium-$(CHROMIUM_VERSION).tar.xz
> +CHROMIUM_LICENSE = BSD-Style
> +CHROMIUM_LICENSE_FILES = LICENSE
> +CHROMIUM_DEPENDENCIES = alsa-lib cairo cups dbus freetype harfbuzz \
> +			host-clang host-lld host-ninja host-nodejs host-python \
> +			jpeg libdrm libglib2 libkrb5 libnss libpng pango \
> +			xlib_libXcomposite xlib_libXScrnSaver xlib_libXcursor \
> +			xlib_libXrandr zlib
> +
> +CHROMIUM_TOOLCHAIN_CONFIG_PATH = $(shell pwd)/package/chromium/toolchain
> +
> +CHROMIUM_OPTS = \
> +	host_toolchain=\"$(CHROMIUM_TOOLCHAIN_CONFIG_PATH):host\" \
> +	custom_toolchain=\"$(CHROMIUM_TOOLCHAIN_CONFIG_PATH):target\" \
> +	use_lld=true \
> +	is_clang=true \
> +	clang_use_chrome_plugins=false \
> +	treat_warnings_as_errors=false \
> +	use_gnome_keyring=false \
> +	linux_use_bundled_binutils=false \
> +	use_sysroot=true \
> +	target_sysroot=\"$(STAGING_DIR)\" \
> +	target_cpu=\"$(BR2_PACKAGE_CHROMIUM_TARGET_ARCH)\" \
> +	enable_nacl=false \
> +	use_dbus=true \
> +	use_system_zlib=true \
> +	use_system_libjpeg=true \
> +	use_system_libpng=true \
> +	use_system_libdrm=true \
> +	use_system_harfbuzz=true \
> +	use_system_freetype=true
> +
> +# tcmalloc has portability issues
> +CHROMIUM_OPTS += use_allocator=\"none\"
> +
> +# V8 snapshots require compiling V8 with the same word size as the target
> +# architecture, which means the host needs to have that toolchain
> available.
> +CHROMIUM_OPTS += v8_use_snapshot=false
> +
> +ifeq ($(BR2_ENABLE_DEBUG),y)
> +CHROMIUM_OPTS += is_debug=true
> +else
> +CHROMIUM_OPTS += is_debug=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_CUPS),y)
> +CHROMIUM_DEPENDENCIES += cups
> +CHROMIUM_OPTS += use_cups=true
> +else
> +CHROMIUM_OPTS += use_cups=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
> +CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DBUS),y)
> +CHROMIUM_OPTS += use_dbus=true
> +else
> +CHROMIUM_OPTS += use_dbus=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_PCIUTILS),y)
> +CHROMIUM_DEPENDENCIES += pciutils
> +CHROMIUM_OPTS += use_libpci=true
> +else
> +CHROMIUM_OPTS += use_libpci=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_PULSEAUDIO),y)
> +CHROMIUM_DEPENDENCIES += pulseaudio
> +CHROMIUM_OPTS += use_pulseaudio=true
> +else
> +CHROMIUM_OPTS += use_pulseaudio=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_LIBGTK3_X11),y)
> +CHROMIUM_DEPENDENCIES += libgtk3
> +CHROMIUM_OPTS += use_gtk3=true
> +else
> +CHROMIUM_DEPENDENCIES += libgtk2 xlib_libXi xlib_libXtst
> +CHROMIUM_OPTS += use_gtk3=false
> +endif
> +
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
> +CHROMIUM_TARGET_LDFLAGS +=
> --gcc-toolchain=$(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
> +else
> +CHROMIUM_TARGET_LDFLAGS += --gcc-toolchain=$(HOST_DIR)
> +endif
> +
> +CHROMIUM_TARGET_CFLAGS += $(CHROMIUM_TARGET_LDFLAGS)
> +CHROMIUM_TARGET_CXXFLAGS += $(CHROMIUM_TARGET_CFLAGS)
> +
> +define CHROMIUM_CONFIGURE_CMDS
> +	mkdir -p $(@D)/third_party/node/linux/node-linux-x64/bin
> +	ln -sf $(HOST_DIR)/bin/node
> $(@D)/third_party/node/linux/node-linux-x64/bin/
> +
> +	( cd $(@D); \
> +		$(TARGET_MAKE_ENV) \
> +		$(HOST_DIR)/bin/python2 tools/gn/bootstrap/bootstrap.py -s --no-clean;
> \
> +		HOST_AR="$(HOSTAR)" \
> +		HOST_NM="$(HOSTNM)" \
> +		HOST_CC="$(HOSTCC)" \
> +		HOST_CXX="$(HOSTCXX)" \
> +		HOST_CFLAGS="$(HOST_CFLAGS)" \
> +		HOST_CXXFLAGS="$(HOST_CXXFLAGS)" \
> +		TARGET_AR="ar" \
> +		TARGET_NM="nm" \
> +		TARGET_CC="clang" \
> +		TARGET_CXX="clang++" \
> +		TARGET_CFLAGS="$(CHROMIUM_TARGET_CFLAGS)" \
> +		TARGET_CXXFLAGS="$(CHROMIUM_TARGET_CXXFLAGS)" \
> +		TARGET_LDFLAGS="$(CHROMIUM_TARGET_LDFLAGS)" \
> +		out/Release/gn gen out/Release --args="$(CHROMIUM_OPTS)" \
> +			--script-executable=$(HOST_DIR)/bin/python2 \
> +	)
> +endef
> +
> +define CHROMIUM_BUILD_CMDS
> +	( cd $(@D); \
> +		$(TARGET_MAKE_ENV) \
> +		ninja -j$(PARALLEL_JOBS) -C out/Release chrome chrome_sandbox
> chromedriver \
> +	)
> +endef
> +
> +define CHROMIUM_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D $(@D)/out/Release/chrome
> $(TARGET_DIR)/usr/lib/chromium/chromium
> +	$(INSTALL) -Dm4755 $(@D)/out/Release/chrome_sandbox \
> +		$(TARGET_DIR)/usr/lib/chromium/chrome-sandbox
> +	cp $(@D)/out/Release/{chrome_{100,200}_percent,resources}.pak \
> +		$(@D)/out/Release/chromedriver \
> +		$(TARGET_DIR)/usr/lib/chromium/
> +	$(INSTALL) -Dm644 -t $(TARGET_DIR)/usr/lib/chromium/locales \
> +		$(@D)/out/Release/locales/*.pak
> +	cp $(@D)/out/Release/icudtl.dat $(TARGET_DIR)/usr/lib/chromium/
> +endef
> +
> +$(eval $(generic-package))
> diff --git a/package/chromium/toolchain/BUILD.gn
> b/package/chromium/toolchain/BUILD.gn
> new file mode 100644
> index 0000000000..e8525bd67d
> --- /dev/null
> +++ b/package/chromium/toolchain/BUILD.gn
> @@ -0,0 +1,71 @@
> +import("//build/toolchain/gcc_toolchain.gni")
> +import("//build/config/sysroot.gni")
> +
> +gcc_toolchain("host") {
> +  cc = getenv("HOST_CC")
> +  cxx = getenv("HOST_CXX")
> +  ar = getenv("HOST_AR")
> +  nm = getenv("HOST_NM")
> +  ld = cxx
> +
> +  extra_cflags = getenv("HOST_CFLAGS")
> +  extra_cppflags = getenv("HOST_CPPFLAGS")
> +  extra_cxxflags = getenv("HOST_CXXFLAGS")
> +  extra_ldflags = getenv("HOST_LDFLAGS")
> +
> +  toolchain_args = {
> +    cc_wrapper = ""
> +    current_cpu = host_cpu
> +    current_os = host_os
> +    is_clang = false
> +    use_sysroot = false
> +    use_lld = false
> +  }
> +}
> +
> +gcc_toolchain("target") {
> +  cc = getenv("TARGET_CC")
> +  cxx = getenv("TARGET_CXX")
> +  ar = getenv("TARGET_AR")
> +  nm = getenv("TARGET_NM")
> +  ld = cxx
> +
> +  extra_cflags = getenv("TARGET_CFLAGS")
> +  extra_cppflags = getenv("TARGET_CPPFLAGS")
> +  extra_cxxflags = getenv("TARGET_CXXFLAGS")
> +  extra_ldflags = getenv("TARGET_LDFLAGS")
> +
> +  toolchain_args = {
> +    cc_wrapper = ""
> +    current_cpu = target_cpu
> +    current_os = target_os
> +    is_clang = is_clang
> +    use_sysroot = use_sysroot
> +  }
> +}
> +
> +gcc_toolchain("v8_snapshot") {
> +  cc = getenv("V8_CC")
> +  cxx = getenv("V8_CXX")
> +  ar = getenv("V8_AR")
> +  nm = getenv("V8_NM")
> +  ld = cxx
> +
> +  extra_cflags = getenv("V8_CFLAGS")
> +  extra_cppflags = getenv("V8_CPPFLAGS")
> +  extra_cxxflags = getenv("V8_CXXFLAGS")
> +  extra_ldflags = getenv("V8_LDFLAGS")
> +
> +  toolchain_args = {
> +    cc_wrapper = ""
> +    if (target_cpu == "x86" || target_cpu == "arm" || target_cpu ==
> "mipsel") {
> +      current_cpu = "x86"
> +    } else {
> +      current_cpu = "x64"
> +    }
> +    current_os = host_os
> +    is_clang = is_clang
> +    use_sysroot = false
> +  }
> +}
> +
> -- 
> 2.18.0
> 
> _______________________________________________
> buildroot mailing list

> buildroot@

> http://lists.busybox.net/mailman/listinfo/buildroot


Joseph Kogut wrote
> Signed-off-by: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> ---
>  DEVELOPERS                                    |   1 +
>  package/Config.in                             |   1 +
>  ...iler_cpu_abi-for-buildroot-toolchain.patch | 102 ++++++++++++
>  .../0002-Fix-arm-build-with-glibc-2.27.patch  |  28 ++++
>  package/chromium/Config.in                    |  64 ++++++++
>  package/chromium/chromium.hash                |   3 +
>  package/chromium/chromium.mk                  | 146 ++++++++++++++++++
>  package/chromium/toolchain/BUILD.gn           |  71 +++++++++
>  8 files changed, 416 insertions(+)
>  create mode 100644
> package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
>  create mode 100644
> package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
>  create mode 100644 package/chromium/Config.in
>  create mode 100644 package/chromium/chromium.hash
>  create mode 100644 package/chromium/chromium.mk
>  create mode 100644 package/chromium/toolchain/BUILD.gn
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 05d2bdde20..e3dde531b4 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1058,6 +1058,7 @@ F:	package/rabbitmq-c/
>  N:	Joseph Kogut &lt;

> joseph.kogut@

> &gt;
>  F:	package/at-spi2-atk/
>  F:	package/at-spi2-core/
> +F:	package/chromium/
>  F:	package/gconf/
>  F:	package/libnss/
>  F:	package/lld/
> diff --git a/package/Config.in b/package/Config.in
> index 20fe5ad8ff..2515975df3 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -14,6 +14,7 @@ menu "Audio and video applications"
>  	source "package/aumix/Config.in"
>  	source "package/bellagio/Config.in"
>  	source "package/bluez-alsa/Config.in"
> +	source "package/chromium/Config.in"
>  	source "package/dvblast/Config.in"
>  	source "package/dvdauthor/Config.in"
>  	source "package/dvdrw-tools/Config.in"
> diff --git
> a/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
> b/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
> new file mode 100644
> index 0000000000..1848b0bd14
> --- /dev/null
> +++
> b/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
> @@ -0,0 +1,102 @@
> +From 3d5106d1d4720e1be8a4bd977be38743d6fb1f3c Mon Sep 17 00:00:00 2001
> +From: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> +Date: Sun, 10 Jun 2018 09:59:11 -0700
> +Subject: [PATCH] modify compiler_cpu_abi for buildroot toolchain
> +
> +Signed-off-by: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> +---
> + build/config/compiler/BUILD.gn | 36 +++++++++++++++++++---------------
> + 1 file changed, 20 insertions(+), 16 deletions(-)
> +
> +diff --git a/build/config/compiler/BUILD.gn
> b/build/config/compiler/BUILD.gn
> +index 461e62da2..27c9f29ed 100644
> +--- a/build/config/compiler/BUILD.gn
> ++++ b/build/config/compiler/BUILD.gn
> +@@ -683,6 +683,10 @@ config("compiler_cpu_abi") {
> +         "-march=x86-64",
> +       ]
> +       ldflags += [ "-m64" ]
> ++      if (is_clang) {
> ++        cflags += ["--target=x86_64-buildroot-linux-gnu"]
> ++        ldflags += ["--target=x86_64-buildroot-linux-gnu"]
> ++      }
> +     } else if (current_cpu == "x86") {
> +       cflags += [ "-m32" ]
> +       ldflags += [ "-m32" ]
> +@@ -695,8 +699,8 @@ config("compiler_cpu_abi") {
> +       }
> +     } else if (current_cpu == "arm") {
> +       if (is_clang && !is_android && !is_nacl) {
> +-        cflags += [ "--target=arm-linux-gnueabihf" ]
> +-        ldflags += [ "--target=arm-linux-gnueabihf" ]
> ++        cflags += [ "--target=arm-buildroot-linux-gnueabihf" ]
> ++        ldflags += [ "--target=arm-buildroot-linux-gnueabihf" ]
> +       }
> +       if (!is_nacl) {
> +         cflags += [
> +@@ -709,18 +713,18 @@ config("compiler_cpu_abi") {
> +       }
> +     } else if (current_cpu == "arm64") {
> +       if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
> +-        cflags += [ "--target=aarch64-linux-gnu" ]
> +-        ldflags += [ "--target=aarch64-linux-gnu" ]
> ++        cflags += [ "--target=aarch64-buildroot-linux-gnu" ]
> ++        ldflags += [ "--target=aarch64-buildroot-linux-gnu" ]
> +       }
> +     } else if (current_cpu == "mipsel" && !is_nacl) {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +           if (is_android) {
> +-            cflags += [ "--target=mipsel-linux-android" ]
> +-            ldflags += [ "--target=mipsel-linux-android" ]
> ++            cflags += [ "--target=mipsel-buildroot-linux-android" ]
> ++            ldflags += [ "--target=mipsel-buildroot-linux-android" ]
> +           } else {
> +-            cflags += [ "--target=mipsel-linux-gnu" ]
> +-            ldflags += [ "--target=mipsel-linux-gnu" ]
> ++            cflags += [ "--target=mipsel-buildroot-linux-gnu" ]
> ++            ldflags += [ "--target=mipsel-buildroot-linux-gnu" ]
> +           }
> +         } else {
> +           cflags += [ "-EL" ]
> +@@ -799,8 +803,8 @@ config("compiler_cpu_abi") {
> +     } else if (current_cpu == "mips" && !is_nacl) {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +-          cflags += [ "--target=mips-linux-gnu" ]
> +-          ldflags += [ "--target=mips-linux-gnu" ]
> ++          cflags += [ "--target=mips-buildroot-linux-gnu" ]
> ++          ldflags += [ "--target=mips-buildroot-linux-gnu" ]
> +         } else {
> +           cflags += [ "-EB" ]
> +           ldflags += [ "-EB" ]
> +@@ -844,11 +848,11 @@ config("compiler_cpu_abi") {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +           if (is_android) {
> +-            cflags += [ "--target=mips64el-linux-android" ]
> +-            ldflags += [ "--target=mips64el-linux-android" ]
> ++            cflags += [ "--target=mips64el-buildroot-linux-android" ]
> ++            ldflags += [ "--target=mips64el-buildroot-linux-android" ]
> +           } else {
> +-            cflags += [ "--target=mips64el-linux-gnuabi64" ]
> +-            ldflags += [ "--target=mips64el-linux-gnuabi64" ]
> ++            cflags += [ "--target=mips64el-buildroot-linux-gnuabi64" ]
> ++            ldflags += [ "--target=mips64el-buildroot-linux-gnuabi64" ]
> +           }
> +         } else {
> +           cflags += [
> +@@ -905,8 +909,8 @@ config("compiler_cpu_abi") {
> +     } else if (current_cpu == "mips64") {
> +       if (custom_toolchain == "") {
> +         if (is_clang) {
> +-          cflags += [ "--target=mips64-linux-gnuabi64" ]
> +-          ldflags += [ "--target=mips64-linux-gnuabi64" ]
> ++          cflags += [ "--target=mips64-buildroot-linux-gnuabi64" ]
> ++          ldflags += [ "--target=mips64-buildroot-linux-gnuabi64" ]
> +         } else {
> +           cflags += [
> +             "-EB",
> +-- 
> +2.17.1
> +
> diff --git a/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
> b/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
> new file mode 100644
> index 0000000000..8aebbd06c8
> --- /dev/null
> +++ b/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
> @@ -0,0 +1,28 @@
> +From aed4599c18586dfac46139a3c32011f804fdaef6 Mon Sep 17 00:00:00 2001
> +From: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> +Date: Wed, 13 Jun 2018 13:59:24 -0700
> +Subject: [PATCH] Fix arm build with glibc 2.27
> +
> +Upstream patch from:
> https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1060155
> +
> +Signed-off-by: Joseph Kogut &lt;

> joseph.kogut@

> &gt;
> +---
> + third_party/crashpad/crashpad/compat/linux/sys/ptrace.h | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> +index 73861576d..e5c95c7cc 100644
> +--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> ++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
> +@@ -34,7 +34,7 @@ static constexpr __ptrace_request
> PTRACE_GET_THREAD_AREA =
> + #endif  // !PTRACE_GET_THREAD_AREA && !PT_GET_THREAD_AREA &&
> defined(__GLIBC__)
> + 
> + // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
> +-#if !defined(PTRACE_GETVFPREGS) && \
> ++#if !defined(PTRACE_GETVFPREGS) && !defined(PT_GETVFPREGS) && \
> +     defined(__GLIBC__) && (defined(__arm__) || defined(__arm64__))
> + static constexpr __ptrace_request PTRACE_GETVFPREGS =
> +     static_cast<__ptrace_request>(27);
> +-- 
> +2.17.1
> +
> diff --git a/package/chromium/Config.in b/package/chromium/Config.in
> new file mode 100644
> index 0000000000..fa04d3bbd2
> --- /dev/null
> +++ b/package/chromium/Config.in
> @@ -0,0 +1,64 @@
> +config BR2_PACKAGE_CHROMIUM_ARCH_SUPPORTS
> +	bool
> +	default y if BR2_arm
> +	default y if BR2_aarch64
> +	default y if BR2_i386
> +	default y if BR2_x86_64
> +
> +config BR2_PACKAGE_CHROMIUM_TARGET_ARCH
> +	string
> +	default "arm" if BR2_arm
> +	default "arm64" if BR2_aarch64
> +	default "x86" if BR2_i386
> +	default "x64" if BR2_x86_64
> +
> +menuconfig BR2_PACKAGE_CHROMIUM
> +	bool "chromium"
> +	depends on BR2_HOST_GCC_AT_LEAST_4_9 # gn requires -std=c++14
> +	depends on BR2_PACKAGE_HAS_LIBGL
> +	depends on BR2_PACKAGE_XORG7
> +	depends on BR2_TOOLCHAIN_USES_GLIBC
> +	select BR2_PACKAGE_AT_SPI2_ATK
> +	select BR2_PACKAGE_ALSA_LIB
> +	select BR2_PACKAGE_FREETYPE
> +	select BR2_PACKAGE_HARFBUZZ
> +	select BR2_PACKAGE_HOST_CLANG
> +	select BR2_PACKAGE_HOST_LLD
> +	select BR2_PACKAGE_HOST_NINJA
> +	select BR2_PACKAGE_HOST_NODEJS
> +	select BR2_PACKAGE_HOST_PYTHON
> +	select BR2_PACKAGE_JPEG
> +	select BR2_PACKAGE_LIBDRM
> +	select BR2_PACKAGE_LIBERATION # runtime
> +	select BR2_PACKAGE_LIBGLIB2
> +	select BR2_PACKAGE_LIBGTK2 if !BR2_PACKAGE_LIBGTK3_X11
> +	select BR2_PACKAGE_LIBKRB5
> +	select BR2_PACKAGE_LIBNSS
> +	select BR2_PACKAGE_LIBPNG
> +	select BR2_PACKAGE_XLIB_LIBXCOMPOSITE
> +	select BR2_PACKAGE_XLIB_LIBXCURSOR
> +	select BR2_PACKAGE_XLIB_LIBXI if !BR2_PACKAGE_LIBGTK3_X11
> +	select BR2_PACKAGE_XLIB_LIBXRANDR
> +	select BR2_PACKAGE_XLIB_LIBXSCRNSAVER
> +	select BR2_PACKAGE_XLIB_LIBXTST if !BR2_PACKAGE_LIBGTK3_X11
> +	help
> +	  Chromium is an open-source Web browser project started by
> +	  Google, to provide the source code for the proprietary
> +	  Google Chrome browser.
> +
> +if BR2_PACKAGE_CHROMIUM
> +
> +config BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS
> +	bool "Enable proprietary codecs"
> +	help
> +	  Enables proprietary codecs with additional licensing
> +	  restrictions, such as MP3 and H264
> +
> +endif # BR2_PACKAGE_CHROMIUM
> +
> +comment "chromium needs toolchain w/ Glibc, host gcc >= 4.9.0"
> +	depends on !BR2_TOOLCHAIN_USES_GLIBC \
> +		|| !BR2_HOST_GCC_AT_LEAST_4_9
> +
> +comment "chromium depends on X.org and needs an OpenGL backend"
> +	depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_HAS_LIBGL
> diff --git a/package/chromium/chromium.hash
> b/package/chromium/chromium.hash
> new file mode 100644
> index 0000000000..4c39ac5c08
> --- /dev/null
> +++ b/package/chromium/chromium.hash
> @@ -0,0 +1,3 @@
> +# locally calculated
> +sha256 f8b1e5319163e378027826b12cf256b97423bb90e10e2013469d96e03bc9db8a 
> chromium-67.0.3396.79.tar.xz
> +sha256 845022e0c1db1abb41a6ba4cd3c4b674ec290f3359d9d3c78ae558d4c0ed9308 
> LICENSE
> diff --git a/package/chromium/chromium.mk b/package/chromium/chromium.mk
> new file mode 100644
> index 0000000000..465eef17ad
> --- /dev/null
> +++ b/package/chromium/chromium.mk
> @@ -0,0 +1,146 @@
> +################################################################################
> +#
> +# Chromium
> +#
> +################################################################################
> +
> +CHROMIUM_VERSION = 67.0.3396.79
> +CHROMIUM_SITE =
> https://commondatastorage.googleapis.com/chromium-browser-official
> +CHROMIUM_SOURCE = chromium-$(CHROMIUM_VERSION).tar.xz
> +CHROMIUM_LICENSE = BSD-Style
> +CHROMIUM_LICENSE_FILES = LICENSE
> +CHROMIUM_DEPENDENCIES = alsa-lib cairo cups dbus freetype harfbuzz \
> +			host-clang host-lld host-ninja host-nodejs host-python \
> +			jpeg libdrm libglib2 libkrb5 libnss libpng pango \
> +			xlib_libXcomposite xlib_libXScrnSaver xlib_libXcursor \
> +			xlib_libXrandr zlib
> +
> +CHROMIUM_TOOLCHAIN_CONFIG_PATH = $(shell pwd)/package/chromium/toolchain
> +
> +CHROMIUM_OPTS = \
> +	host_toolchain=\"$(CHROMIUM_TOOLCHAIN_CONFIG_PATH):host\" \
> +	custom_toolchain=\"$(CHROMIUM_TOOLCHAIN_CONFIG_PATH):target\" \
> +	use_lld=true \
> +	is_clang=true \
> +	clang_use_chrome_plugins=false \
> +	treat_warnings_as_errors=false \
> +	use_gnome_keyring=false \
> +	linux_use_bundled_binutils=false \
> +	use_sysroot=true \
> +	target_sysroot=\"$(STAGING_DIR)\" \
> +	target_cpu=\"$(BR2_PACKAGE_CHROMIUM_TARGET_ARCH)\" \
> +	enable_nacl=false \
> +	use_dbus=true \
> +	use_system_zlib=true \
> +	use_system_libjpeg=true \
> +	use_system_libpng=true \
> +	use_system_libdrm=true \
> +	use_system_harfbuzz=true \
> +	use_system_freetype=true
> +
> +# tcmalloc has portability issues
> +CHROMIUM_OPTS += use_allocator=\"none\"
> +
> +# V8 snapshots require compiling V8 with the same word size as the target
> +# architecture, which means the host needs to have that toolchain
> available.
> +CHROMIUM_OPTS += v8_use_snapshot=false
> +
> +ifeq ($(BR2_ENABLE_DEBUG),y)
> +CHROMIUM_OPTS += is_debug=true
> +else
> +CHROMIUM_OPTS += is_debug=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_CUPS),y)
> +CHROMIUM_DEPENDENCIES += cups
> +CHROMIUM_OPTS += use_cups=true
> +else
> +CHROMIUM_OPTS += use_cups=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
> +CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DBUS),y)
> +CHROMIUM_OPTS += use_dbus=true
> +else
> +CHROMIUM_OPTS += use_dbus=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_PCIUTILS),y)
> +CHROMIUM_DEPENDENCIES += pciutils
> +CHROMIUM_OPTS += use_libpci=true
> +else
> +CHROMIUM_OPTS += use_libpci=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_PULSEAUDIO),y)
> +CHROMIUM_DEPENDENCIES += pulseaudio
> +CHROMIUM_OPTS += use_pulseaudio=true
> +else
> +CHROMIUM_OPTS += use_pulseaudio=false
> +endif
> +
> +ifeq ($(BR2_PACKAGE_LIBGTK3_X11),y)
> +CHROMIUM_DEPENDENCIES += libgtk3
> +CHROMIUM_OPTS += use_gtk3=true
> +else
> +CHROMIUM_DEPENDENCIES += libgtk2 xlib_libXi xlib_libXtst
> +CHROMIUM_OPTS += use_gtk3=false
> +endif
> +
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
> +CHROMIUM_TARGET_LDFLAGS +=
> --gcc-toolchain=$(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
> +else
> +CHROMIUM_TARGET_LDFLAGS += --gcc-toolchain=$(HOST_DIR)
> +endif
> +
> +CHROMIUM_TARGET_CFLAGS += $(CHROMIUM_TARGET_LDFLAGS)
> +CHROMIUM_TARGET_CXXFLAGS += $(CHROMIUM_TARGET_CFLAGS)
> +
> +define CHROMIUM_CONFIGURE_CMDS
> +	mkdir -p $(@D)/third_party/node/linux/node-linux-x64/bin
> +	ln -sf $(HOST_DIR)/bin/node
> $(@D)/third_party/node/linux/node-linux-x64/bin/
> +
> +	( cd $(@D); \
> +		$(TARGET_MAKE_ENV) \
> +		$(HOST_DIR)/bin/python2 tools/gn/bootstrap/bootstrap.py -s --no-clean;
> \
> +		HOST_AR="$(HOSTAR)" \
> +		HOST_NM="$(HOSTNM)" \
> +		HOST_CC="$(HOSTCC)" \
> +		HOST_CXX="$(HOSTCXX)" \
> +		HOST_CFLAGS="$(HOST_CFLAGS)" \
> +		HOST_CXXFLAGS="$(HOST_CXXFLAGS)" \
> +		TARGET_AR="ar" \
> +		TARGET_NM="nm" \
> +		TARGET_CC="clang" \
> +		TARGET_CXX="clang++" \
> +		TARGET_CFLAGS="$(CHROMIUM_TARGET_CFLAGS)" \
> +		TARGET_CXXFLAGS="$(CHROMIUM_TARGET_CXXFLAGS)" \
> +		TARGET_LDFLAGS="$(CHROMIUM_TARGET_LDFLAGS)" \
> +		out/Release/gn gen out/Release --args="$(CHROMIUM_OPTS)" \
> +			--script-executable=$(HOST_DIR)/bin/python2 \
> +	)
> +endef
> +
> +define CHROMIUM_BUILD_CMDS
> +	( cd $(@D); \
> +		$(TARGET_MAKE_ENV) \
> +		ninja -j$(PARALLEL_JOBS) -C out/Release chrome chrome_sandbox
> chromedriver \
> +	)
> +endef
> +
> +define CHROMIUM_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D $(@D)/out/Release/chrome
> $(TARGET_DIR)/usr/lib/chromium/chromium
> +	$(INSTALL) -Dm4755 $(@D)/out/Release/chrome_sandbox \
> +		$(TARGET_DIR)/usr/lib/chromium/chrome-sandbox
> +	cp $(@D)/out/Release/{chrome_{100,200}_percent,resources}.pak \
> +		$(@D)/out/Release/chromedriver \
> +		$(TARGET_DIR)/usr/lib/chromium/
> +	$(INSTALL) -Dm644 -t $(TARGET_DIR)/usr/lib/chromium/locales \
> +		$(@D)/out/Release/locales/*.pak
> +	cp $(@D)/out/Release/icudtl.dat $(TARGET_DIR)/usr/lib/chromium/
> +endef
> +
> +$(eval $(generic-package))
> diff --git a/package/chromium/toolchain/BUILD.gn
> b/package/chromium/toolchain/BUILD.gn
> new file mode 100644
> index 0000000000..e8525bd67d
> --- /dev/null
> +++ b/package/chromium/toolchain/BUILD.gn
> @@ -0,0 +1,71 @@
> +import("//build/toolchain/gcc_toolchain.gni")
> +import("//build/config/sysroot.gni")
> +
> +gcc_toolchain("host") {
> +  cc = getenv("HOST_CC")
> +  cxx = getenv("HOST_CXX")
> +  ar = getenv("HOST_AR")
> +  nm = getenv("HOST_NM")
> +  ld = cxx
> +
> +  extra_cflags = getenv("HOST_CFLAGS")
> +  extra_cppflags = getenv("HOST_CPPFLAGS")
> +  extra_cxxflags = getenv("HOST_CXXFLAGS")
> +  extra_ldflags = getenv("HOST_LDFLAGS")
> +
> +  toolchain_args = {
> +    cc_wrapper = ""
> +    current_cpu = host_cpu
> +    current_os = host_os
> +    is_clang = false
> +    use_sysroot = false
> +    use_lld = false
> +  }
> +}
> +
> +gcc_toolchain("target") {
> +  cc = getenv("TARGET_CC")
> +  cxx = getenv("TARGET_CXX")
> +  ar = getenv("TARGET_AR")
> +  nm = getenv("TARGET_NM")
> +  ld = cxx
> +
> +  extra_cflags = getenv("TARGET_CFLAGS")
> +  extra_cppflags = getenv("TARGET_CPPFLAGS")
> +  extra_cxxflags = getenv("TARGET_CXXFLAGS")
> +  extra_ldflags = getenv("TARGET_LDFLAGS")
> +
> +  toolchain_args = {
> +    cc_wrapper = ""
> +    current_cpu = target_cpu
> +    current_os = target_os
> +    is_clang = is_clang
> +    use_sysroot = use_sysroot
> +  }
> +}
> +
> +gcc_toolchain("v8_snapshot") {
> +  cc = getenv("V8_CC")
> +  cxx = getenv("V8_CXX")
> +  ar = getenv("V8_AR")
> +  nm = getenv("V8_NM")
> +  ld = cxx
> +
> +  extra_cflags = getenv("V8_CFLAGS")
> +  extra_cppflags = getenv("V8_CPPFLAGS")
> +  extra_cxxflags = getenv("V8_CXXFLAGS")
> +  extra_ldflags = getenv("V8_LDFLAGS")
> +
> +  toolchain_args = {
> +    cc_wrapper = ""
> +    if (target_cpu == "x86" || target_cpu == "arm" || target_cpu ==
> "mipsel") {
> +      current_cpu = "x86"
> +    } else {
> +      current_cpu = "x64"
> +    }
> +    current_os = host_os
> +    is_clang = is_clang
> +    use_sysroot = false
> +  }
> +}
> +
> -- 
> 2.18.0
> 
> _______________________________________________
> buildroot mailing list

> buildroot@

> http://lists.busybox.net/mailman/listinfo/buildroot





--
Sent from: http://buildroot-busybox.2317881.n4.nabble.com/
Joseph Kogut July 26, 2018, 6:51 p.m. UTC | #7
On Tue, Jul 17, 2018 at 4:43 AM Martin Bark <martin@barkynet.com> wrote:
>
> Joseph,
>
> On 16 July 2018 at 17:29, Joseph Kogut <joseph.kogut@gmail.com> wrote:
> > Martin,
> >
> > On Sun, Jul 15, 2018 at 2:54 PM Martin Bark <martin@barkynet.com> wrote:
> >>
> >> Joseph,
> >>
> >> On 14 July 2018 at 23:57, Joseph Kogut <joseph.kogut@gmail.com> wrote:
> >> > Hi Martin,
> >> >
> >> > On Sat, Jul 14, 2018 at 12:11 PM Martin Bark <martin@barkynet.com> wrote:
> >> >>
> >> > <snip>
> >> >>
> >> >> I tried building for an aarch64 target and it fails with the error
> >> >>
> >> >> ERROR at //chrome/installer/linux/BUILD.gn:413:7: Assertion failed.
> >> >>       assert(false, "Linux installer not configured for this architecture.")
> >> >>
> >> >> Looking at chrome/installer/linux/BUILD.gn it seems only i386, x86_64,
> >> >> arm, mipsel and mips64el target architectures are supported.  I think
> >> >> you need to remove BR2_aarch64 and add BR2_mipsel and BR2_mips64el
> >> >>
> >> >
> >> > Can you try adding the argument "enable_linux_installer=false" to
> >> > CHROMIUM_OPTS in chromium.mk, then reconfiguring and rebuilding?
> >> >
> >> > I believe the "linux installer" target here is simply packaging for
> >> > Debian and Fedora, which this package doesn't use.
> >> >
> >>
> >> Thanks, that go the build further.  Now it fails with the following
> >> error.  Any ideas?
> >>
> >>
> >>
> >> ERROR at //build/config/linux/pkg_config.gni:103:17: Script returned
> >> non-zero exit code.
> >>     pkgresult = exec_script(pkg_config_script, args, "value")
> >>                 ^----------
> >> Current dir: /home/br-user/buildroot/output/build/chromium-67.0.3396.79/out/Release/
> >> Command: /home/br-user/buildroot/output/host/bin/python2 --
> >> /home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py
> >> -s /home/br-user/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot
> >> -a arm64 --system_libdir lib nss -v -lssl3
> >> Returned 1.
> >> stderr:
> >>
> >> Traceback (most recent call last):
> >>   File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
> >> line 232, in <module>
> >>     sys.exit(main())
> >>   File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
> >> line 139, in main
> >>     prefix = GetPkgConfigPrefixToStrip(options, args)
> >>   File "/home/br-user/buildroot/output/build/chromium-67.0.3396.79/build/config/linux/pkg-config.py",
> >> line 80, in GetPkgConfigPrefixToStrip
> >>     "--variable=prefix"] + args, env=os.environ)
> >>   File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
> >> line 216, in check_output
> >>     process = Popen(stdout=PIPE, *popenargs, **kwargs)
> >>   File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
> >> line 394, in __init__
> >>     errread, errwrite)
> >>   File "/home/br-user/buildroot/output/host/lib/python2.7/subprocess.py",
> >> line 1047, in _execute_child
> >>     raise child_exception
> >> OSError: [Errno 2] No such file or directory
> >>
> >> See //third_party/nss/BUILD.gn:15:3: whence it was called.
> >>   pkg_config("system_nss_no_ssl_config") {
> >>   ^---------------------------------------
> >> See //crypto/BUILD.gn:221:25: which caused the file to be included.
> >>     public_configs += [ "//third_party/nss:system_nss_no_ssl_config" ]
> >>                         ^-------------------------------------------
> >> package/pkg-generic.mk:219: recipe for target
> >> '/home/br-user/buildroot/output/build/chromium-67.0.3396.79/.stamp_configured'
> >> failed
> >> make: *** [/home/br-user/buildroot/output/build/chromium-67.0.3396.79/.stamp_configured]
> >> Error 1
> >>
> >
> > I think this issue, along with a few others, have since been resolved
> > in my chromium-v7-wip branch, which you can find at
> > https://github.com/jakogut/buildroot.
>
> I just tried out your chromium-v7-wip branch but unfortunately i get
> the exact same error.  Note i'm building inside the
> buildroot/base:20180318.1724 docker container.
>
> Also, to get the code to build i had to change select
> BR2_PACKAGE_JPEG_TURBO into BR2_PACKAGE_JPEG in
> package/chromium/Config.in.  I think you should also change the
> CHROMIUM_DEPENDENCIES from jpeg-turbo to jpeg and let the jpeg package
> pick which jpeg library to use for the target.
>

Skia depends on libjpeg-turbo, and will fail during linking if it's
not selected. Specfically, what build error did you encounter?
Joseph Kogut July 26, 2018, 7:01 p.m. UTC | #8
Hi Hao,

On Thu, Jul 26, 2018 at 6:37 AM Hao HU <huhao526200@gmail.com> wrote:
>
> Hello Joseph,
>
> I have applied your v6 patch to the Buildroot 2018.05 and wanted to build
> the chrome in a x86 arch.
>
> The Target option is like this :
>
> /Target Architecture  : i386
> Target Architecture Variant i586/
>
> And I have added the following in the lld.mk
>
> HOST_LLD_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_DYLIB_COMPONENTS=all
>
> +ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
> +CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
> +endif
>
> And finally I have comment the following in the chromium.mk
>
> +ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
> + # CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
> +endif
>

I'm not sure what the intent is here. Chromium codec options belong in
the Chromium makefile, not the LLD makefile. Were you encountering a
build error related to enabling Chromium proprietary codecs?

> But now there is still a problem
>
> /home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin/ld.lld:
> error: can't create dynamic relocation R_386_32 against local symbol in
> readonly segment; recompile object files with -fPIC
> >>> defined in obj/third_party/ffmpeg/libffmpeg_yasm.a(ffmpeg_yasm/dct32.o)
> >>> referenced by ../../third_party/ffmpeg/libavcodec/x86/dct32.asm
> >>>               ffmpeg_yasm/dct32.o:(ff_dct32_float_sse) in archive
> >>> obj/third_party/ffmpeg/libffmpeg_yasm.a
>

I've encountered the same issue, and I'm still working on a solution,
which is why I haven't submitted v7 of this patchset. Apparently the
Chromium team compiles i386 builds with GNU gold instead of LLD. LLD
is more strict, and by default errors out when trying to dynamically
relocate symbols in read only segments.

Consequently, the upstream build is broken on i386 when linking with LLD.

> could you please tell me how to fix this problem?
>

I'm testing a couple of solutions. In the mean time, try setting
use_gold=false in CHROMIUM_OPTS, and let me know if that helps.
Hao HU July 26, 2018, 8:02 p.m. UTC | #9
Hi Joseph,


Joseph Kogut wrote
> Hi Hao,
> 
> On Thu, Jul 26, 2018 at 6:37 AM Hao HU &lt;

> huhao526200@

> &gt; wrote:
>>
>> Hello Joseph,
>>
>> I have applied your v6 patch to the Buildroot 2018.05 and wanted to build
>> the chrome in a x86 arch.
>>
>> The Target option is like this :
>>
>> /Target Architecture  : i386
>> Target Architecture Variant i586/
>>
>> And I have added the following in the lld.mk
>>
>> HOST_LLD_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
>> -DLLVM_DYLIB_COMPONENTS=all
>>
>> +ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
>> +CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
>> +endif
>>
>> And finally I have comment the following in the chromium.mk
>>
>> +ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
>> + # CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
>> +endif
>>
> 
>>I'm not sure what the intent is here. Chromium codec options belong in
>>the Chromium makefile, not the LLD makefile. Were you encountering a
>>build error related to enabling Chromium proprietary codecs?
> 
> I was encountering the build error like this when I build the object files
> of chromium:
/
> In file included from ../../third_party/ffmpeg/libavcodec/h264_cabac.c:36:
> In file included from
> ../../third_party/ffmpeg/libavcodec/cabac_functions.h:46:
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
>         BRANCHLESS_GET_CABAC("%0", "%q0", "(%4)", "%1", "%w1",
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> error: register allocation failed: maximum depth for recoloring reached.
> Use -fexhaustive-register-search to skip cutoffs
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> error: register allocation failed: maximum depth for recoloring reached.
> Use -fexhaustive-register-search to skip cutoffs
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
> assembly requires more registers than available
> ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
> macro 'BRANCHLESS_GET_CABAC'
>         "movzbl "statep"    , "ret"                                    
> \n\t"\
>         ^
> fatal error: too many errors emitted, stopping now [-ferror-limit=]
> clang: error: unable to execute command: Segmentation fault
> clang: error: clang frontend command failed due to signal (use -v to see
> invocation)
> clang version 6.0.0 (tags/RELEASE_600/final)
> Target: i586-buildroot-linux-gnu
> Thread model: posix
> InstalledDir:
> /home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin
> clang: note: diagnostic msg: PLEASE submit a bug report to  and include
> the crash backtrace, preprocessed source, and associated run script.
> clang: note: diagnostic msg: 
> ********************
/
> 
/
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
> clang: note: diagnostic msg: /tmp/h264_cabac-e9fdc6.c
> clang: note: diagnostic msg: /tmp/h264_cabac-e9fdc6.sh
> clang: note: diagnostic msg:
/
> 
> 
> So I have added the comment # CHROMIUM_OPTS += proprietary_codecs=true
> ffmpeg_branding=\"Chrome\" in the chromium.mk , which means removing the 
/
> proprietary_codecs=true 
> ffmpeg_branding=\"Chrome\"
/
> 
> in the args.gn of the chromium
> 
> And it worked and until it finished building all the .o files of chromium
> 
> 
>> But now there is still a problem
>>
>> /home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin/ld.lld:
>> error: can't create dynamic relocation R_386_32 against local symbol in
>> readonly segment; recompile object files with -fPIC
>> >>> defined in
>> obj/third_party/ffmpeg/libffmpeg_yasm.a(ffmpeg_yasm/dct32.o)
>> >>> referenced by ../../third_party/ffmpeg/libavcodec/x86/dct32.asm
>> >>>               ffmpeg_yasm/dct32.o:(ff_dct32_float_sse) in archive
>> >>> obj/third_party/ffmpeg/libffmpeg_yasm.a
>>
> 
>>I've encountered the same issue, and I'm still working on a solution,
>>which is why I haven't submitted v7 of this patchset. Apparently the
>>Chromium team compiles i386 builds with GNU gold instead of LLD. LLD
>>is more strict, and by default errors out when trying to dynamically
>>relocate symbols in read only segments.
> 
>>Consequently, the upstream build is broken on i386 when linking with LLD.
> 
>> could you please tell me how to fix this problem?
>>
> 
>>I'm testing a couple of solutions. In the mean time, try setting
>>use_gold=false in CHROMIUM_OPTS, and let me know if that helps.
> 
> 
> But when it link to the chrome it still had the problem 
/
>  /home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin/ld.lld:
>  error: can't create dynamic relocation R_386_32 against local symbol in
>  readonly segment; recompile object files with -fPIC
>  >>> defined in
> obj/third_party/ffmpeg/libffmpeg_yasm.a(ffmpeg_yasm/dct32.o)
>  >>> referenced by ../../third_party/ffmpeg/libavcodec/x86/dct32.asm
>  >>>               ffmpeg_yasm/dct32.o:(ff_dct32_float_sse) in archive
>  >>> obj/third_party/ffmpeg/libffmpeg_yasm.a
/
> 
> So I tried to add the following statement in the lld.mk
/
> HOST_LLD_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
> -DLLVM_DYLIB_COMPONENTS=all
/
>  
> 
> But it still not worked.
> 
> And I will try to setting 
> use_gold=false in CHROMIUM_OPTS
> 
> And I will tell you the result.
> 
> If you fix the problem, please tell me as soon as possible, because I am
> in a hurry to finish my project.
> 
> Thank you very much.
> 
> Hao
> _______________________________________________
> buildroot mailing list

> buildroot@

> http://lists.busybox.net/mailman/listinfo/buildroot





--
Sent from: http://buildroot-busybox.2317881.n4.nabble.com/
Hao HU July 27, 2018, 7:56 a.m. UTC | #10
Hi Joseph,

>Hi Hao,

>On Thu, Jul 26, 2018 at 6:37 AM Hao HU <[hidden email]> wrote:

>
> Hello Joseph,
>
> I have applied your v6 patch to the Buildroot 2018.05 and wanted to build
> the chrome in a x86 arch.
>
> The Target option is like this :
>
> /Target Architecture  : i386
> Target Architecture Variant i586/
>
> And I have added the following in the lld.mk
>
> HOST_LLD_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
> -DLLVM_DYLIB_COMPONENTS=all
>
> +ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
> +CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
> +endif
>
> And finally I have comment the following in the chromium.mk
>
> +ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
> + # CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
> +endif
>

>I'm not sure what the intent is here. Chromium codec options belong in
>the Chromium makefile, not the LLD makefile. Were you encountering a
>build error related to enabling Chromium proprietary codecs? 

I was encountering the build error like this when I build the object files
of chromium:

/ In file included from ../../third_party/ffmpeg/libavcodec/h264_cabac.c:36:
In file included from
 ../../third_party/ffmpeg/libavcodec/cabac_functions.h:46:
../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
assembly requires more registers than available
        BRANCHLESS_GET_CABAC("%0", "%q0", "(%4)", "%1", "%w1",
         ^
./../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
macro 'BRANCHLESS_GET_CABAC'
        "movzbl "statep"    , "ret"                                   
 \n\t"\
         ^
error: register allocation failed: maximum depth for recoloring reached.
Use -fexhaustive-register-search to skip cutoffs
 ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
 assembly requires more registers than available
 ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
 macro 'BRANCHLESS_GET_CABAC'
        "movzbl "statep"    , "ret"                                   
 \n\t"\
         ^
 ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
 assembly requires more registers than available
../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
macro 'BRANCHLESS_GET_CABAC'
        "movzbl "statep"    , "ret"                                   
 \n\t"\
        ^
 ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
assembly requires more registers than available
 ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
 macro 'BRANCHLESS_GET_CABAC'
        "movzbl "statep"    , "ret"                                   
\n\t"\
        ^
../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
assembly requires more registers than available
 ../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
macro 'BRANCHLESS_GET_CABAC'
        "movzbl "statep"    , "ret"                                   
\n\t"\
         ^
 ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
 assembly requires more registers than available
../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
 macro 'BRANCHLESS_GET_CABAC'
        "movzbl "statep"    , "ret"                                   
\n\t"\
        ^ error: register allocation failed: maximum depth for recoloring
reached.
 Use -fexhaustive-register-search to skip cutoffs
../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
 assembly requires more registers than available
../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
macro 'BRANCHLESS_GET_CABAC'
         "movzbl "statep"    , "ret"                                   
 \n\t"\
        ^
 ../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
 assembly requires more registers than available
../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
macro 'BRANCHLESS_GET_CABAC'
        "movzbl "statep"    , "ret"                                   
\n\t"\
        ^
../../third_party/ffmpeg/libavcodec/x86/cabac.h:193:9: error: inline
 assembly requires more registers than available
../../third_party/ffmpeg/libavcodec/x86/cabac.h:143:9: note: expanded from
 macro 'BRANCHLESS_GET_CABAC'
        "movzbl "statep"    , "ret"                                   
 \n\t"\
        ^

 fatal error: too many errors emitted, stopping now [-ferror-limit=]
clang: error: unable to execute command: Segmentation fault
 clang: error: clang frontend command failed due to signal (use -v to see
 invocation)
 clang version 6.0.0 (tags/RELEASE_600/final)
 Target: i586-buildroot-linux-gnu
 Thread model: posix
 InstalledDir:
/home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin
 clang: note: diagnostic msg: PLEASE submit a bug report to  and include
 the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:
 ********************

 PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
 Preprocessed source(s) and associated run script(s) are located at:
 clang: note: diagnostic msg: /tmp/h264_cabac-e9fdc6.c
 clang: note: diagnostic msg: /tmp/h264_cabac-e9fdc6.sh
 clang: note: diagnostic msg:/



 So I have added the comment # CHROMIUM_OPTS += proprietary_codecs=true
 ffmpeg_branding=\"Chrome\" in the chromium.mk , which means removing the

 proprietary_codecs=true
 ffmpeg_branding=\"Chrome\"

 in the args.gn of the chromium

And it worked and until it finished building all the .o files of chromium

> But now there is still a problem
>
> /home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin/ld.lld:
> error: can't create dynamic relocation R_386_32 against local symbol in
> readonly segment; recompile object files with -fPIC
> >>> defined in
> obj/third_party/ffmpeg/libffmpeg_yasm.a(ffmpeg_yasm/dct32.o)
> >>> referenced by ../../third_party/ffmpeg/libavcodec/x86/dct32.asm
> >>>               ffmpeg_yasm/dct32.o:(ff_dct32_float_sse) in archive
> >>> obj/third_party/ffmpeg/libffmpeg_yasm.a
>

>I've encountered the same issue, and I'm still working on a solution,
>which is why I haven't submitted v7 of this patchset. Apparently the
>Chromium team compiles i386 builds with GNU gold instead of LLD. LLD
>is more strict, and by default errors out when trying to dynamically
>relocate symbols in read only segments.

>Consequently, the upstream build is broken on i386 when linking with LLD.

> could you please tell me how to fix this problem?
>

>I'm testing a couple of solutions. In the mean time, try setting
>use_gold=false in CHROMIUM_OPTS, and let me know if that helps.

 But when it link to the chrome it still had the problem

 /home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin/ld.lld:
  error: can't create dynamic relocation R_386_32 against local symbol in
  readonly segment; recompile object files with -fPIC
  >>> defined in
obj/third_party/ffmpeg/libffmpeg_yasm.a(ffmpeg_yasm/dct32.o)
  >>> referenced by ../../third_party/ffmpeg/libavcodec/x86/dct32.asm
  >>>               ffmpeg_yasm/dct32.o:(ff_dct32_float_sse) in archive
 >>> obj/third_party/ffmpeg/libffmpeg_yasm.a


 So I tried to add the following statement in the lld.mk

 HOST_LLD_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
 -DLLVM_DYLIB_COMPONENTS=all



But it still not worked.

And I will try to setting
use_gold=false in CHROMIUM_OPTS

And I will tell you the result.

If you fix the problem, please tell me as soon as possible, because I am
in a hurry to finish my project.

 Thank you very much.

 Hao




--
Sent from: http://buildroot-busybox.2317881.n4.nabble.com/
Hao HU July 27, 2018, 2:03 p.m. UTC | #11
Hi Joseph,

Today I tried to set use_gold=false in CHROMIUM_OPTS in chromium.mk.

But it did't work. The same problem as following still exists. 

//home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin/ld.lld:
error: can't create dynamic relocation R_386_32 against local symbol in
readonly segment; recompile object files with -fPIC
>>> defined in obj/third_party/ffmpeg/libffmpeg_yasm.a(ffmpeg_yasm/dct32.o)
>>> referenced by ../../third_party/ffmpeg/libavcodec/x86/dct32.asm
>>>               ffmpeg_yasm/dct32.o:(ff_dct32_float_sse) in archive
>>> obj/third_party/ffmpeg/libffmpeg_yasm.a /

Best regards,

Hao




--
Sent from: http://buildroot-busybox.2317881.n4.nabble.com/
Joseph Kogut July 27, 2018, 4:12 p.m. UTC | #12
On Fri, Jul 27, 2018 at 7:03 AM Hao HU <huhao526200@gmail.com> wrote:
>
> Hi Joseph,
>
> Today I tried to set use_gold=false in CHROMIUM_OPTS in chromium.mk.
>
> But it did't work. The same problem as following still exists.
>
> //home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin/ld.lld:
> error: can't create dynamic relocation R_386_32 against local symbol in
> readonly segment; recompile object files with -fPIC
> >>> defined in obj/third_party/ffmpeg/libffmpeg_yasm.a(ffmpeg_yasm/dct32.o)
> >>> referenced by ../../third_party/ffmpeg/libavcodec/x86/dct32.asm
> >>>               ffmpeg_yasm/dct32.o:(ff_dct32_float_sse) in archive
> >>> obj/third_party/ffmpeg/libffmpeg_yasm.a /
>

Did you allow the Chromium package to reconfigure, i.e., by deleting
.stamp_configured, or running 'make chromium-dirclean all'?
Hao HU July 30, 2018, 9:04 a.m. UTC | #13
Joseph Kogut wrote
> On Fri, Jul 27, 2018 at 7:03 AM Hao HU &lt;

> huhao526200@

> &gt; wrote:
>>
>> Hi Joseph,
>>
>> Today I tried to set use_gold=false in CHROMIUM_OPTS in chromium.mk.
>>
>> But it did't work. The same problem as following still exists.
>>
>> //home/as_huhao/eolane/x2m/buildroot-2018.05-IHMI/output/host/bin/ld.lld:
>> error: can't create dynamic relocation R_386_32 against local symbol in
>> readonly segment; recompile object files with -fPIC
>> >>> defined in
>> obj/third_party/ffmpeg/libffmpeg_yasm.a(ffmpeg_yasm/dct32.o)
>> >>> referenced by ../../third_party/ffmpeg/libavcodec/x86/dct32.asm
>> >>>               ffmpeg_yasm/dct32.o:(ff_dct32_float_sse) in archive
>> >>> obj/third_party/ffmpeg/libffmpeg_yasm.a /
>>
> 
>>Did you allow the Chromium package to reconfigure, i.e., by deleting
>>.stamp_configured, or running 'make chromium-dirclean all'?
> 
> Before I tested if the use_gold=false worked or not, firstly I deleted the
> folder 
/
> /ouput/build/chromium--67.0.3396.79 
/
> then I run $ make 
> 
> Is that right or not?
> _______________________________________________
> buildroot mailing list

> buildroot@

> http://lists.busybox.net/mailman/listinfo/buildroot





--
Sent from: http://buildroot-busybox.2317881.n4.nabble.com/
Joseph Kogut July 30, 2018, 5:05 p.m. UTC | #14
Hi Hao,

On Mon, Jul 30, 2018 at 2:04 AM Hao HU <huhao526200@gmail.com> wrote:
> >>Did you allow the Chromium package to reconfigure, i.e., by deleting
> >>.stamp_configured, or running 'make chromium-dirclean all'?
> >
> > Before I tested if the use_gold=false worked or not, firstly I deleted the
> > folder
> /
> > /ouput/build/chromium--67.0.3396.79
> /
> > then I run $ make
> >
> > Is that right or not?

That will repeat the configure step, which is what you want. If
recompiling with use_lld=false doesn't work, the i386 build is still
broken, and needs fixed.

Can you switch the target architecture to x86_64? That build works properly.
Hao HU July 30, 2018, 5:21 p.m. UTC | #15
Hi Joseph,

>Hi Hao, 

>On Mon, Jul 30, 2018 at 2:04 AM Hao HU <[hidden email]> wrote:

> >>Did you allow the Chromium package to reconfigure, i.e., by deleting 
> >>.stamp_configured, or running 'make chromium-dirclean all'? 
> > 
> > Before I tested if the use_gold=false worked or not, firstly I deleted
> the 
> > folder 
> / 
> > /ouput/build/chromium--67.0.3396.79 
> / 
> > then I run $ make 
> > 
> > Is that right or not?

>That will repeat the configure step, which is what you want. If 
>recompiling with use_lld=false doesn't work, the i386 build is still 
>broken, and needs fixed. 

Do you mean recompiling with use_gold=false? Or I should try setting
use_lld=false?

>Can you switch the target architecture to x86_64? That build works properl

I have tested the x86_64, it worked, but my project needs to build on a i386
arch.

Best regards,

Hao



--
Sent from: http://buildroot-busybox.2317881.n4.nabble.com/
Joseph Kogut July 30, 2018, 6:13 p.m. UTC | #16
On Mon, Jul 30, 2018 at 10:21 AM Hao HU <huhao526200@gmail.com> wrote:
>
> Do you mean recompiling with use_gold=false? Or I should try setting
> use_lld=false?
>

The problem is stricter defaults with LLD, so you want to disable LLD
for an i386 build, which means the proper flag is use_lld=false. I
haven't tried this, so it may not fix your problem.

> >Can you switch the target architecture to x86_64? That build works properl
>
> I have tested the x86_64, it worked, but my project needs to build on a i386
> arch.
>

If that's the case, the only solution is to link without LLD. The
Chromium team informed me that they still compile with Gold on i386.

Also, this is unrelated, but when you reply you're only addressing the
mailing list, so your messages are skipping my inbox and I only notice
when I check messages sent to the mailing list. Make sure to address
your messages to the correct recipient and CC the mailing list.
Joseph Kogut July 30, 2018, 9:39 p.m. UTC | #17
Hi Hao,

I just finished an i386 build that linked Chromium successfully with
GN option use_lld=false. This was the main issue holding back the next
version of this patchset, so you can expect it to be posted to the
mailing list soon.

Thanks for testing!

Best,
Joseph
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 05d2bdde20..e3dde531b4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1058,6 +1058,7 @@  F:	package/rabbitmq-c/
 N:	Joseph Kogut <joseph.kogut@gmail.com>
 F:	package/at-spi2-atk/
 F:	package/at-spi2-core/
+F:	package/chromium/
 F:	package/gconf/
 F:	package/libnss/
 F:	package/lld/
diff --git a/package/Config.in b/package/Config.in
index 20fe5ad8ff..2515975df3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -14,6 +14,7 @@  menu "Audio and video applications"
 	source "package/aumix/Config.in"
 	source "package/bellagio/Config.in"
 	source "package/bluez-alsa/Config.in"
+	source "package/chromium/Config.in"
 	source "package/dvblast/Config.in"
 	source "package/dvdauthor/Config.in"
 	source "package/dvdrw-tools/Config.in"
diff --git a/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch b/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
new file mode 100644
index 0000000000..1848b0bd14
--- /dev/null
+++ b/package/chromium/0001-modify-compiler_cpu_abi-for-buildroot-toolchain.patch
@@ -0,0 +1,102 @@ 
+From 3d5106d1d4720e1be8a4bd977be38743d6fb1f3c Mon Sep 17 00:00:00 2001
+From: Joseph Kogut <joseph.kogut@gmail.com>
+Date: Sun, 10 Jun 2018 09:59:11 -0700
+Subject: [PATCH] modify compiler_cpu_abi for buildroot toolchain
+
+Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
+---
+ build/config/compiler/BUILD.gn | 36 +++++++++++++++++++---------------
+ 1 file changed, 20 insertions(+), 16 deletions(-)
+
+diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
+index 461e62da2..27c9f29ed 100644
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -683,6 +683,10 @@ config("compiler_cpu_abi") {
+         "-march=x86-64",
+       ]
+       ldflags += [ "-m64" ]
++      if (is_clang) {
++        cflags += ["--target=x86_64-buildroot-linux-gnu"]
++        ldflags += ["--target=x86_64-buildroot-linux-gnu"]
++      }
+     } else if (current_cpu == "x86") {
+       cflags += [ "-m32" ]
+       ldflags += [ "-m32" ]
+@@ -695,8 +699,8 @@ config("compiler_cpu_abi") {
+       }
+     } else if (current_cpu == "arm") {
+       if (is_clang && !is_android && !is_nacl) {
+-        cflags += [ "--target=arm-linux-gnueabihf" ]
+-        ldflags += [ "--target=arm-linux-gnueabihf" ]
++        cflags += [ "--target=arm-buildroot-linux-gnueabihf" ]
++        ldflags += [ "--target=arm-buildroot-linux-gnueabihf" ]
+       }
+       if (!is_nacl) {
+         cflags += [
+@@ -709,18 +713,18 @@ config("compiler_cpu_abi") {
+       }
+     } else if (current_cpu == "arm64") {
+       if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
+-        cflags += [ "--target=aarch64-linux-gnu" ]
+-        ldflags += [ "--target=aarch64-linux-gnu" ]
++        cflags += [ "--target=aarch64-buildroot-linux-gnu" ]
++        ldflags += [ "--target=aarch64-buildroot-linux-gnu" ]
+       }
+     } else if (current_cpu == "mipsel" && !is_nacl) {
+       if (custom_toolchain == "") {
+         if (is_clang) {
+           if (is_android) {
+-            cflags += [ "--target=mipsel-linux-android" ]
+-            ldflags += [ "--target=mipsel-linux-android" ]
++            cflags += [ "--target=mipsel-buildroot-linux-android" ]
++            ldflags += [ "--target=mipsel-buildroot-linux-android" ]
+           } else {
+-            cflags += [ "--target=mipsel-linux-gnu" ]
+-            ldflags += [ "--target=mipsel-linux-gnu" ]
++            cflags += [ "--target=mipsel-buildroot-linux-gnu" ]
++            ldflags += [ "--target=mipsel-buildroot-linux-gnu" ]
+           }
+         } else {
+           cflags += [ "-EL" ]
+@@ -799,8 +803,8 @@ config("compiler_cpu_abi") {
+     } else if (current_cpu == "mips" && !is_nacl) {
+       if (custom_toolchain == "") {
+         if (is_clang) {
+-          cflags += [ "--target=mips-linux-gnu" ]
+-          ldflags += [ "--target=mips-linux-gnu" ]
++          cflags += [ "--target=mips-buildroot-linux-gnu" ]
++          ldflags += [ "--target=mips-buildroot-linux-gnu" ]
+         } else {
+           cflags += [ "-EB" ]
+           ldflags += [ "-EB" ]
+@@ -844,11 +848,11 @@ config("compiler_cpu_abi") {
+       if (custom_toolchain == "") {
+         if (is_clang) {
+           if (is_android) {
+-            cflags += [ "--target=mips64el-linux-android" ]
+-            ldflags += [ "--target=mips64el-linux-android" ]
++            cflags += [ "--target=mips64el-buildroot-linux-android" ]
++            ldflags += [ "--target=mips64el-buildroot-linux-android" ]
+           } else {
+-            cflags += [ "--target=mips64el-linux-gnuabi64" ]
+-            ldflags += [ "--target=mips64el-linux-gnuabi64" ]
++            cflags += [ "--target=mips64el-buildroot-linux-gnuabi64" ]
++            ldflags += [ "--target=mips64el-buildroot-linux-gnuabi64" ]
+           }
+         } else {
+           cflags += [
+@@ -905,8 +909,8 @@ config("compiler_cpu_abi") {
+     } else if (current_cpu == "mips64") {
+       if (custom_toolchain == "") {
+         if (is_clang) {
+-          cflags += [ "--target=mips64-linux-gnuabi64" ]
+-          ldflags += [ "--target=mips64-linux-gnuabi64" ]
++          cflags += [ "--target=mips64-buildroot-linux-gnuabi64" ]
++          ldflags += [ "--target=mips64-buildroot-linux-gnuabi64" ]
+         } else {
+           cflags += [
+             "-EB",
+-- 
+2.17.1
+
diff --git a/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch b/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
new file mode 100644
index 0000000000..8aebbd06c8
--- /dev/null
+++ b/package/chromium/0002-Fix-arm-build-with-glibc-2.27.patch
@@ -0,0 +1,28 @@ 
+From aed4599c18586dfac46139a3c32011f804fdaef6 Mon Sep 17 00:00:00 2001
+From: Joseph Kogut <joseph.kogut@gmail.com>
+Date: Wed, 13 Jun 2018 13:59:24 -0700
+Subject: [PATCH] Fix arm build with glibc 2.27
+
+Upstream patch from: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1060155
+
+Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
+---
+ third_party/crashpad/crashpad/compat/linux/sys/ptrace.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
+index 73861576d..e5c95c7cc 100644
+--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
+@@ -34,7 +34,7 @@ static constexpr __ptrace_request PTRACE_GET_THREAD_AREA =
+ #endif  // !PTRACE_GET_THREAD_AREA && !PT_GET_THREAD_AREA && defined(__GLIBC__)
+ 
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
+-#if !defined(PTRACE_GETVFPREGS) && \
++#if !defined(PTRACE_GETVFPREGS) && !defined(PT_GETVFPREGS) && \
+     defined(__GLIBC__) && (defined(__arm__) || defined(__arm64__))
+ static constexpr __ptrace_request PTRACE_GETVFPREGS =
+     static_cast<__ptrace_request>(27);
+-- 
+2.17.1
+
diff --git a/package/chromium/Config.in b/package/chromium/Config.in
new file mode 100644
index 0000000000..fa04d3bbd2
--- /dev/null
+++ b/package/chromium/Config.in
@@ -0,0 +1,64 @@ 
+config BR2_PACKAGE_CHROMIUM_ARCH_SUPPORTS
+	bool
+	default y if BR2_arm
+	default y if BR2_aarch64
+	default y if BR2_i386
+	default y if BR2_x86_64
+
+config BR2_PACKAGE_CHROMIUM_TARGET_ARCH
+	string
+	default "arm" if BR2_arm
+	default "arm64" if BR2_aarch64
+	default "x86" if BR2_i386
+	default "x64" if BR2_x86_64
+
+menuconfig BR2_PACKAGE_CHROMIUM
+	bool "chromium"
+	depends on BR2_HOST_GCC_AT_LEAST_4_9 # gn requires -std=c++14
+	depends on BR2_PACKAGE_HAS_LIBGL
+	depends on BR2_PACKAGE_XORG7
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	select BR2_PACKAGE_AT_SPI2_ATK
+	select BR2_PACKAGE_ALSA_LIB
+	select BR2_PACKAGE_FREETYPE
+	select BR2_PACKAGE_HARFBUZZ
+	select BR2_PACKAGE_HOST_CLANG
+	select BR2_PACKAGE_HOST_LLD
+	select BR2_PACKAGE_HOST_NINJA
+	select BR2_PACKAGE_HOST_NODEJS
+	select BR2_PACKAGE_HOST_PYTHON
+	select BR2_PACKAGE_JPEG
+	select BR2_PACKAGE_LIBDRM
+	select BR2_PACKAGE_LIBERATION # runtime
+	select BR2_PACKAGE_LIBGLIB2
+	select BR2_PACKAGE_LIBGTK2 if !BR2_PACKAGE_LIBGTK3_X11
+	select BR2_PACKAGE_LIBKRB5
+	select BR2_PACKAGE_LIBNSS
+	select BR2_PACKAGE_LIBPNG
+	select BR2_PACKAGE_XLIB_LIBXCOMPOSITE
+	select BR2_PACKAGE_XLIB_LIBXCURSOR
+	select BR2_PACKAGE_XLIB_LIBXI if !BR2_PACKAGE_LIBGTK3_X11
+	select BR2_PACKAGE_XLIB_LIBXRANDR
+	select BR2_PACKAGE_XLIB_LIBXSCRNSAVER
+	select BR2_PACKAGE_XLIB_LIBXTST if !BR2_PACKAGE_LIBGTK3_X11
+	help
+	  Chromium is an open-source Web browser project started by
+	  Google, to provide the source code for the proprietary
+	  Google Chrome browser.
+
+if BR2_PACKAGE_CHROMIUM
+
+config BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS
+	bool "Enable proprietary codecs"
+	help
+	  Enables proprietary codecs with additional licensing
+	  restrictions, such as MP3 and H264
+
+endif # BR2_PACKAGE_CHROMIUM
+
+comment "chromium needs toolchain w/ Glibc, host gcc >= 4.9.0"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC \
+		|| !BR2_HOST_GCC_AT_LEAST_4_9
+
+comment "chromium depends on X.org and needs an OpenGL backend"
+	depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_HAS_LIBGL
diff --git a/package/chromium/chromium.hash b/package/chromium/chromium.hash
new file mode 100644
index 0000000000..4c39ac5c08
--- /dev/null
+++ b/package/chromium/chromium.hash
@@ -0,0 +1,3 @@ 
+# locally calculated
+sha256 f8b1e5319163e378027826b12cf256b97423bb90e10e2013469d96e03bc9db8a  chromium-67.0.3396.79.tar.xz
+sha256 845022e0c1db1abb41a6ba4cd3c4b674ec290f3359d9d3c78ae558d4c0ed9308  LICENSE
diff --git a/package/chromium/chromium.mk b/package/chromium/chromium.mk
new file mode 100644
index 0000000000..465eef17ad
--- /dev/null
+++ b/package/chromium/chromium.mk
@@ -0,0 +1,146 @@ 
+################################################################################
+#
+# Chromium
+#
+################################################################################
+
+CHROMIUM_VERSION = 67.0.3396.79
+CHROMIUM_SITE = https://commondatastorage.googleapis.com/chromium-browser-official
+CHROMIUM_SOURCE = chromium-$(CHROMIUM_VERSION).tar.xz
+CHROMIUM_LICENSE = BSD-Style
+CHROMIUM_LICENSE_FILES = LICENSE
+CHROMIUM_DEPENDENCIES = alsa-lib cairo cups dbus freetype harfbuzz \
+			host-clang host-lld host-ninja host-nodejs host-python \
+			jpeg libdrm libglib2 libkrb5 libnss libpng pango \
+			xlib_libXcomposite xlib_libXScrnSaver xlib_libXcursor \
+			xlib_libXrandr zlib
+
+CHROMIUM_TOOLCHAIN_CONFIG_PATH = $(shell pwd)/package/chromium/toolchain
+
+CHROMIUM_OPTS = \
+	host_toolchain=\"$(CHROMIUM_TOOLCHAIN_CONFIG_PATH):host\" \
+	custom_toolchain=\"$(CHROMIUM_TOOLCHAIN_CONFIG_PATH):target\" \
+	use_lld=true \
+	is_clang=true \
+	clang_use_chrome_plugins=false \
+	treat_warnings_as_errors=false \
+	use_gnome_keyring=false \
+	linux_use_bundled_binutils=false \
+	use_sysroot=true \
+	target_sysroot=\"$(STAGING_DIR)\" \
+	target_cpu=\"$(BR2_PACKAGE_CHROMIUM_TARGET_ARCH)\" \
+	enable_nacl=false \
+	use_dbus=true \
+	use_system_zlib=true \
+	use_system_libjpeg=true \
+	use_system_libpng=true \
+	use_system_libdrm=true \
+	use_system_harfbuzz=true \
+	use_system_freetype=true
+
+# tcmalloc has portability issues
+CHROMIUM_OPTS += use_allocator=\"none\"
+
+# V8 snapshots require compiling V8 with the same word size as the target
+# architecture, which means the host needs to have that toolchain available.
+CHROMIUM_OPTS += v8_use_snapshot=false
+
+ifeq ($(BR2_ENABLE_DEBUG),y)
+CHROMIUM_OPTS += is_debug=true
+else
+CHROMIUM_OPTS += is_debug=false
+endif
+
+ifeq ($(BR2_PACKAGE_CUPS),y)
+CHROMIUM_DEPENDENCIES += cups
+CHROMIUM_OPTS += use_cups=true
+else
+CHROMIUM_OPTS += use_cups=false
+endif
+
+ifeq ($(BR2_PACKAGE_CHROMIUM_PROPRIETARY_CODECS),y)
+CHROMIUM_OPTS += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
+endif
+
+ifeq ($(BR2_PACKAGE_DBUS),y)
+CHROMIUM_OPTS += use_dbus=true
+else
+CHROMIUM_OPTS += use_dbus=false
+endif
+
+ifeq ($(BR2_PACKAGE_PCIUTILS),y)
+CHROMIUM_DEPENDENCIES += pciutils
+CHROMIUM_OPTS += use_libpci=true
+else
+CHROMIUM_OPTS += use_libpci=false
+endif
+
+ifeq ($(BR2_PACKAGE_PULSEAUDIO),y)
+CHROMIUM_DEPENDENCIES += pulseaudio
+CHROMIUM_OPTS += use_pulseaudio=true
+else
+CHROMIUM_OPTS += use_pulseaudio=false
+endif
+
+ifeq ($(BR2_PACKAGE_LIBGTK3_X11),y)
+CHROMIUM_DEPENDENCIES += libgtk3
+CHROMIUM_OPTS += use_gtk3=true
+else
+CHROMIUM_DEPENDENCIES += libgtk2 xlib_libXi xlib_libXtst
+CHROMIUM_OPTS += use_gtk3=false
+endif
+
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
+CHROMIUM_TARGET_LDFLAGS += --gcc-toolchain=$(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
+else
+CHROMIUM_TARGET_LDFLAGS += --gcc-toolchain=$(HOST_DIR)
+endif
+
+CHROMIUM_TARGET_CFLAGS += $(CHROMIUM_TARGET_LDFLAGS)
+CHROMIUM_TARGET_CXXFLAGS += $(CHROMIUM_TARGET_CFLAGS)
+
+define CHROMIUM_CONFIGURE_CMDS
+	mkdir -p $(@D)/third_party/node/linux/node-linux-x64/bin
+	ln -sf $(HOST_DIR)/bin/node $(@D)/third_party/node/linux/node-linux-x64/bin/
+
+	( cd $(@D); \
+		$(TARGET_MAKE_ENV) \
+		$(HOST_DIR)/bin/python2 tools/gn/bootstrap/bootstrap.py -s --no-clean; \
+		HOST_AR="$(HOSTAR)" \
+		HOST_NM="$(HOSTNM)" \
+		HOST_CC="$(HOSTCC)" \
+		HOST_CXX="$(HOSTCXX)" \
+		HOST_CFLAGS="$(HOST_CFLAGS)" \
+		HOST_CXXFLAGS="$(HOST_CXXFLAGS)" \
+		TARGET_AR="ar" \
+		TARGET_NM="nm" \
+		TARGET_CC="clang" \
+		TARGET_CXX="clang++" \
+		TARGET_CFLAGS="$(CHROMIUM_TARGET_CFLAGS)" \
+		TARGET_CXXFLAGS="$(CHROMIUM_TARGET_CXXFLAGS)" \
+		TARGET_LDFLAGS="$(CHROMIUM_TARGET_LDFLAGS)" \
+		out/Release/gn gen out/Release --args="$(CHROMIUM_OPTS)" \
+			--script-executable=$(HOST_DIR)/bin/python2 \
+	)
+endef
+
+define CHROMIUM_BUILD_CMDS
+	( cd $(@D); \
+		$(TARGET_MAKE_ENV) \
+		ninja -j$(PARALLEL_JOBS) -C out/Release chrome chrome_sandbox chromedriver \
+	)
+endef
+
+define CHROMIUM_INSTALL_TARGET_CMDS
+	$(INSTALL) -D $(@D)/out/Release/chrome $(TARGET_DIR)/usr/lib/chromium/chromium
+	$(INSTALL) -Dm4755 $(@D)/out/Release/chrome_sandbox \
+		$(TARGET_DIR)/usr/lib/chromium/chrome-sandbox
+	cp $(@D)/out/Release/{chrome_{100,200}_percent,resources}.pak \
+		$(@D)/out/Release/chromedriver \
+		$(TARGET_DIR)/usr/lib/chromium/
+	$(INSTALL) -Dm644 -t $(TARGET_DIR)/usr/lib/chromium/locales \
+		$(@D)/out/Release/locales/*.pak
+	cp $(@D)/out/Release/icudtl.dat $(TARGET_DIR)/usr/lib/chromium/
+endef
+
+$(eval $(generic-package))
diff --git a/package/chromium/toolchain/BUILD.gn b/package/chromium/toolchain/BUILD.gn
new file mode 100644
index 0000000000..e8525bd67d
--- /dev/null
+++ b/package/chromium/toolchain/BUILD.gn
@@ -0,0 +1,71 @@ 
+import("//build/toolchain/gcc_toolchain.gni")
+import("//build/config/sysroot.gni")
+
+gcc_toolchain("host") {
+  cc = getenv("HOST_CC")
+  cxx = getenv("HOST_CXX")
+  ar = getenv("HOST_AR")
+  nm = getenv("HOST_NM")
+  ld = cxx
+
+  extra_cflags = getenv("HOST_CFLAGS")
+  extra_cppflags = getenv("HOST_CPPFLAGS")
+  extra_cxxflags = getenv("HOST_CXXFLAGS")
+  extra_ldflags = getenv("HOST_LDFLAGS")
+
+  toolchain_args = {
+    cc_wrapper = ""
+    current_cpu = host_cpu
+    current_os = host_os
+    is_clang = false
+    use_sysroot = false
+    use_lld = false
+  }
+}
+
+gcc_toolchain("target") {
+  cc = getenv("TARGET_CC")
+  cxx = getenv("TARGET_CXX")
+  ar = getenv("TARGET_AR")
+  nm = getenv("TARGET_NM")
+  ld = cxx
+
+  extra_cflags = getenv("TARGET_CFLAGS")
+  extra_cppflags = getenv("TARGET_CPPFLAGS")
+  extra_cxxflags = getenv("TARGET_CXXFLAGS")
+  extra_ldflags = getenv("TARGET_LDFLAGS")
+
+  toolchain_args = {
+    cc_wrapper = ""
+    current_cpu = target_cpu
+    current_os = target_os
+    is_clang = is_clang
+    use_sysroot = use_sysroot
+  }
+}
+
+gcc_toolchain("v8_snapshot") {
+  cc = getenv("V8_CC")
+  cxx = getenv("V8_CXX")
+  ar = getenv("V8_AR")
+  nm = getenv("V8_NM")
+  ld = cxx
+
+  extra_cflags = getenv("V8_CFLAGS")
+  extra_cppflags = getenv("V8_CPPFLAGS")
+  extra_cxxflags = getenv("V8_CXXFLAGS")
+  extra_ldflags = getenv("V8_LDFLAGS")
+
+  toolchain_args = {
+    cc_wrapper = ""
+    if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") {
+      current_cpu = "x86"
+    } else {
+      current_cpu = "x64"
+    }
+    current_os = host_os
+    is_clang = is_clang
+    use_sysroot = false
+  }
+}
+