PDFium 라이브러리 삽질기 - 1
정적 라이브러리로 빌드하기
작성일자: 2019년 12월 6일
최종수정: 2019년 12월 13일
작성자: N3
0. 개요
PDFium 은 Google 이 Chromium 에서 사용하는 것으로, Google 이 오픈소스로 공개하면서 널리 알려진 라이브러리다.
이 글은 CentOS 7 의 Mapserver 및 GDAL 에서 GeoPDF 를 출력하기 위해 PDFium 을 사용하기 위한 삽질기다.
PDFium은 C++로 작성되었으며, C 인터페이스 또한 제공하고 있다.
라이센스는 BSD 3-clause 라이센스다.
// Copyright 2014 PDFium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
왜 POPPLER 가 아닌 PDFium 인가?
1. 빌드 준비
PDFium 을 빌드하려면, Chromium 의 빌드 도구가 필요하며, 빌드 과정도 비슷하다.
$ mkdir PDFium
$ cd PDFium
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
depot_tools 에는 PDFium 의 소스를 내려받고, 빌드하기 위한 파이썬 도구들이 들어있다.
대표적인 스크립트로는 gclient, gn, ninja 가 있다. 이 스크립트들은 git 소스를 내려받고, 빌드를 위한 환경을 생성하고, 빌드하기 위한 옵션들을 생성해는 도구들이다.
- depot_tools 폴더를 PATH에 추가한다.
$ cd depot_tools
$ export $DEPOT_TOOLS=`pwd`
$ export PATH=$PATH:$DEPOT_TOOLS
$ cd ..
git 으로 내려받는 것이 아니라, 앞에서 다운로드한 gclient 를 사용해서 소스를 내려받는다.
$ gclient config –-unmanaged https://pdfium.googlesource.com/pdfium.git
$ gclient sync -–verbose
$ ls
depot_tools pdfium
$ ls pdfium

git 으로 내려받는 것과 달리 gclient sync 로 내려받은 파일의 차이가 있다는 것을 알 수 있다.
$ git clone https://pdfium.googlesource.com/pdfium.git

