Skip to content

Instantly share code, notes, and snippets.

@corysimmons
Last active March 3, 2020 12:09
Show Gist options
  • Save corysimmons/4dac7d55e58c7558854d98a76d065bfc to your computer and use it in GitHub Desktop.
Save corysimmons/4dac7d55e58c7558854d98a76d065bfc to your computer and use it in GitHub Desktop.
Instructions for how to build Headless Chromium on Mac.

Doesn't work yet.

Build

  • brew install ninja
  • mkdir -p ~/chromium
  • cd ~/chromium
  • git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
  • export $PATH=$PWD/depot_tools:$PATH (shell specific)
  • fetch --no-history chromium --nosvn=True
  • cd src
  • mkdir -p out/release
  • echo 'import("//build/args/headless.gn")' > out/release/args.gn
  • echo 'is_debug = false' >> out/release/args.gn
  • gn gen out/release
  • ninja -C out/release headless
  • ln -s ~/chromium/out/release/headless /usr/local/bin/headless-chromium

Usage

  • headless-chromium ...
@corysimmons
Copy link
Author

corysimmons commented Oct 20, 2016

Fails on ninja -C out/release headless.

ninja: Entering directory `out/release'
[1611/3447] ACTION //third_party/icu:make_data_assembly(//build/toolchain/mac:clang_x64)
Generated gen/third_party/icu/icudtl_dat.S
[2266/3447] CXX obj/ui/events/events/event.o
FAILED: obj/ui/events/events/event.o
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/ui/events/events/event.o.d -DEVENTS_IMPLEMENTATION -DV8_DEPRECATION_WARNINGS -DENABLE_NOTIFICATIONS -DENABLE_PLUGINS=1 -DENABLE_PDF=1 -DENABLE_SPELLCHECK=1 -DUSE_BROWSER_SPELLCHECKER=1 -DUSE_OZONE=1 -DNO_TCMALLOC -DUSE_EXTERNAL_POPUP_MENU=1 -DENABLE_WEBRTC=1 -DDISABLE_NACL -DENABLE_EXTENSIONS=1 -DENABLE_TASK_MANAGER=1 -DENABLE_THEMES=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_SUPERVISED_USERS=1 -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DENABLE_MEDIA_ROUTER=1 -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=283753-1 -DCR_XCODE_VERSION=0800 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DSK_IGNORE_DW_GRAY_FIX -DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS -DSK_SUPPORT_GPU=1 -DSK_BUILD_FOR_MAC -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_NOEXCEPT= -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC -I../.. -Igen -I../../skia/config -I../../skia/ext -I../../third_party/skia/include/c -I../../third_party/skia/include/config -I../../third_party/skia/include/core -I../../third_party/skia/include/effects -I../../third_party/skia/include/images -I../../third_party/skia/include/lazy -I../../third_party/skia/include/pathops -I../../third_party/skia/include/pdf -I../../third_party/skia/include/pipe -I../../third_party/skia/include/ports -I../../third_party/skia/include/utils -I../../third_party/skia/include/gpu -I../../third_party/skia/src/gpu -I../../third_party/skia/src/sksl -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -fno-strict-aliasing -fstack-protector -fcolor-diagnostics -arch x86_64 -Wall -Werror -Wextra -Wpartial-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-deprecated-register -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -O2 -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.7 -fvisibility=hidden -Xclang -load -Xclang ../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs -Wheader-hygiene -Wstring-conversion -fno-threadsafe-statics -fvisibility-inlines-hidden -std=c++11 -stdlib=libc++ -fno-rtti -fno-exceptions -c ../../ui/events/event.cc -o obj/ui/events/events/event.o
../../ui/events/event.cc:464:7: error: static_cast from 'base::NativeEvent' (aka 'NSEvent *') to 'const ui::Event *', which are not related by inheritance, is not allowed
      static_cast<const Event*>(native_event)->source_device_id();
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../base/event_types.h:18:7: note: 'NSEvent' is incomplete
class NSEvent;
      ^
1 error generated.
[2275/3447] OBJCXX obj/ui/events/events/cocoa_event_utils.o
ninja: build stopped: subcommand failed.

@JoeChapman
Copy link

Presumably it is because there is a bug in the tip-of-tree commit?

@qingdujun
Copy link

qingdujun@MacBook-Pro src % gn gen out/Release
ERROR at //third_party/fontconfig/fontconfig.gni:7:1: Assertion failed.
assert(is_linux)
^-----
See //third_party/fontconfig/BUILD.gn:6:1: whence it was imported.
import("//third_party/fontconfig/fontconfig.gni")
^-----------------------------------------------
See //headless/BUILD.gn:200:7: which caused the file to be included.
      "//third_party/fontconfig",
      ^-------------------------
qingdujun@MacBook-Pro src %

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment