-
-
Save mohamed/4fa7eb75807463d4dfa3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh | |
set -euv | |
# Updated on April 2019 to reflect changes in GN | |
# See: | |
# https://github.com/ninja-build/ninja | |
# https://gn.googlesource.com/gn/ | |
# We need a recent git | |
export PATH=/depot/git-2.8.3/bin:$PATH | |
# Directory where all the stuff will be built | |
rm -rf build_tools | |
mkdir build_tools | |
cd build_tools | |
# We install all to $HOME/bin | |
mkdir -p $HOME/bin | |
# Build ninja | |
git clone https://github.com/ninja-build/ninja.git | |
cd ninja | |
./configure.py --bootstrap | |
cp -f ninja $HOME/bin/ | |
cd .. | |
# Setup tools for GN | |
export PATH=/depot/binutils-2.30/bin:/depot/gcc-6.2.0/bin:$HOME/bin:$PATH | |
export CC=gcc | |
export CXX=g++ | |
export LDFLAGS=-lrt | |
# Build GN | |
git clone https://gn.googlesource.com/gn | |
cd gn | |
python build/gen.py | |
ninja -C out | |
# out/gn_unittests | |
cp -f out/gn $HOME/bin |
Fails with:
# Build
cd tools/gn
./bootstrap/bootstrap.py -s
Building gn manually in a temporary directory for bootstrapping...
ninja: Entering directory `/tmp/tmpsvuDoi'
ninja: error: '/srv/glaubitz/tmp/gn-standalone/buildtools/third_party/libc++/trunk/src/algorithm.cpp', needed by '/srv/glaubitz/tmp/gn-standalone/buildtools/third_party/libc++/trunk/src/algorithm.o', missing and no known rule to make it
Command '['ninja', '-C', '/tmp/tmpsvuDoi', '-w', 'dupbuild=err', 'gn']' returned non-zero exit status 1
Debian unstable/sparc64.
Can confirm @glaubitz issue. Solved it by adding two new dependencies (libc++, libc++abi). Please see this PKGBUILD for a successful build recipe.
I got this error:
# Build
cd tools/gn
./bootstrap/bootstrap.py -s
Building gn manually in a temporary directory for bootstrapping...
ninja: Entering directory `/var/folders/mx/3gnl5sks49z37khmfv2l3qyr0000gn/T/tmpTMWf7W'
[11/373] CXX base/allocator/allocator_check.o
FAILED: base/allocator/allocator_check.o
c++ -MMD -MF base/allocator/allocator_check.o.d -I/var/folders/mx/3gnl5sks49z37khmfv2l3qyr0000gn/T/tmpTMWf7W/gen -I/Users/paulo/Developer/workspaces/cpp/mobile-pdfium/gn-standalone -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -O2 -g0 -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -std=c++14 -Wno-c++11-narrowing -c /Users/paulo/Developer/workspaces/cpp/mobile-pdfium/gn-standalone/base/allocator/allocator_check.cc -o base/allocator/allocator_check.o
In file included from /Users/paulo/Developer/workspaces/cpp/mobile-pdfium/gn-standalone/base/allocator/allocator_check.cc:19:
/Users/paulo/Developer/workspaces/cpp/mobile-pdfium/gn-standalone/base/allocator/allocator_interception_mac.h:11:10: fatal error: 'third_party/apple_apsl/malloc.h' file not found
#include "third_party/apple_apsl/malloc.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[16/373] CXX base/allocator/allocator_extension.o
ninja: build stopped: subcommand failed.
Command '['ninja', '-C', '/var/folders/mx/3gnl5sks49z37khmfv2l3qyr0000gn/T/tmpTMWf7W', '-w', 'dupbuild=err', 'gn']' returned non-zero exit status 1
Mac OSX high sierra
gn now lives at https://gn.googlesource.com/
Just download it from: https://gn.googlesource.com/gn/
ninja: Entering directory `out'
[1/37] LINK gn
FAILED: gn
clang++ -L/usr/local/opt/libffi/lib -O3 -fdata-sections -ffunction-sections -Wl,-dead_strip -mmacosx-version-min=10.9 -pthread -o gn src/gn/gn_main.o base.a gn_lib.a
ld: warning: ignoring file base.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file gn_lib.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture x86_64:
"base::CommandLine::ForCurrentProcess()", referenced from:
_main in gn_main.o
"base::CommandLine::Init(int, char const* const*)", referenced from:
_main in gn_main.o
"base::CommandLine::GetArgs() const", referenced from:
_main in gn_main.o
"commands::kHelp", referenced from:
_main in gn_main.o
"MsgLoop::MsgLoop()", referenced from:
_main in gn_main.o
"commands::GetCommands()", referenced from:
_main in gn_main.o
"base::CommandLine::HasSwitch(char const*) const", referenced from:
_main in gn_main.o
"Location::Location()", referenced from:
_main in gn_main.o
"PrintShortHelp(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)", referenced from:
_main in gn_main.o
"commands::CommandSwitches::Init(base::CommandLine const&)", referenced from:
_main in gn_main.o
"OutputString(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, TextDecoration, HtmlEscaping)", referenced from:
_main in gn_main.o
"Err::PrintToStdout() const", referenced from:
_main in gn_main.o
"switches::kVersion", referenced from:
_main in gn_main.o
"Err::Err(Location const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)", referenced from:
_main in gn_main.o
"MsgLoop::~MsgLoop()", referenced from:
_main in gn_main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[14/37] CXX src/gn/runtime_deps_unittest.o
damn, you could just easly download the whole chromium tar ball here , no need to mess with complicated setup like this. Just be sure to pick the lastest update . In linux with custom clang svn build at chromium_src/tools/gn/bootstrap.py remove
-latomic
ldflags and run it (bootstrap.py) with python2. Hopefully will be useful small tips.