git 으로 내려받은 소스에는 build 폴더와 빌드를 위한 스크립트가 없다는 것을 확인할 수 있다.
2. 빌드하기
PDFium( 또는 Chromium)을 빌드하기 위해 필요한 모든 것을 설치하는 스크립트로 install-build-deps.sh 이 있다.
[respiro@localhost PDFium]$ cd pdfium
[respiro@localhost pdfium]$ ls
AUTHORS LICENSE README.md build_overrides constants fpdfsdk navbar.md samples third_party xfa
BUILD.gn OWNERS base buildtools core fxbarcode pdfium.gni skia tools
DEPS PRESUBMIT.py build codereview.settings docs fxjs public testing v8
[respiro@localhost pdfium]$ ./build/install-build-deps.sh
which: no lsb_release in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/respiro/.local/bin:/home/respiro/bin:/home/respiro/rpmbuild/SOURCES/PDFium/depot_tools)
ERROR: lsb_release not found in $PATH
기본 빌드 스크립트들이 모두 데비안을 위한 스크립트다.
"\tUbuntu 14.04 LTS (trusty with EoL April 2022)\n" \
"\tUbuntu 16.04 LTS (xenial with EoL April 2024)\n" \
"\tUbuntu 18.04 LTS (bionic with EoL April 2028)\n" \
"\tUbuntu 19.04 (disco)\n" \
"\tDebian 8 (jessie) or later" >&2
위 스크립트가 지원하는 배포판들이다. 일단 스크립트를 무시하고, 아규먼트 파일을 만들고 생성해 본다.
$ gn args out/First
# Build arguments go here.
# See "gn args <out_dir> --list" for available build arguments.
pdf_is_standalone = true # non-embedded 빌드 설정
is_debug = true # 디버깅
pdf_enable_xfa = true # XFA 지원
pdf_enable_v8 = true # 자바스크립트 v8 지원
pdf_use_skia = false # skia 백엔드 제거
pdf_use_skia_paths = false # skia 백엔드 제거
is_component_build = false # 컴포넌트 빌드 제거 (must be false)
clang_use_chrome_plugins = false # 크롬 플러그인 false.
아규먼트 파일을 저장한다.
$ cd out/First
$ ls
args.gn build.ninja build.ninja.d obj toolchain.ninja
조금 전 생성한 args.gn 과 소스파일의 BUILD.gn 파일을 이용해서 build.ninja등의 파일을 생성해서 ninja 빌드를 할 수 있도록 한다.
아규먼트 파일이 이미 있다면, args 옵션 대신에 gen 옵션을 사용할 수 있다.
$ mkdir -p out/First
$ cp args.gn out/First
$ gn gen out/First
ninja 는 일종의 래퍼 스크립트다.
$ ninja pdfium
[3/2765] CXX obj/buildtools/third_party/libc++/libc++/debug.o
FAILED: obj/buildtools/third_party/libc++/libc++/debug.o
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/buildtools/third_party/libc++/libc++/debug.o.d -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__\(\(__visibility__\(\"default\"\)\)\) -DLIBCXX_BUILDING_LIBCXXABI -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DCR_CLANG_REVISION=\"373424-64a362e7-2\" -D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_NODISCARD -DCR_LIBCXX_REVISION=361348 -DCR_SYSROOT_HASH=e7c53f04bd88d29d075bfd1f62b073aeb69cbe09 -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -I../.. -Igen -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -fcomplete-member-pointers -m64 -march=x86-64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -Xclang -fdebug-compilation-dir -Xclang . -no-canonical-prefixes -O0 -fno-omit-frame-pointer -g2 -gsplit-dwarf -ggnu-pubnames -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -fstrict-aliasing -fPIC -Werror -Wall -Wno-unused-variable -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-ignored-pragma-optimize -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-reorder-init-list -Wno-final-dtor-non-final-class -Wno-sizeof-array-div -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=c++14 -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include --sysroot=../../build/linux/debian_sid_amd64-sysroot -fvisibility-inlines-hidden -fexceptions -frtti -c ../../buildtools/third_party/libc++/trunk/src/debug.cpp -o obj/buildtools/third_party/libc++/libc++/debug.o
../../third_party/llvm-build/Release+Asserts/bin/clang++: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/respiro/rpmbuild/SOURCES/PDFium/pdfium/third_party/llvm-build/Release+Asserts/bin/../lib/libstdc++.so.6)
[4/2765] CXX obj/buildtools/third_party/libc++/libc++/hash.o
third_party 의 clang++ 을 사용해서 빌드하고, 오류가 발생하는 것을 볼 수 있다.
toolchain.ninja 파일에 빌드에 사용하는 도구를 명시하고 있다.
third_party 의 폴더에는 llvm, clang 등의 도구가 더 들어 있다. 물론, CentOS 7 에서는 사용할 수 없다.
./clang: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/respiro/rpmbuild/SOURCES/PDFium/pdfium/third_party/llvm-build/Release+Asserts/bin/../lib/libstdc++.so.6)
생성한 ninja 파일에서 사용하는 clang 빌드 옵션이 CentOS 7 의 clang 3.9 버전보다 더 높은 사양을 요구한다.
CentOS 7 의 glibc 는 2.17 이다. CentOS 8 로 업그레이드해야한다. 그렇게 하기에는 시스템에서 옮겨야 할 것이 많으므로, 차라리 clang 과 llvm 을 먼저 업그레이드한다.
llvm 및 clang 업데이트 (불필요한 삽질)
CentOS 8, fedora29 또는 rhel8 의 llvm, clang, lld 의 소스 rpm 을 가져와서 다시 빌드한다.
SPEC 파일에서 python3 를 다음과 같이 수정한다. CentOS 7의 경우 python3 는 python34 또는 python36 이다.
BuildRequires: python%{python3_pkgversion}-sphinx
..
BuildRequires: python%{python3_pkgversion}-devel
make -O <== 에서 옵션 -O를 삭제한다.
또는 Fedora29 의 llvm-7.0.1-4 소스를 사용해도 된다.
fc29 의 llvm 은 ninja 로 빌드하기 때문에, 오히려 아래의 pdfium 을 빌드하기 위해 ninja 를 먼저 접해보는 것도 좋을 수 있다.
ninja 빌드 속도가 그렇게 빠르지는 않다.
$ time rpmbuild --rebuild llvm-7.0.1-3.el7.src.rpm
real 21m33.500s
user 205m20.212s
sys 26m7.622s
$ time rpmbuild --rebuild llvm-7.0.1-4.el7.src.rpm
real 22m35.076s
user 222m45.459s
sys 28m35.379s
llvm 과 lld 를 빌드 후 업데이트 한 후에, clang 을 빌드하고 설치한다.
clang 의 경우 spec 파일에 다음을 추가한다.
내부의 python 코드는 python3 에서 동작하지만, file=sys.stderr
CentOS7 의 python 은 디폴트로 python2 이며 rpm 패키징도 대부분 python2 코드기반으로 충돌한다.
패키징시 아래를 추가해서 python byte compile이 실패해도 패키징 오류가 나지 않도록 한다.
%global _python_bytecompile_errors_terminate_build 0
%global _pkgdocdir /usr/share/doc/clang
...
# Fix compat
mkdir -p %{_datadir}/clang/
install -p -m644 tools/clang-format/clang-format.py %{buildroot}%{_datadir}/clang/
install -p -m644 tools/clang-format/clang-format-diff.py %{buildroot}%{_datadir}/clang/
...
이제 toolchain.ninja 의 clang++ 의 경로를 바꾸거나, pdfium/third_party/llvm-build/Release+Asserts/bin/ 폴더의 실행파일들을 새로 빌드한 도구들로 변경해준다. 전자를 변경하면, 테스트 아규먼트 옵션 생성시 계속 수정해야 하기 때문에, third_party 의 clang 및 llvm 도구들의 경로를 수정한다.
$ cd ../../third_party/llvm-build/Release+Asserts/bin
$ ls
clang clang++ clang-cl ld.lld lld lld-link llvm-ar llvm-objcopy llvm-pdbutil llvm-symbolizer llvm-undname
$ rm -f llvm* lld clang
$ ln -s /usr/bin/llvm-ar .
$ ln -s /usr/bin/llvm-objcopy .
$ ln -s /usr/bin/llvm-pdbutil .
$ ln -s /usr/bin/llvm-symbolizer .
$ ln -s /usr/bin/llvm-undname .
$ ln -s /usr/bin/lld .
$ ln -s /usr/bin/clang .
다시 빌드해 본다.
$ cd ~/PDFium/out/First
$ ninja pdfium
...
error: unknown warning option '-Wno-implicit-int-float-conversion'; did you mean '-Wno-float-overflow-conversion'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wno-c99-designator'; did you mean '-Wno-gnu-designator'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wno-reorder-init-list' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wno-final-dtor-non-final-class'; did you mean '-Wno-abstract-final-class'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wno-sizeof-array-div'; did you mean '-Wno-sizeof-array-decay'? [-Werror,-Wunknown-warning-option]
...
gcc 7.2 이상의 버전에서 사용하는 옵션들이 보인다.
처음에 만든 args.gn 아규먼트 옵션 중에 clang 을 사용하지 않도록 하는 옵션이 있다는 것을 알게 되었다.
옵션을 추가하고 다시 빌드해 본다.
g++: error: unrecognized command line option ‘-std=gnu++14’
gnu++14 옵션은 gcc 4.9(5.0) 이상에서 지원하는 옵션이다. CentOS 7 의 기본 gcc 4.8.5 다.
내용 추가
PDFium is transitioning to C++14, but still supports C++11 compatibility for the duration of the transition period. Prefer to use only C++11 features, though technically C++14 is allowed in code that is only built when V8, XFA, or Skia is turned on.
일단. v8, xfa, skia 관련 옵션은 모두 끄고 테스트한다.
use_cxx11 = true
is_clang = false
is_cfi = false
c++11 을 사용하기 위해서는 is_cfi 를 끄고 사용해야 한다. 잘 안된다.
아래처럼 그냥 scl 툴을 설치해서 해결한다.
- CentOS 7 에서 gcc 7 / gcc 8 빌드 환경 구축하기 [feat. SCL 저장소]
# yum install centos-release-scl
# yum install devtoolset-7-gcc-c++
# yum install devtoolset-8-gcc-c++
$ scl enable devtoolset-7 bash
$ gcc --version
gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gcc 8 개발 환경을 사용하려면,
$ scl -l
devtoolset-7
devtoolset-8
llvm-toolset-7
$ scl enable devtoolset-8 bash
$ gcc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
다시 빌드해 본다.
../../build/linux/debian_sid_amd64-sysroot/usr/include/features.h:424:12: fatal error: sys/cdefs.h: 그런 파일이나 디렉터리가 없습니다
# include <sys/cdefs.h>
리눅스 헤더들도 데비안스러운 것들을 끌고 오고 있다.
헤메다가 아래 옵션을 발견했다. args.gn 에 다음 옵션을 추가한다.
다시 빌드한다.
$ cd out/first
$ ninja pdfium
[1003/1003] STAMP obj/pdfium.stamp
다시 빌드한다.
$ ninja
[536/536] LINK ./zlib_bench
다시 빌드한다.
$ ninja
ninja: no work to do.
뭔가 컴파일을 하지만, 라이브러리가 생성되지 않는다.
뭔가 빠진 아규먼트들을 더 찾아서 이것저것 추가해 본다.
pdf_is_standalone = true # Set for a non-embedded build.
pdf_is_complete_lib=true
pdf_enable_xfa = false # XFA support enabled.
pdf_enable_v8 = false # Javascript support enabled.
pdf_use_skia = false # Avoid skia backend experiment.
pdf_use_skia_paths = false # Avoid other skia backend experiment.
pdf_bundle_freetype = true
clang_use_chrome_plugins = false
use_goma = false
use_custom_libcxx=false
use_sysroot = false
is_component_build = false
is_debug = true # Enable debugging features.
is_clang = false # Avoid dependency hell.
[respiro@localhost first]$ ninja pdfium
[1/1] Regenerating ninja files
[942/942] AR obj/libpdfium.a
드디서 obj 폴더아래에 libpdfium.a 를 만들었다.
3. 링크 테스트
간단한 컴파일 테스트를 해 본다.
pdf_hello.c
#include <stdio.h>
#include <fpdfview.h>
int main() {
FPDF_InitLibrary();
FPDF_DestroyLibrary();
printf("PDFium hello.\n");
return 0;
}
Makefile
PDFIUM= ../pdfium
INC_DIR= -I ${PDFIUM}/public
LIB_DIR= -L ${PDFIUM}/out/first/obj
PDF_LIBS= -lpdfium
STD_LIBS= -lpthread -lm -lc -lstdc++
default:
rm -f pdf_hello
gcc -o first first.c ${INC_DIR} ${LIB_DIR} ${PDF_LIBS} ${STD_LIBS}
테스트
[respiro@localhost test]$ make
rm -f pdf_hello
gcc -o pdf_hello pdf_hello.c -I ../pdfium/public -L ../pdfium/out/first/obj -lpdfium -lpthread -lm -lc -lstdc++
$ ./first
PDFium hello.
4. 시스템 라이브러리로 링크하기
소스를 살펴보면, third_party 폴더에 외부 라이브러리들이 있다.
third_party/BUILD.gn 파일을 보면 다음의 옵션을 사용해서 시스템의 라이브러리들을 사용할 수 있도록 되어 있다.
use_system_zlib = true
use_system_libpng = true
use_system_lcms2 = true
use_system_libjpeg = true
use_libjpeg_turbo = true
use_system_libopenjpeg2 = true
openjpeg 의 경우, 2.3 이상의 버전이 시스템에 설치된 경우가 아니라면, 임베드된 openjpeg 코드를 사용한다.
jpeg 의 경우, use_system_libjpeg과 use_libjpeg_turbo 를 모두 활성화해서 CentOS7 의 jpeg turbo 라이브러리를 링크하도록 한다.
임베드된 소스는 turbo_jpeg 이므로 시스템 라이브러리와 상관없이 use_libjpeg_turbo = true 로 항상 설정한다.
일단 시스템의 zlib 을 사용하도록 하고 다른 옵션은 막거나 제거해서 아규먼트를 수정해서 테스트 해본다.
앞에서 만든 테스트용 Makefile 을 실행해본다.
gcc -o pdf_hello pdf_hello.c -I ../pdfium/public -L ../pdfium/out/second/obj -lpdfium -lpthread -lm -lc -lstdc++
../pdfium/out/second/obj/libpdfium.a(flatemodule.o): In function `fxcodec::(anonymous namespace)::FlateCompress(unsigned char*, unsigned long*, unsigned char const*, unsigned int)':
/home/respiro/rpmbuild/SOURCES/PDFium/pdfium/out/second/../../core/fxcodec/flate/flatemodule.cpp:62: undefined reference to `compress'
../pdfium/out/second/obj/libpdfium.a(flatemodule.o): In function `fxcodec::(anonymous namespace)::FlateInit()':
/home/respiro/rpmbuild/SOURCES/PDFium/pdfium/out/second/../../core/fxcodec/flate/flatemodule.cpp:69: undefined reference to `inflateInit_'
../pdfium/out/second/obj/libpdfium.a(flatemodule.o): In function `fxcodec::(anonymous namespace)::FlateOutput(z_stream_s*, unsigned char*, unsigned int)':
/home/respiro/rpmbuild/SOURCES/PDFium/pdfium/out/second/../../core/fxcodec/flate/flatemodule.cpp:84: undefined reference to `inflate'
../pdfium/out/second/obj/libpdfium.a(flatemodule.o): In function `fxcodec::(anonymous namespace)::FlateEnd(z_stream_s*)':
/home/respiro/rpmbuild/SOURCES/PDFium/pdfium/out/second/../../core/fxcodec/flate/flatemodule.cpp:101: undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
zlib 링크에 문제가 있음을 알 수 있다.
Makefile 에 시스템의 libz 를 링크하도록 추가한다.
STD_LIBS= -lpthread -lm -lc -lstdc++ -lz
다시 빌드하면 테스트 파일이 정상 동작함을 알 수 있다.
이런 식으로 앞에서 주석으로 처리한 다른 시스템 라이브러리들을 링크할 수 있다.
CentOS 7 에서는 다음의 패키지를 설치해서 사용할 수 있다.
# yum install libpng-devel zlib-devel openjpeg2-devel lcms2-devel libjpeg-turbo-devel
STD_LIBS= -lpthread -lm -lc -lstdc++ -lz -ljpeg -lopenjp2 -llcms2 -lpng
다음 삽질은 공유 라이브러리와 gdal 라이브러리 빌드를 위한 삽질이 된다.
추가 삽질뒤에 찾은 옵션이다. tiff 와 icu 라이브러리를 시스템 라이브러리로 사용하는 옵션은 아직 찾지 못했다.
use_system_freetype = true
pdf_bundle_freetype = false
freetype 을 시스템 라이브러리로 사용하기 위해서는 third_party/freetype 을 사용하지 않도록 pdf_bundle_freetype 을 사용하지 않도록 해야 한다.
PDFIUM= ../pdfium
INC_DIR= -I ${PDFIUM}/public
LIB_DIR= -L ${PDFIUM}/out/first/obj
PDF_LIBS= -lpdfium
STD_LIBS= -lpthread -lm -lc -lstdc++-lz -ljpeg -lopenjp2 -llcms2 -lpng -lfreetype
default:
rm -f pdf_hello
gcc -o first first.c ${INC_DIR} ${LIB_DIR} ${PDF_LIBS} ${STD_LIBS}
5. 아규먼트 목록 출력하기
앞서 사용한 아규먼트들의 목록을 보려면, 다음과 같이 한다.
$ cd pdfium
$ gn args out/first --list
action_pool_depth
Current value (from the default) = -1
From //build/toolchain/BUILD.gn:10
Pool for non goma tasks.
android_full_debug
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:53
Normally, Android builds are lightly optimized, even for debug builds, to
keep binary size down. Setting this flag to true disables such optimization
archive_seed_corpus
Current value (from the default) = true
From //build/config/sanitizers/sanitizers.gni:117
When true, seed corpora archives are built.
asan_globals
Current value (from the default) = true
From //build/config/sanitizers/sanitizers.gni:166
Detect overflow/underflow for global objects.
Mac: http://crbug.com/352073
asan_use_blacklist
Current value (from the default) = true
From //build/config/sanitizers/sanitizers.gni:109
Use blacklists from tools/memory/asan when compiling with asan.
auto_profile_path
Current value (from the default) = ""
From //build/config/compiler/BUILD.gn:89
AFDO (Automatic Feedback Directed Optimizer) is a form of profile-guided
optimization that GCC supports. It used by ChromeOS in their official
builds. To use it, set auto_profile_path to the path to a file containing
the needed gcov profiling data.
binutils_path
Current value (from the default) = "../../third_party/binutils/Linux_x64/Release/bin"
From //build/config/compiler/BUILD.gn:62
cast_is_debug
Current value (from the default) = false
From //build/config/chromecast_build.gni:16
If true, IS_CAST_DEBUG_BUILD() will evaluate to 1 in version.h. Otherwise,
it will evaluate to 0. Overriding this when is_debug=false is useful for
doing engineering builds.
cc_wrapper
Current value (from the default) = ""
From //build/toolchain/cc_wrapper.gni:36
Set to "ccache", "icecc" or "distcc". Probably doesn't work on windows.
chrome_pgo_phase
Current value (from the default) = 0
From //build/config/compiler/pgo/pgo.gni:13
Specify the current PGO phase.
Here's the different values that can be used:
0 : Means that PGO is turned off.
1 : Used during the PGI (instrumentation) phase.
2 : Used during the PGO (optimization) phase.
TODO(sebmarchand): Add support for the PGU (update) phase.
chromecast_branding
Current value (from the default) = "public"
From //build/config/chromecast_build.gni:20
chromecast_branding is used to include or exclude Google-branded components.
Set it to "public" for a Chromium build.
chromeos_afdo_platform
Current value (from the default) = "silvermont"
From //build/config/compiler/BUILD.gn:111
This configuration is used to select a default profile in Chrome OS based on
the microarchitectures we are using. This is only used if
clang_use_default_sample_profile is true and clang_sample_profile_path is
empty.
clang_base_path
Current value (from the default) = "//third_party/llvm-build/Release+Asserts"
From //build/config/clang/clang.gni:14
clang_emit_debug_info_for_profiling
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:114
Emit debug information for profiling wile building with clang.
clang_sample_profile_path
Current value (from the default) = ""
From //build/config/compiler/BUILD.gn:96
Path to an AFDO profile to use while building with clang, if any. Empty
implies none.
clang_use_chrome_plugins
Current value = false
From //out/first/args.gn:12
Overridden from the default = false
From //build/config/clang/clang.gni:12
Indicates if the build should use the Chrome-specific plugins for enforcing
coding guidelines, etc. Only used when compiling with Clang.
clang_use_default_sample_profile
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:104
Some configurations have default sample profiles. If this is true and
clang_sample_profile_path is empty, we'll fall back to the default.
We currently only have default profiles for Chromium in-tree, so we disable
this by default for all downstream projects, since these profiles are likely
nonsensical for said projects.
compiler_timing
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:117
Turn this on to have the compiler output extra timing information.
concurrent_links
Current value (from the default) = -1
From //build/toolchain/concurrent_links.gni:19
Limit the number of concurrent links; we often want to run fewer
links at once than we do compiles, because linking is memory-intensive.
The default to use varies by platform and by the amount of memory
available, so we call out to a script to get the right value.
coverage_instrumentation_input_file
Current value (from the default) = ""
From //build/config/coverage/coverage.gni:29
The path to the coverage instrumentation input file should be a source root
absolute path (e.g. //out/Release/coverage_instrumentation_input.txt), and
the file consists of multiple lines where each line represents a path to a
source file, and the paths must be relative to the root build directory.
e.g. ../../base/task/post_task.cc for build directory 'out/Release'.
NOTE that this arg will be non-op if use_clang_coverage is false.
current_cpu
Current value (from the default) = ""
(Internally set; try `gn help current_cpu`.)
current_os
Current value (from the default) = ""
(Internally set; try `gn help current_os`.)
custom_toolchain
Current value (from the default) = ""
From //build/config/BUILDCONFIG.gn:144
Allows the path to a custom target toolchain to be injected as a single
argument, and set as the default toolchain.
dcheck_always_on
Current value (from the default) = false
From //build/config/dcheck_always_on.gni:14
Set to true to enable dcheck in Release builds.
dcheck_is_configurable
Current value (from the default) = false
From //build/config/dcheck_always_on.gni:9
Enables DCHECKs to be built-in, but to default to being non-fatal/log-only.
DCHECKS can then be set as fatal/non-fatal via the DCheckIsFatal feature.
See crbug.com/596231 for details on how this is used.
disable_libfuzzer
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:92
Helper variable for testing builds with disabled libfuzzer.
Not for client use.
enable_callgrind
Current value (from the default) = false
From //pdfium.gni:57
Enable callgrind for performance profiling
enable_cast_renderer
Current value (from the default) = false
From //build/config/chromecast_build.gni:46
True to enable the cast renderer. It is enabled by default for non-android
builds.
enable_full_stack_frames_for_profiling
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:70
Compile in such a way as to make it possible for the profiler to unwind full
stack frames. Setting this flag has a large effect on the performance of the
generated code than just setting profiling, but gives the profiler more
information to analyze.
Requires profiling to be set to true.
enable_iterator_debugging
Current value (from the default) = false
From //build/config/BUILD.gn:40
When set (the default) enables C++ iterator debugging in debug builds.
Iterator debugging is always off in release builds (technically, this flag
affects the "debug" config, which is always available but applied by
default only in debug builds).
Iterator debugging is generally useful for catching bugs. But it can
introduce extra locking to check the state of an iterator against the state
of the current object. For iterator- and thread-heavy code, this can
significantly slow execution - two orders of magnitude slowdown has been
seen (crbug.com/903553) and iterator debugging also slows builds by making
generation of snapshot_blob.bin take ~40-60 s longer. Therefore this
defaults to off.
enable_precompiled_headers
Current value (from the default) = true
From //build/config/pch.gni:11
Precompiled header file support is by default available,
but for distributed build system uses (like goma) or when
doing official builds.
enable_profiling
Current value (from the default) = false
From //build/config/compiler/compiler.gni:48
Compile in such a way as to enable profiling of the generated code. For
example, don't omit the frame pointer and leave in symbols.
enable_resource_whitelist_generation
Current value (from the default) = false
From //build/toolchain/gcc_toolchain.gni:27
fatal_linker_warnings
Current value (from the default) = true
From //build/config/compiler/BUILD.gn:78
Enable fatal linker warnings. Building Chromium with certain versions
of binutils can cause linker warning.
forbid_non_component_debug_builds
Current value (from the default) = false
From //build/config/compiler/compiler.gni:89
Whether an error should be raised on attempts to make debug builds with
is_component_build=false. Very large debug symbols can have unwanted side
effects so this is enforced by default for chromium.
force_local_build_id
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:139
By default only the binaries in official builds get build IDs.
full_wpo_on_official
Current value (from the default) = false
From //build/config/compiler/compiler.gni:183
gcc_target_rpath
Current value (from the default) = ""
From //build/config/gcc/BUILD.gn:19
When non empty, overrides the target rpath value. This allows a user to
make a Chromium build where binaries and shared libraries are meant to be
installed into separate directories, like /usr/bin/chromium and
/usr/lib/chromium for instance. It is useful when a build system that
generates a whole target root filesystem (like Yocto) is used on top of gn,
especially when cross-compiling.
Note: this gn arg is similar to gyp target_rpath generator flag.
generate_linker_map
Current value (from the default) = false
From //build/toolchain/toolchain.gni:26
Used for binary size analysis.
generate_order_files
Current value (from the default) = false
From //build/config/chrome_build.gni:17
Turn this on to generate order files. See
https://chromium.googlesource.com/chromium/src/+/master/docs/win_order_files.md
gold_path
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:74
When we are going to use gold we need to find it.
This is initialized below, after use_gold might have been overridden.
goma_dir
Current value (from the default) = "/home/respiro/goma"
From //build/toolchain/goma.gni:26
Absolute directory containing the gomacc binary.
has_gomacc_path
Current value (from the default) = false
From //build/toolchain/goma.gni:14
This flag is for ChromeOS compiler wrapper.
By passing gomacc path via GOMACC_PATH environment variable, ChromeOS'
compiler wrapper invokes gomacc inside it.
host_byteorder
Current value (from the default) = "undefined"
From //build/config/host_byteorder.gni:9
host_cpu
Current value (from the default) = "x64"
(Internally set; try `gn help host_cpu`.)
host_os
Current value (from the default) = "linux"
(Internally set; try `gn help host_os`.)
host_pkg_config
Current value (from the default) = ""
From //build/config/linux/pkg_config.gni:36
A optional pkg-config wrapper to use for tools built on the host.
host_toolchain
Current value (from the default) = ""
From //build/config/BUILDCONFIG.gn:148
This should not normally be set as a build argument. It's here so that
every toolchain can pass through the "global" value via toolchain_args().
hwasan_platform
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:21
Specify whether to target the platform's copy of the HWASan runtime,
rather than one bundled with the application.
icu_use_data_file
Current value (from the default) = true
From //third_party/icu/config.gni:8
Tells icu to load an external data file rather than rely on the icudata
being linked directly into the binary.
ignore_elf32_limitations
Current value (from the default) = false
From //build_overrides/build.gni:42
Android 32-bit non-component, non-clang builds cannot have symbol_level=2
due to 4GiB file size limit, see https://crbug.com/648948.
Set this flag to true to skip the assertion.
init_stack_vars
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:145
Initialize all local variables with a pattern. This flag will fill uninitialized
floating-point types (and 32-bit pointers) with 0xFF and the rest with 0xAA.
This allows to make behavior of uninitialized memory bugs consistent, easier to
recognize when debugging and often just to crash immediately.
ios_deployment_target
Current value (from the default) = "12.0"
From //build/config/ios/ios_sdk_overrides.gni:10
Version of iOS that we're targeting.
is_asan
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:12
Compile for Address Sanitizer to find memory bugs.
is_cast_audio_only
Current value (from the default) = false
From //build/config/chromecast_build.gni:23
Set this true for an audio-only Chromecast build.
is_cast_desktop_build
Current value (from the default) = false
From //build/config/chromecast_build.gni:39
True if Chromecast build is targeted for linux desktop. This type of build
is useful for testing and development, but currently supports only a subset
of Cast functionality. Though this defaults to true for x86 Linux devices,
this should be overriden manually for an embedded x86 build.
TODO(slan): Remove instances of this when x86 is a fully supported platform.
is_cfi
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:58
Compile with Control Flow Integrity to protect virtual calls and casts.
See http://clang.llvm.org/docs/ControlFlowIntegrity.html
TODO(pcc): Remove this flag if/when CFI is enabled in all official builds.
is_chrome_branded
Current value (from the default) = false
From //build/config/chrome_build.gni:9
Select the desired branding flavor. False means normal Chromium branding,
true means official Google Chrome branding (requires extra Google-internal
resources).
is_chromecast
Current value (from the default) = false
From //build/config/chromecast_build.gni:11
Set this true for a Chromecast build. Chromecast builds are supported on
Linux and Android.
is_clang
Current value = false
From //out/first/args.gn:20
Overridden from the default = true
From //build/config/BUILDCONFIG.gn:137
Set to true when compiling with the Clang compiler.
is_component_build
Current value = false
From //out/first/args.gn:18
Overridden from the default = false
From //build/config/BUILDCONFIG.gn:165
Component build. Setting to true compiles targets declared as "components"
as shared libraries loaded dynamically. This speeds up development time.
When false, components will be linked statically.
For more information see
https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md
is_debug
Current value = false
From //out/first/args.gn:19
Overridden from the default = true
From //build/config/BUILDCONFIG.gn:155
Debug build. Enabling official builds automatically sets is_debug to false.
is_desktop_linux
Current value (from the default) = true
From //build/config/BUILDCONFIG.gn:134
Whether we're a traditional desktop unix.
is_hwasan
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:17
Compile for Hardware-Assisted Address Sanitizer to find memory bugs
(android/arm64 only).
See http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html
is_lsan
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:24
Compile for Leak Sanitizer to find leaks.
is_msan
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:27
Compile for Memory Sanitizer to find uninitialized reads.
is_multi_dll_chrome
Current value (from the default) = false
From //build/config/chrome_build.gni:13
Break chrome.dll into multple pieces based on process type. Only available
on Windows.
is_official_build
Current value (from the default) = false
From //build/config/BUILDCONFIG.gn:131
Set to enable the official build level of optimization. This has nothing
to do with branding, but enables an additional level of optimization above
release (!is_debug). This might be better expressed as a tri-state
(debug, release, official) but for historical reasons there are two
separate flags.
is_tsan
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:30
Compile for Thread Sanitizer to find threading bugs.
is_ubsan
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:34
Compile for Undefined Behaviour Sanitizer to find various types of
undefined behaviour (excludes vptr checks).
is_ubsan_no_recover
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:37
Halt the program if a problem is detected.
is_ubsan_null
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:40
Compile for Undefined Behaviour Sanitizer's null pointer checks.
is_ubsan_security
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:88
Enables core ubsan security features. Will later be removed once it matches
is_ubsan.
is_ubsan_vptr
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:43
Compile for Undefined Behaviour Sanitizer's vptr checks.
is_win_fastlink
Current value (from the default) = false
From //build/config/compiler/compiler.gni:73
Tell VS to create a PDB that references information in .obj files rather
than copying it all. This should improve linker performance. mspdbcmf.exe
can be used to convert a fastlink pdb to a normal one.
ldso_path
Current value (from the default) = ""
From //build/config/gcc/BUILD.gn:20
libcxx_is_shared
Current value (from the default) = false
From //build/config/c++/c++.gni:44
WARNING: Setting this to a non-default value is highly discouraged.
If true, libc++ will be built as a shared library; otherwise libc++ will be
linked statically. Setting this to something other than the default is
unsupported and can be broken by libc++ rolls. Note that if this is set to
true, you must also set libcxx_abi_unstable=false, which is bad for
performance and memory use.
libcxx_natvis_include
Current value (from the default) = true
From //build/config/c++/c++.gni:30
Builds libcxx Natvis into the symbols for type visualization.
Set to false to workaround http://crbug.com/966676 and
http://crbug.com/966687.
linux_use_bundled_binutils
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:60
llvm_force_head_revision
Current value (from the default) = false
From //build/toolchain/toolchain.gni:18
If this is set to true, or if LLVM_FORCE_HEAD_REVISION is set to 1
in the environment, we use the revision in the llvm repo to determine
the CLANG_REVISION to use, instead of the version hard-coded into
//tools/clang/scripts/update.py. This should only be used in
conjunction with setting LLVM_FORCE_HEAD_REVISION in the
environment when `gclient runhooks` is run as well.
mac_sdk_min
Current value (from the default) = "10.14"
From //build/config/mac/mac_sdk_overrides.gni:12
max_jobs_per_link
Current value (from the default) = 8
From //build/config/compiler/compiler.gni:68
Limit the number of jobs (threads/processes) the linker is allowed
to use (for linkers that support this).
msan_track_origins
Current value (from the default) = 2
From //build/config/sanitizers/sanitizers.gni:48
Track where uninitialized memory originates from. From fastest to slowest:
0 - no tracking, 1 - track only the initial allocation site, 2 - track the
chain of stores leading from allocation site to use site.
optimize_for_fuzzing
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:96
Optimize for coverage guided fuzzing (balance between speed and number of
branches). Can be also used to remove non-determinism and other issues.
pdf_bundle_freetype
Current value = true
From //out/first/args.gn:10
Overridden from the default = true
From //pdfium.gni:16
Build PDFium either:
1) When set to true, with a bundled FreeType, built from FreeType source
code in //third_party/freetype and PDFium's FreeType configs in
third_party/freetype/include.
2) When set to false, use whatever FreeType target is defined in
//build/config/freetype.
pdf_enable_click_logging
Current value (from the default) = false
From //pdfium.gni:19
Generate logging messages for click events that reach PDFium
pdf_enable_v8
Current value = false
From //out/first/args.gn:6
Overridden from the default = true
From //pdfium.gni:22
Build PDFium either with or without v8 support.
pdf_enable_xfa
Current value = false
From //out/first/args.gn:5
Overridden from the default = false
From //pdfium.gni:25
Build PDFium either with or without XFA Forms support.
pdf_enable_xfa_bmp
Current value (from the default) = true
From //pdfium.gni:28
If XFA, also support bmp codec. Ignored if not XFA.
pdf_enable_xfa_gif
Current value (from the default) = true
From //pdfium.gni:31
If XFA, also support gif codec. Ignored if not XFA.
pdf_enable_xfa_png
Current value (from the default) = true
From //pdfium.gni:34
If XFA, also support png codec. Ignored if not XFA.
pdf_enable_xfa_tiff
Current value (from the default) = true
From //pdfium.gni:37
If XFA, also support png codec. Ignored if not XFA.
pdf_is_complete_lib
Current value = true
From //out/first/args.gn:4
Overridden from the default = false
From //pdfium.gni:54
Build a complete static library
pdf_is_standalone
Current value = true
From //out/first/args.gn:3
Overridden from the default = false
From //pdfium.gni:51
Build PDFium standalone
pdf_use_skia
Current value = false
From //out/first/args.gn:7
Overridden from the default = false
From //pdfium.gni:41
Build PDFium against Skia (experimental) rather than AGG. Use Skia to draw
everything.
pdf_use_skia_paths
Current value = false
From //out/first/args.gn:8
Overridden from the default = false
From //pdfium.gni:45
Build PDFium against Skia (experimental) rather than AGG. Use Skia to draw
paths.
pdf_use_win32_gdi
Current value (from the default) = false
From //pdfium.gni:48
Build PDFium with or without experimental win32 GDI APIs.
pgo_data_path
Current value (from the default) = ""
From //build/config/compiler/pgo/pgo.gni:16
When using chrome_pgo_phase = 2, read profile data from this path.
pkg_config
Current value (from the default) = ""
From //build/config/linux/pkg_config.gni:33
A pkg-config wrapper to call instead of trying to find and call the right
pkg-config directly. Wrappers like this are common in cross-compilation
environments.
Leaving it blank defaults to searching PATH for 'pkg-config' and relying on
the sysroot mechanism to find the right .pc files.
proprietary_codecs
Current value (from the default) = false
From //build/config/features.gni:26
Enables proprietary codecs and demuxers; e.g. H264, AAC, MP3, and MP4.
We always build Google Chrome and Chromecast with proprietary codecs.
Note: this flag is used by WebRTC which is DEPSed into Chrome. Moving it
out of //build will require using the build_overrides directory.
ro_segment_workaround_for_valgrind
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:122
Set to true to pass --no-rosegment to lld. This is a workaround
for a KI issue in Valgrind,
https://bugs.kde.org/show_bug.cgi?id=384727
sample_profile_is_accurate
Current value (from the default) = false
From //build/config/compiler/compiler.gni:114
Whether we should consider the profile we're using to be accurate. Accurate
profiles have the benefit of (potentially substantial) binary size
reductions, by instructing the compiler to optimize cold and uncovered
functions heavily for size. This often comes at the cost of performance.
sanitizer_coverage_flags
Current value (from the default) = ""
From //build/config/sanitizers/sanitizers.gni:106
Value for -fsanitize-coverage flag. Setting this causes
use_sanitizer_coverage to be enabled.
This flag is not used for libFuzzer (use_libfuzzer=true). Instead, we use:
-fsanitize=fuzzer-no-link
Default value when unset and use_fuzzing_engine=true:
trace-pc-guard
Default value when unset and use_sanitizer_coverage=true:
trace-pc-guard,indirect-calls
strip_absolute_paths_from_debug_symbols
Current value (from the default) = true
From //build/config/compiler/compiler.gni:213
strip_debug_info
Current value (from the default) = false
From //build/config/compiler/compiler.gni:44
Android-only: Strip the debug info of libraries within lib.unstripped to
reduce size. As long as symbol_level > 0, this will still allow stacks to be
symbolized.
symbol_level
Current value (from the default) = -1
From //build/config/compiler/compiler.gni:39
How many symbols to include in the build. This affects the performance of
the build since the symbols are large and dealing with them is slow.
2 means regular build with symbols.
1 means minimal symbols, usually enough for backtraces only. Symbols with
internal linkage (static functions or those in anonymous namespaces) may not
appear when using this level.
0 means no symbols.
-1 means auto-set according to debug/release and platform.
system_libdir
Current value (from the default) = "lib"
From //build/config/linux/pkg_config.gni:47
CrOS systemroots place pkgconfig files at <systemroot>/usr/share/pkgconfig
and one of <systemroot>/usr/lib/pkgconfig or <systemroot>/usr/lib64/pkgconfig
depending on whether the systemroot is for a 32 or 64 bit architecture.
When build under GYP, CrOS board builds specify the 'system_libdir' variable
as part of the GYP_DEFINES provided by the CrOS emerge build or simple
chrome build scheme. This variable permits controlling this for GN builds
in similar fashion by setting the `system_libdir` variable in the build's
args.gn file to 'lib' or 'lib64' as appropriate for the target architecture.
target_cpu
Current value (from the default) = ""
(Internally set; try `gn help target_cpu`.)
target_os
Current value (from the default) = ""
(Internally set; try `gn help target_os`.)
target_rpath
Current value (from the default) = ""
From //build/config/chromecast_build.gni:27
If non empty, rpath of executables is set to this.
If empty, default value is used.
target_sysroot
Current value (from the default) = ""
From //build/config/sysroot.gni:13
The absolute path of the sysroot that is applied when compiling using
the target toolchain.
target_sysroot_dir
Current value (from the default) = "//build/linux"
From //build/config/sysroot.gni:16
The absolute path to directory containing linux sysroot images
thin_lto_enable_optimizations
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:136
toolkit_views
Current value (from the default) = true
From //build/config/ui.gni:35
True means the UI is built using the "views" framework.
treat_warnings_as_errors
Current value (from the default) = true
From //build/config/compiler/BUILD.gn:49
Default to warnings as errors for default workflow, where we catch
warnings with known toolchains. Allow overriding this e.g. for Chromium
builds on Linux that could use a different version of the compiler.
With GCC, warnings in no-Chromium code are always not treated as errors.
use_afl
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:84
Compile for fuzzing with AFL.
use_aura
Current value (from the default) = true
From //build/config/ui.gni:30
Indicates if Aura is enabled. Aura is a low-level windowing library, sort
of a replacement for GDI or GTK.
use_cfi_cast
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:64
Enable checks for bad casts: derived cast and unrelated cast.
TODO(krasin): remove this, when we're ready to add these checks by default.
https://crbug.com/626794
use_cfi_diag
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:73
Print detailed diagnostics when Control Flow Integrity detects a violation.
use_cfi_icall
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:69
Enable checks for indirect function calls via a function pointer.
TODO(pcc): remove this when we're ready to add these checks by default.
https://crbug.com/701919
use_cfi_recover
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:77
Let Control Flow Integrity continue execution instead of crashing when
printing diagnostics (use_cfi_diag = true).
use_clang_coverage
Current value (from the default) = false
From //build/config/coverage/coverage.gni:17
Enable Clang's Source-based Code Coverage.
use_custom_libcxx
Current value = false
From //out/first/args.gn:15
Overridden from the default = true
From //build/config/c++/c++.gni:14
use_custom_libcxx_for_host
Current value (from the default) = false
From //build/config/c++/c++.gni:25
Use libc++ instead of stdlibc++ when using the host_cpu toolchain, even if
use_custom_libcxx is false. This is useful for cross-compiles where a custom
toolchain for the target_cpu has been set as the default toolchain, but
use_custom_libcxx should still be true when building for the host. The
expected usage is to set use_custom_libcxx=false and
use_custom_libcxx_for_host=true in the passed in buildargs.
use_cxx11
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:92
Allow projects that wish to stay on C++11 to override Chromium's default.
use_cxx11_on_android
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:150
C++11 may not be an option if Android test infrastructure is used.
use_dbus
Current value (from the default) = true
From //build/config/features.gni:31
use_debug_fission
Current value (from the default) = "default"
From //build/config/compiler/compiler.gni:60
use_debug_fission: whether to use split DWARF debug info
files. This can reduce link time significantly, but is incompatible
with some utilities such as icecc and ccache. Requires gold and
gcc >= 4.8 or clang.
http://gcc.gnu.org/wiki/DebugFission
This is a placeholder value indicating that the code below should set
the default. This is necessary to delay the evaluation of the default
value expression until after its input values such as use_gold have
been set, e.g. by a toolchain_args() block.
use_ghash
Current value (from the default) = true
From //build/config/compiler/BUILD.gn:126
Turn this on to use ghash feature of lld for faster debug link on Windows.
http://blog.llvm.org/2018/01/improving-link-time-on-windows-with.html
use_gio
Current value (from the default) = true
From //build/config/features.gni:33
use_glib
Current value (from the default) = true
From //build/config/ui.gni:39
Whether we should use glib, a low level C utility library.
use_gold
Current value (from the default) = true
From //build/config/compiler/compiler.gni:195
use_goma
Current value = false
From //out/first/args.gn:14
Overridden from the default = false
From //build/toolchain/goma.gni:9
Set to true to enable distributed compilation using Goma.
use_icf
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:166
Set to true to use icf, Identical Code Folding.
icf=all is broken in older golds, see
https://sourceware.org/bugzilla/show_bug.cgi?id=17704
See also https://crbug.com/663886
`linux_use_bundled_binutils` is to avoid breaking Linux distros which may
still have a buggy gold.
chromeos binutils has been patched with the fix, so always use icf there.
The bug only affects x86 and x64, so we can still use ICF when targeting
other architectures.
lld doesn't have the bug.
use_incremental_wpo
Current value (from the default) = false
From //build/config/compiler/compiler.gni:77
Whether or not we should turn on incremental WPO. Only affects the VS
Windows build.
use_jacoco_coverage
Current value (from the default) = false
From //build/config/coverage/coverage.gni:20
Enables JaCoCo Java code coverage.
use_libfuzzer
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:81
Compile for fuzzing with LLVM LibFuzzer.
See http://www.chromium.org/developers/testing/libfuzzer
use_libjpeg_turbo
Current value = true
From //out/first/args.gn:26
Overridden from the default = true
From //third_party/BUILD.gn:327
Uses libjpeg_turbo as the jpeg implementation. Has no effect if
use_system_libjpeg is set.
use_lld
Current value (from the default) = false
From //build/config/compiler/compiler.gni:189
Set to true to use lld, the LLVM linker.
use_locally_built_instrumented_libraries
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:52
Use dynamic libraries instrumented by one of the sanitizers instead of the
standard system libraries. Set this flag to build the libraries from source.
use_ozone
Current value (from the default) = false
From //build/config/ui.gni:26
Indicates if Ozone is enabled. Ozone is a low-level library layer for Linux
that does not require X11. Enabling this feature disables use of glib, x11,
Pango, and Cairo.
use_rtti
Current value (from the default) = false
From //build/config/compiler/BUILD.gn:83
Build with C++ RTTI enabled. Chromium builds without RTTI by default,
but some sanitizers are known to require it, like CFI diagnostics
and UBsan variants.
use_sanitizer_configs_without_instrumentation
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:114
When enabled, only relevant sanitizer defines are set, but compilation
happens with no extra flags. This is useful when in component build
enabling sanitizers only in some of the components.
use_sanitizer_coverage
Current value (from the default) = false
From //build/config/sanitizers/sanitizers.gni:160
use_sysroot
Current value = false
From //out/first/args.gn:16
Overridden from the default = true
From //build/config/sysroot.gni:18
use_system_freetype
Current value (from the default) = false
From //build/config/freetype/freetype.gni:13
Blink needs a recent and properly build-configured FreeType version to
support OpenType variations, color emoji and avoid security bugs. By default
we ship and link such a version as part of Chrome. For distributions that
prefer to keep linking to the version the system, FreeType must be newer
than version 2.7.1 and have color bitmap support compiled in. WARNING:
System FreeType configurations other than as described WILL INTRODUCE TEXT
RENDERING AND SECURITY REGRESSIONS.
use_system_lcms2
Current value = true
From //out/first/args.gn:24
Overridden from the default = false
From //pdfium.gni:63
Don't build against bundled lcms2.
use_system_libjpeg
Current value = false
From //out/first/args.gn:25
Overridden from the default = false
From //third_party/BUILD.gn:323
Uses system libjpeg. If true, overrides use_libjpeg_turbo.
use_system_libopenjpeg2
Current value = true
From //out/first/args.gn:27
Overridden from the default = false
From //pdfium.gni:66
Don't build against bundled libopenjpeg2.
use_system_libpng
Current value = true
From //out/first/args.gn:23
Overridden from the default = false
From //pdfium.gni:69
Don't build against bundled libpng.
use_system_xcode
Current value (from the default) = ""
From //build_overrides/build.gni:49
Use the system install of Xcode for tools like ibtool, libtool, etc.
This does not affect the compiler. When this variable is false, targets will
instead use a hermetic install of Xcode. [The hermetic install can be
obtained with gclient sync after setting the environment variable
FORCE_MAC_TOOLCHAIN].
use_system_zlib
Current value = true
From //out/first/args.gn:22
Overridden from the default = false
From //pdfium.gni:60
Don't build against bundled zlib.
use_thin_lto
Current value (from the default) = false
From //build/config/compiler/compiler.gni:64
Enables support for ThinLTO, which links 3x-10x faster than full LTO. See
also http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html
use_udev
Current value (from the default) = true
From //build/config/features.gni:29
libudev usage. This currently only affects the content layer.
use_xcode_clang
Current value (from the default) = false
From //build/toolchain/toolchain.gni:23
Compile with Xcode version of clang instead of hermetic version shipped
with the build. Used to be used iOS for official builds, but is now off by
default for all configurations.
using_mismatched_sample_profile
Current value (from the default) = false
From //build/config/compiler/compiler.gni:84
Whether we're using a sample profile collected on an architecture different
than the one we're compiling for.
It's currently not possible to collect AFDO profiles on anything but
x86{,_64}.
v8_current_cpu
Current value (from the default) = "x64"
From //build/config/v8_target_cpu.gni:60
This argument is declared here so that it can be overridden in toolchains.
It should never be explicitly set by the user.
v8_target_cpu
Current value (from the default) = ""
From //build/config/v8_target_cpu.gni:33
This arg is used when we want to tell the JIT-generating v8 code
that we want to have it generate for an architecture that is different
than the architecture that v8 will actually run on; we then run the
code under an emulator. For example, we might run v8 on x86, but
generate arm code and run that under emulation.
This arg is defined here rather than in the v8 project because we want
some of the common architecture-specific args (like arm_float_abi or
mips_arch_variant) to be set to their defaults either if the current_cpu
applies *or* if the v8_current_cpu applies.
As described below, you can also specify the v8_target_cpu to use
indirectly by specifying a `custom_toolchain` that contains v8_$cpu in the
name after the normal toolchain.
For example, `gn gen --args="custom_toolchain=...:clang_x64_v8_arm64"`
is equivalent to setting --args=`v8_target_cpu="arm64"`. Setting
`custom_toolchain` is more verbose but makes the toolchain that is
(effectively) being used explicit.
v8_target_cpu can only be used to target one architecture in a build,
so if you wish to build multiple copies of v8 that are targeting
different architectures, you will need to do something more
complicated involving multiple toolchains along the lines of
custom_toolchain, above.
x64_arch
Current value (from the default) = ""
From //build/config/x64.gni:16
The micro architecture of x64 cpu. This will be a string like "haswell" or
"skylake". An empty string means to use the default architecture which is
"x86-64".
CPU options for "x86-64" in GCC can be found at
https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
CPU options for "x86-64" in llvm can be found at
https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/Support/X86TargetParser.def
6. 전체 빌드하기
out/first/build.ninja 파일을 보면 다음의 빌드 옵션이 있다는 것을 알 수 있다.
build freetype_common: phony obj/freetype_common.stamp
build fuzzers: phony obj/fuzzers.stamp
build pdfium: phony obj/libpdfium.a
build pdfium_all: phony obj/pdfium_all.stamp
build pdfium_embeddertest_deps: phony obj/pdfium_embeddertest_deps.stamp
build pdfium_public_headers: phony obj/pdfium_public_headers.stamp
build pdfium_public_headers_impl: phony obj/pdfium_public_headers_impl.stamp
build pdfium_unittest_deps: phony obj/pdfium_unittest_deps.stamp
build samples: phony obj/samples.stamp
build constants: phony obj/constants/constants.stamp
build fpdfsdk: phony obj/fpdfsdk/fpdfsdk.stamp
build fxjs: phony obj/fxjs/fxjs.stamp
build third_party: phony obj/third_party/third_party.stamp
build cmaps: phony obj/core/fpdfapi/cmaps/cmaps.stamp
...
ninja pdfium 은 pdfium 라이브러리만 빌드한다. unit test 를 포함한 전체 빌드는 다음과 같이 한다.
$ cd out/first
$ ninja pdfium_all
FAILED: obj/testing/test_support/file_util.o
...
../../testing/utils/file_util.cpp: In member function ‘int FileAccessForTesting::GetBlockImpl(long unsigned int, unsigned char*, long unsigned int)’:
../../testing/utils/file_util.cpp:56:3: error: ‘memcpy’ was not declared in this scope
memcpy(pBuf, file_contents_.get() + pos, size);
^~~~~~
../../testing/utils/file_util.cpp:56:3: note: ‘memcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
../../testing/utils/file_util.cpp:10:1:
+#include <cstring>
../../testing/utils/file_util.cpp:56:3:
memcpy(pBuf, file_contents_.get() + pos, size);
^~~~~~
[142/222] CXX obj/fpdfsdk/embeddertests/fpdf_edit_embeddertest.o
ninja: build stopped: subcommand failed.
../../testing/utils/file_util.cpp 파일에 <cstring> 헤더를 추가해 준다.
빌드하면, pdfium_embeddertests 및 pdfium_test, pdfium_unittests 등의 파일이 생성된다.
테스트를 실행한다.
$ ./pdfium_embeddertests
...
[ PASSED ] 449 tests.
[ FAILED ] 31 tests, listed below:
[ FAILED ] CPDFSecurityHandlerEmbedderTest.PasswordAfterGenerateSave
[ FAILED ] FPDFParserDecodeEmbedderTest.Bug_455199
[ FAILED ] FPDFProgressiveRenderEmbedderTest.RenderWithoutPause
[ FAILED ] FPDFProgressiveRenderEmbedderTest.RenderWithPause
[ FAILED ] FPDFProgressiveRenderEmbedderTest.RenderAnnotWithPause
[ FAILED ] FPDFProgressiveRenderEmbedderTest.RenderFormsWithPause
[ FAILED ] FPDFAnnotEmbedderTest.ExtractInkMultiple
[ FAILED ] FPDFAnnotEmbedderTest.AddAndSaveUnderlineAnnotation
[ FAILED ] FPDFAnnotEmbedderTest.ModifyRectQuadpointsWithAP
[ FAILED ] FPDFAnnotEmbedderTest.AddAndModifyPath
[ FAILED ] FPDFAnnotEmbedderTest.AddAndModifyImage
[ FAILED ] FPDFAnnotEmbedderTest.AddAndModifyText
[ FAILED ] FPDFAnnotEmbedderTest.GetSetStringValue
[ FAILED ] FPDFEditEmbedderTest.SetText
[ FAILED ] FPDFEditEmbedderTest.RemovePageObject
[ FAILED ] FPDFEditEmbedderTest.RemoveMarkedObjectsPrime
[ FAILED ] FPDFEditEmbedderTest.RemoveExistingPageObjectSplitStreamsNotLonely
[ FAILED ] FPDFEditEmbedderTest.RemoveExistingPageObjectSplitStreamsLonely
[ FAILED ] FPDFEditEmbedderTest.RemoveAllFromStream
[ FAILED ] FPDFEditEmbedderTest.RemoveFirstFromSingleStream
[ FAILED ] FPDFEditEmbedderTest.RemoveLastFromSingleStream
[ FAILED ] FPDFEditEmbedderTest.PathOnTopOfText
[ FAILED ] FPDFEditEmbedderTest.AddStandardFontText
[ FAILED ] FPDFEditEmbedderTest.AddStandardFontText2
[ FAILED ] FPDFEditEmbedderTest.AddTrueTypeFontText
[ FAILED ] FPDFEditEmbedderTest.AddCIDFontText
[ FAILED ] FPDFEditEmbedderTest.AddMarkCompressedStream
[ FAILED ] FPDFEditEmbedderTest.AddMarkedText
[ FAILED ] FPDFFlattenEmbedderTest.BUG_861842
[ FAILED ] FPDFFormFillEmbedderTest.FormText
[ FAILED ] FPDFViewEmbedderTest.RenderHelloWorldWithFlags
$ ./pdfium_unittests
...
[----------] Global test environment tear-down
[==========] 637 tests from 84 test suites ran. (516 ms total)
[ PASSED ] 637 tests.
YOU HAVE 3 DISABLED TESTS
임베드 테스트의 경우, 많은 테스트 오류가 발생한다.
시스템 라이브러리를 사용하도록 한 옵션들중 freetype 은 임베드된 소스를 사용하도록 다시 수정한다.
# Build arguments go here.
# See "gn args <out_dir> --list" for available build arguments.
pdf_is_standalone = true # Set for a non-embedded build.
pdf_is_complete_lib = true # Static Library - libpdfium.a
pdf_enable_xfa = false # XFA support enabled.
pdf_enable_v8 = false # Javascript support enabled.
pdf_use_skia = false # Avoid skia backend experiment.
pdf_use_skia_paths = false # Avoid other skia backend experiment.
pdf_bundle_freetype = true
use_system_freetype = false
clang_use_chrome_plugins = false
use_goma = false
use_custom_libcxx = false
use_sysroot = false
is_component_build = false # Dynamic Library - libpdfium.so
is_debug = false # Enable debugging features.
is_clang = false # Avoid dependency hell.
use_system_zlib = true
use_system_libpng = true
use_system_lcms2 = true
use_system_libjpeg = true
use_libjpeg_turbo = true
use_system_libopenjpeg2 = true
테스트를 다시 실행한다.
$ ./pdfium_embeddertests
...
../../fpdfsdk/fpdf_edit_embeddertest.cpp:2660: Failure
Expected equality of these values:
"IPAGothic"
Which is: 0x55dfe376de88
CIDfont.GetFaceName()
Which is: { 'A' (65, 0x41), 'R' (82, 0x52), ' ' (32, 0x20), 'P' (80, 0x50), 'L' (76, 0x4C), ' ' (32, 0x20), 'U' (85, 0x55), 'K' (75, 0x4B), 'a' (97, 0x61), 'i' (105, 0x69), ' ' (32, 0x20), 'C' (67, 0x43), 'N' (78, 0x4E), ' ' (32, 0x20), 'B' (66, 0x42), 'o' (111, 0x6F), 'o' (111, 0x6F), 'k' (107, 0x6B) }
../../testing/embedder_test.cpp:640: Failure
Expected equality of these values:
expected_md5sum
Which is: "5159a72903fe57bf0cf645c894de8a74"
HashBitmap(bitmap)
Which is: "b60a1543387b3dec1401459836241844"
../../testing/embedder_test.cpp:640: Failure
Expected equality of these values:
expected_md5sum
Which is: "5159a72903fe57bf0cf645c894de8a74"
HashBitmap(bitmap)
Which is: "b60a1543387b3dec1401459836241844"
[ FAILED ] FPDFEditEmbedderTest.AddCIDFontText (1017 ms)
...
[----------] Global test environment tear-down
[==========] 480 tests from 36 test suites ran. (4441 ms total)
[ PASSED ] 479 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] FPDFEditEmbedderTest.AddCIDFontText
단, 1개의 테스트 오류만 발생했다.
일단, system freetype 사용은 끄도록 하고 1개의 테스트 오류는 무시한다.