Last active
September 23, 2022 06:25
-
-
Save mohamed/4fa7eb75807463d4dfa3 to your computer and use it in GitHub Desktop.
Build Google gn build tool standalone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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