Страница 2 из 4

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 11:35
Olej
Olej писал(а):
17 авг 2021, 11:27
И добавить в общий список...
Генерация тестового проекта:

Код: Выделить всё

olej@R420:~/chromium/src$ cd example

olej@R420:~/chromium/src/example$ ls -l
итого 8
-rw-rw-r-- 1 olej olej  59 авг 16 19:35 BUILD.gn
-rw-rw-r-- 1 olej olej 115 авг 16 19:36 example.cc

olej@R420:~/chromium/src/example$ gn gen out/Default
Done. Made 17800 targets from 2933 files in 5819ms

olej@R420:~/chromium/src/example$ ls -l
итого 12
-rw-rw-r-- 1 olej olej   59 авг 16 19:35 BUILD.gn
-rw-rw-r-- 1 olej olej  115 авг 16 19:36 example.cc
drwx------ 3 olej olej 4096 авг 16 19:43 out
И компиляция тестового проекта:

Код: Выделить всё

olej@R420:~/chromium/src/example$ pwd
/home/olej/chromium/src/example

olej@R420:~/chromium/src/example$ autoninja -C out/Default example
ninja: Entering directory `out/Default'
[60/60] LINK ./example

olej@R420:~/chromium/src/example$ ls -l out/Default/example
-rwxrwxr-x 1 olej olej 55008 авг 16 19:48 out/Default/example

olej@R420:~/chromium/src/example$ file out/Default/example
out/Default/example: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[xxHash]=a384a75275ae771d, with debug_info, not stripped

olej@R420:~/chromium/src/example$ ldd out/Default/example
    linux-vdso.so.1 (0x00007ffca5fb1000)
    libc++.so => /home/olej/chromium/src/example/out/Default/libc++.so (0x00007f17e57fe000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f17e55f2000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f17e55cf000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f17e55b4000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f17e5977000)
Проверка выполнением:

Код: Выделить всё

olej@R420:~/chromium/src/example$ out/Default/example
Hello world

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 14:05
Olej
Olej писал(а):
15 авг 2021, 11:28
P.S. Меня в этот раз эта тема заинтересовала наибольшим образом в связи с системой сборки Ninja: см. Ninja
Теперь временно вернусь к автономному использованию ninja и ng:

Код: Выделить всё

olej@R420:~/chromium/src/example/out/Default$ aptitude search ninja
p   backupninja                                                                                                - lightweight, extensible meta-backup system                                                                          
i   ninja-build                                                                                                - маленькая система сборки в духе Make                                                                                
p   ninja-build:i386                                                                                           - маленькая система сборки в духе Make                                                                                
p   ruby-binding-ninja                                                                                         - pass binding of method caller implicitly                                   

Код: Выделить всё

olej@R420:~/chromium/src/example/out/Default$ which ninja
/usr/bin/ninja

Код: Выделить всё

olej@R420:~/chromium/src/example/out/Default$ ninja --help
usage: ninja [options] [targets...]

if targets are unspecified, builds the 'default' target (see manual).

options:
  --version      print ninja version ("1.10.0")
  -v, --verbose  show all command lines while building

  -C DIR   change to DIR before doing anything else
  -f FILE  specify input build file [default=build.ninja]

  -j N     run N jobs in parallel (0 means infinity) [default=42 on this system]
  -k N     keep going until N jobs fail (0 means infinity) [default=1]
  -l N     do not start new jobs if the load average is greater than N
  -n       dry run (don't run commands but act like they succeeded)

  -d MODE  enable debugging (use '-d list' to list modes)
  -t TOOL  run a subtool (use '-t list' to list subtools)
    terminates toplevel options; further flags are passed to the tool
  -w FLAG  adjust warnings (use '-w list' to list warnings)
The Ninja build system
v1.10.2, Nov 2020

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 14:06
Olej
Olej писал(а):
17 авг 2021, 14:05
Теперь временно вернусь к автономному использованию ninja и ng:

Код: Выделить всё

olej@R420:~/chromium/src/example/out/Default$ which gn
/home/olej/depot_tools/gn
Т.е. генератор gn устанавливается только в составе Chromium tools depot_tools !
P.S. Вообще то, утверждается, что gn может устанавливаться автономно из Google-инструментария - gn / gn
Getting a binary
You can download the latest version of GN binary for Linux, macOS and Windows from Google's build infrastructure (see “Versioning and distribution” below for how this is expected to work).

Alternatively, you can build GN from source with a C++17 compiler:

Код: Выделить всё

git clone https://gn.googlesource.com/gn
cd gn
python build/gen.py
ninja -C out
# To run tests:
out/gn_unittests

Код: Выделить всё

olej@R420:~/chromium/src/example/out/Default$ gn --help

Commands (type "gn help <command>" for more help):
  analyze: Analyze which targets are affected by a list of files.
  args: Display or configure arguments declared by the build.
  check: Check header dependencies.
  clean: Cleans the output directory.
  clean_stale: Cleans the stale output files from the output directory.
  desc: Show lots of insightful information about a target or config.
  format: Format .gn files.
  gen: Generate ninja files.
  help: Does what you think.
  ls: List matching targets.
  meta: List target metadata collection results.
  outputs: Which files a source/target make.
  path: Find paths between two targets.
  refs: Find stuff referencing a target or file.

Target declarations (type "gn help <function>" for more help):
  action: Declare a target that runs a script a single time.
  action_foreach: Declare a target that runs a script over a set of files.
  bundle_data: [iOS/macOS] Declare a target without output.
  copy: Declare a target that copies files.
  create_bundle: [iOS/macOS] Build an iOS or macOS bundle.
  executable: Declare an executable target.
  generated_file: Declare a generated_file target.
  group: Declare a named group of targets.
  loadable_module: Declare a loadable module target.
  rust_library: Declare a Rust library target.
  rust_proc_macro: Declare a Rust procedural macro target.
  shared_library: Declare a shared library target.
  source_set: Declare a source set target.
  static_library: Declare a static library target.
  target: Declare an target with the given programmatic type.

Buildfile functions (type "gn help <function>" for more help):
  assert: Assert an expression is true at generation time.
  config: Defines a configuration object.
  declare_args: Declare build arguments.
  defined: Returns whether an identifier is defined.
  exec_script: Synchronously run a script and return the output.
  filter_exclude: Remove values that match a set of patterns.
  filter_include: Remove values that do not match a set of patterns.
  foreach: Iterate over a list.
  forward_variables_from: Copies variables from a different scope.
  get_label_info: Get an attribute from a target's label.
  get_path_info: Extract parts of a file or directory name.
  get_target_outputs: [file list] Get the list of outputs from a target.
  getenv: Get an environment variable.
  import: Import a file into the current scope.
  not_needed: Mark variables from scope as not needed.
  pool: Defines a pool object.
  print: Prints to the console.
  process_file_template: Do template expansion over a list of files.
  read_file: Read a file into a variable.
  rebase_path: Rebase a file or directory to another location.
  set_default_toolchain: Sets the default toolchain name.
  set_defaults: Set default values for a target type.
  split_list: Splits a list into N different sub-lists.
  string_join: Concatenates a list of strings with a separator.
  string_replace: Replaces substring in the given string.
  string_split: Split string into a list of strings.
  template: Define a template rule.
  tool: Specify arguments to a toolchain tool.
  toolchain: Defines a toolchain.
  write_file: Write a file to disk.

Built-in predefined variables (type "gn help <variable>" for more help):
  current_cpu: [string] The processor architecture of the current toolchain.
  current_os: [string] The operating system of the current toolchain.
  current_toolchain: [string] Label of the current toolchain.
  default_toolchain: [string] Label of the default toolchain.
  gn_version: [number] The version of gn.
  host_cpu: [string] The processor architecture that GN is running on.
  host_os: [string] The operating system that GN is running on.
  invoker: [string] The invoking scope inside a template.
  python_path: [string] Absolute path of Python.
  root_build_dir: [string] Directory where build commands are run.
  root_gen_dir: [string] Directory for the toolchain's generated files.
  root_out_dir: [string] Root directory for toolchain output files.
  target_cpu: [string] The desired cpu architecture for the build.
  target_gen_dir: [string] Directory for a target's generated files.
  target_name: [string] The name of the current target.
  target_os: [string] The desired operating system for the build.
  target_out_dir: [string] Directory for target output files.

Variables you set in targets (type "gn help <variable>" for more help):
  aliased_deps: [scope] Set of crate-dependency pairs.
  all_dependent_configs: [label list] Configs to be forced on dependents.
  allow_circular_includes_from: [label list] Permit includes from deps.
  arflags: [string list] Arguments passed to static_library archiver.
  args: [string list] Arguments passed to an action.
  asmflags: [string list] Flags passed to the assembler.
  assert_no_deps: [label pattern list] Ensure no deps on these targets.
  bridge_header: [string] Path to C/Objective-C compatibility header.
  bundle_contents_dir: Expansion of {{bundle_contents_dir}} in create_bundle.
  bundle_deps_filter: [label list] A list of labels that are filtered out.
  bundle_executable_dir: Expansion of {{bundle_executable_dir}} in create_bundle
  bundle_resources_dir: Expansion of {{bundle_resources_dir}} in create_bundle.
  bundle_root_dir: Expansion of {{bundle_root_dir}} in create_bundle.
  cflags: [string list] Flags passed to all C compiler variants.
  cflags_c: [string list] Flags passed to the C compiler.
  cflags_cc: [string list] Flags passed to the C++ compiler.
  cflags_objc: [string list] Flags passed to the Objective C compiler.
  cflags_objcc: [string list] Flags passed to the Objective C++ compiler.
  check_includes: [boolean] Controls whether a target's files are checked.
  code_signing_args: [string list] Arguments passed to code signing script.
  code_signing_outputs: [file list] Output files for code signing step.
  code_signing_script: [file name] Script for code signing.
  code_signing_sources: [file list] Sources for code signing step.
  complete_static_lib: [boolean] Links all deps into a static library.
  configs: [label list] Configs applying to this target or config.
  contents: Contents to write to file.
  crate_name: [string] The name for the compiled crate.
  crate_root: [string] The root source file for a binary or library.
  crate_type: [string] The type of linkage to use on a shared_library.
  data: [file list] Runtime data file dependencies.
  data_deps: [label list] Non-linked dependencies.
  data_keys: [string list] Keys from which to collect metadata.
  defines: [string list] C preprocessor defines.
  depfile: [string] File name for input dependencies for actions.
  deps: [label list] Private linked dependencies.
  externs: [scope] Set of Rust crate-dependency pairs.
  framework_dirs: [directory list] Additional framework search directories.
  frameworks: [name list] Name of frameworks that must be linked.
  friend: [label pattern list] Allow targets to include private headers.
  include_dirs: [directory list] Additional include directories.
  inputs: [file list] Additional compile-time dependencies.
  ldflags: [string list] Flags passed to the linker.
  lib_dirs: [directory list] Additional library directories.
  libs: [string list] Additional libraries to link.
  metadata: [scope] Metadata of this target.
  module_name: [string] The name for the compiled module.
  output_conversion: Data format for generated_file targets.
  output_dir: [directory] Directory to put output file in.
  output_extension: [string] Value to use for the output's file extension.
  output_name: [string] Name for the output file other than the default.
  output_prefix_override: [boolean] Don't use prefix for output name.
  outputs: [file list] Output files for actions and copy targets.
  partial_info_plist: [filename] Path plist from asset catalog compiler.
  pool: [string] Label of the pool used by the action.
  precompiled_header: [string] Header file to precompile.
  precompiled_header_type: [string] "gcc" or "msvc".
  precompiled_source: [file name] Source file to precompile.
  product_type: [string] Product type for Xcode projects.
  public: [file list] Declare public header files for a target.
  public_configs: [label list] Configs applied to dependents.
  public_deps: [label list] Declare public dependencies.
  rebase: [boolean] Rebase collected metadata as files.
  response_file_contents: [string list] Contents of .rsp file for actions.
  script: [file name] Script file for actions.
  sources: [file list] Source files for a target.
  swiftflags: [string list] Flags passed to the swift compiler.
  testonly: [boolean] Declares a target must only be used for testing.
  visibility: [label list] A list of labels that can depend on a target.
  walk_keys: [string list] Key(s) for managing the metadata collection walk.
  weak_frameworks: [name list] Name of frameworks that must be weak linked.
  write_runtime_deps: Writes the target's runtime_deps to the given path.
  xcasset_compiler_flags: [string list] Flags passed to xcassets compiler
  xcode_extra_attributes: [scope] Extra attributes for Xcode projects.
  xcode_test_application_name: [string] Name for Xcode test target.

Other help topics:
  all: Print all the help at once
  buildargs: How build arguments work.
  dotfile: Info about the toplevel .gn file.
  execution: Build graph and execution overview.
  grammar: Language and grammar for GN build files.
  input_conversion: Processing input from exec_script and read_file.
  file_pattern: Matching more than one file.
  label_pattern: Matching more than one label.
  labels: About labels.
  metadata_collection: About metadata and its collection.
  ninja_rules: How Ninja build rules are named.
  nogncheck: Annotating includes for checking.
  output_conversion: Specifies how to transform a value to output.
  runtime_deps: How runtime dependency computation works.
  source_expansion: Map sources to outputs for scripts.
  switches: Show available command-line switches.
GN Quick Start guide
GN Language and Operation
gn / gn / refs/heads/main / . / docs
cross_compiles.md
faq.md
language.md
quick_start.md
reference.md
standalone.md
style_guide.md

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 14:37
Olej
Olej писал(а):
17 авг 2021, 14:05
The Ninja build system
Возьму свой существующий C++ код теста относительно создания массивов с динамическими границами в новых стандартах C++ ... но это не важно по существу выполняемого кодом:

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.0$ 
cat vla.cc 
#include <iostream>                // std::cout
#include <functional>              // std::bind
#include <random>
using namespace std;

int main( int argc, char *argv[] ) {
	if (argc != 2) {
		cout << "usage: " << argv[0] << " length" << endl;
		return 1;
	}
	unsigned num = atol( argv[1] ) > 0 ?
	         atol( argv[1] ) : 0;
	if (0 == num) {
		cout << "wrong number" << endl;
		return 2;
	}
	std::default_random_engine generator;                       // construct a trivial random generator engine
	std::uniform_int_distribution<int> distribution(-100,100);  // https://www.cplusplus.com/reference/random/
	auto dice = std::bind ( distribution, generator );          // function for generates number in the range
	dice();

	int arr_num[ num ];                                         // Variable-Length Arrays (ISO/IEC 9899:1999)
	for (auto &a: arr_num ) a = dice();
	size_t num2 = sizeof(arr_num) / sizeof(arr_num[0]);
	for (size_t n = 0; n < num2; n++)
		cout << (0 == n ? "< " : " ") << arr_num[ n ] << (n == num2 - 1 ? " >" : " " );
	cout << endl;
	bool arr_log[ num2 ];
	for (size_t n = 0; n < num2; n++)
		arr_log[ n ] = arr_num[ n ] > 0;
	for (size_t n = 0; n < num2; n++)
		cout << (0 == n ? "< " : " ") << (arr_log[ n ] > 0  ? "+" : "-" ) << (n == num2 - 1 ? " >" : " " );
	cout << endl;
}
Традиционный Makefile:

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.0$ cat Makefile 
CXX += -Wall -pedantic -std=c++17

all: vla 

vla:    vla.cc
	$(CXX) $< -o $@
Из Makefile создаю по аналогии вручную скрипт сборки ninja:

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.0$ cat build.ninja 
cppflags = -Wall -pedantic -std=c++17

rule cpp
  command = g++ $cppflags $in -o $out

build vla: cpp vla.cc

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 14:57
Olej
Olej писал(а):
17 авг 2021, 14:37
Из Makefile создаю по аналогии вручную скрипт сборки ninja:

Код: Выделить всё

olej@R420:~/2021/Cromium$ ninja --help
usage: ninja [options] [targets...]

if targets are unspecified, builds the 'default' target (see manual).

options:
  --version      print ninja version ("1.10.0")
  -v, --verbose  show all command lines while building

  -C DIR   change to DIR before doing anything else
  -f FILE  specify input build file [default=build.ninja]

  -j N     run N jobs in parallel (0 means infinity) [default=42 on this system]
  -k N     keep going until N jobs fail (0 means infinity) [default=1]
  -l N     do not start new jobs if the load average is greater than N
  -n       dry run (don't run commands but act like they succeeded)

  -d MODE  enable debugging (use '-d list' to list modes)
  -t TOOL  run a subtool (use '-t list' to list subtools)
    terminates toplevel options; further flags are passed to the tool
  -w FLAG  adjust warnings (use '-w list' to list warnings)

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/VLA$ ninja -d list
debugging modes:
  stats        print operation counts/timing info
  explain      explain what caused a command to execute
  keepdepfile  don't delete depfiles after they're read by ninja
  keeprsp      don't delete @response files on success
multiple modes can be enabled via -d FOO -d BAR
Сборка ... например так:

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA$ ninja -d stats vla
[1/1] g++ -Wall -pedantic -std=c++17 vla.cc -o vla
vla.cc: In function ‘int main(int, char**)’:
vla.cc:22:6: warning: ISO C++ forbids variable length array ‘arr_num’ [-Wvla]
   22 |  int arr_num[ num ];                                         // Variable-Length Arrays (ISO/IEC 9899:1999)
      |      ^~~~~~~
vla.cc:28:7: warning: ISO C++ forbids variable length array ‘arr_log’ [-Wvla]
   28 |  bool arr_log[ num2 ];
      |       ^~~~~~~
metric                  count   avg (us)        total (ms)
.ninja parse            1       153.0           0.2
canonicalize str        4       0.2             0.0
canonicalize path       4       0.0             0.0
lookup node             4       0.2             0.0
.ninja_log load         1       54.0            0.1
.ninja_deps load        1       20.0            0.0
node stat               3       8.0             0.0
StartEdge               1       353.0           0.4
FinishCommand           1       98.0            0.1

path->node hash load 0.15 (2 entries / 13 buckets)

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA$ ls -l vla
-rwxrwxr-x 1 olej olej 22152 авг 17 15:07 vla

olej@R420:~/2021/Cromium/VLA$ file vla
vla: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=48a6d3ab6466cdcd504a5ebe5b8de0faf3297a2f, for GNU/Linux 3.2.0, not stripped

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 15:14
Olej
Olej писал(а):
17 авг 2021, 14:57
Сборка ... например так:
Выполняю:

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA$ ./vla 30
< -74  51  -8  7  -56  -91  36  36  87  -23  4  67  -94  -90  6  34  -99  -23  -87  -17  38  18  87  70  5  -82  31  -17  40  82 >
< -  +  -  +  -  -  +  +  +  -  +  +  -  -  +  +  -  -  -  -  +  +  +  +  +  -  +  -  +  + >

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 15:40
Olej
Olej писал(а):
17 авг 2021, 14:06
Т.е. генератор gn устанавливается только в составе Chromium tools depot_tools !
P.S. Вообще то, утверждается, что gn может устанавливаться автономно из Google-инструментария - gn / gn
Теперь то же самое с gn но автономно (не в составе дерева Chromium исходников)...
Соответственно документации Step-by-step.
Заготовил:

Код: Выделить всё

olej@R420:~/2021/Cromium$ tree VLA.ng
VLA.ng
├── BUILD.gn
└── vla
    ├── BUILD.gn
    └── vla.cc

1 directory, 3 files

Код: Выделить всё

olej@R420:~/2021/Cromium$ cd VLA.ng

olej@R420:~/2021/Cromium/VLA.ng$ pwd
/home/olej/2021/Cromium/VLA.ng

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ cat BUILD.gn
group("tools") {
  deps = [
    # This will expand to the name "//tutorial:tutorial" which is the full name
    # of our new target. Run "gn help labels" for more.
    "//vla",
  ]
}

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ cat vla/BUILD.gn
executable("vla") {
 sources = [
   "vla.cc",
 ]
}
Пробую сгенерировать:

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ gn gen out
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
gn.py: Could not find checkout in any parent of the current path.
This must be run inside a checkout.
Получается, что gn без .git не генерируется? :-o

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 16:09
Olej
Olej писал(а):
17 авг 2021, 15:40
Получается, что gn без .git не генерируется?
Попробовал создать локальный GIT на проект:

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ pwd
/home/olej/2021/Cromium/VLA.ng

olej@R420:~/2021/Cromium/VLA.ng$ tree
.
├── BUILD.gn
└── vla
    ├── BUILD.gn
    └── vla.cc

1 directory, 3 files

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ git init
Инициализирован пустой репозиторий Git в /home/olej/2021/Cromium/VLA.ng/.git/

olej@R420:~/2021/Cromium/VLA.ng$ git add BUILD.gn vla/BUILD.gn vla/vla.cc

olej@R420:~/2021/Cromium/VLA.ng$ git status
На ветке master
Еще нет коммитов
Изменения, которые будут включены в коммит:
  (используйте «git rm --cached <файл>…», чтобы убрать из индекса)
    новый файл:    BUILD.gn
    новый файл:    vla/BUILD.gn
    новый файл:    vla/vla.cc

olej@R420:~/2021/Cromium/VLA.ng$ touch .gitignore

olej@R420:~/2021/Cromium/VLA.ng$ echo .gitignore > .gitignore

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ tree -a
.
├── BUILD.gn
├── .git
│   ├── branches
│   ├── config
│   ├── description
│   ├── HEAD
│   ├── hooks
│   │   ├── applypatch-msg.sample
│   │   ├── commit-msg.sample
│   │   ├── fsmonitor-watchman.sample
│   │   ├── post-update.sample
│   │   ├── pre-applypatch.sample
│   │   ├── pre-commit.sample
│   │   ├── pre-merge-commit.sample
│   │   ├── prepare-commit-msg.sample
│   │   ├── pre-push.sample
│   │   ├── pre-rebase.sample
│   │   ├── pre-receive.sample
│   │   └── update.sample
│   ├── index
│   ├── info
│   │   └── exclude
│   ├── objects
│   │   ├── 17
│   │   │   └── 947bbe416ee3c17806c39408fa813b80325860
│   │   ├── 59
│   │   │   └── 3f9e9dddbabb2e4d4971d0ee8cc59e42707eaa
│   │   ├── a5
│   │   │   └── 7d7d88c8ec2be5e955149d93a9cc7c3ac2bbbc
│   │   ├── info
│   │   └── pack
│   └── refs
│       ├── heads
│       └── tags
├── .gitignore
└── vla
    ├── BUILD.gn
    └── vla.cc
    
14 directories, 24 files

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ git commit -m 'массивы динамической длины'
[master (корневой коммит) 4415d73] массивы динамической длины
 3 files changed, 46 insertions(+)
 create mode 100644 BUILD.gn
 create mode 100644 vla/BUILD.gn
 create mode 100644 vla/vla.cc

olej@R420:~/2021/Cromium/VLA.ng$ git status
На ветке master
нечего коммитить, нет изменений в рабочем каталоге
И gn:

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ gn gen out
gn.py: Could not find checkout in any parent of the current path.
This must be run inside a checkout.
P.S. Тут напрашивается вопрос: gn из репозитория Chromium и gn установленный автономно из Ghrome-tools Getting a binary ? :cry:
GN Quick Start guide
You just run gn from the command line. For large projects, GN is versioned and distributed with the source checkout.
- For Chromium and Chromium-based projects, there is a script in depot_tools, which is presumably in your PATH, with this name. The script will find the binary in the source tree containing the current directory and run it.
- For Fuchsia in-tree development, run fx gn ... which will find the right GN binary and run it with the given arguments.
- For other projects, see your project's documentation.

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 17:39
Olej
Olej писал(а):
17 авг 2021, 16:09
P.S. Тут напрашивается вопрос: gn из репозитория Chromium и gn установленный автономно из Ghrome-tools Getting a binary ?
GN Quick Start guide
По этой документации...
Закачка:

Код: Выделить всё

olej@R420:~$ pwd
/home/olej

olej@R420:~$ git clone https://gn.googlesource.com/gn
Клонирование в «gn»…
remote: Sending approximately 30.21 MiB ...
remote: Counting objects: 1, done
remote: Total 31000 (delta 16637), reused 31000 (delta 16637)
Получение объектов: 100% (31000/31000), 30.21 МиБ | 3.04 МиБ/с, готово.
Определение изменений: 100% (16637/16637), готово.

olej@R420:~$ cd gn

olej@R420:~/gn$ ls -l
итого 52
-rw-rw-r-- 1 olej olej 1633 авг 17 16:22 AUTHORS
drwxrwxr-x 2 olej olej 4096 авг 17 16:22 build
drwxrwxr-x 2 olej olej 4096 авг 17 16:22 docs
drwxrwxr-x 5 olej olej 4096 авг 17 16:22 examples
drwxrwxr-x 5 olej olej 4096 авг 17 16:22 infra
-rw-rw-r-- 1 olej olej 1559 авг 17 16:22 LICENSE
drwxrwxr-x 5 olej olej 4096 авг 17 16:22 misc
-rw-rw-r-- 1 olej olej   61 авг 17 16:22 OWNERS
-rw-rw-r-- 1 olej olej 9483 авг 17 16:22 README.md
drwxrwxr-x 5 olej olej 4096 авг 17 16:22 src
drwxrwxr-x 2 olej olej 4096 авг 17 16:22 tools
Сборка...

Код: Выделить всё

olej@R420:~/gn$ python build/gen.py

olej@R420:~/gn$ echo $?
0

Код: Выделить всё

lej@R420:~/gn$ ninja -C out
ninja: Entering directory `out'
[1/281] CXX src/base/command_line.o
FAILED: src/base/command_line.o
clang++ -MMD -MF src/base/command_line.o.d -I../src -I. -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdia
/bin/sh: 1: clang++: not found
...
ninja: build stopped: subcommand failed.
Облом-с :-?

Re: Chromium инструментарий

Добавлено: 17 авг 2021, 17:47
Olej
Olej писал(а):
17 авг 2021, 17:39
Облом-с
Это всё понятно - у меня на этом компьютере просто не устанавливался Clang:

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ which clang

olej@R420:~/2021/Cromium/VLA.ng$ which clang++

olej@R420:~/2021/Cromium/VLA.ng$ apt list clang
Вывод списка… Готово
clang/focal 1:10.0-50~exp1 amd64
clang/focal 1:10.0-50~exp1 i386

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ sudo apt install clang
...
Обрабатываются триггеры для libc-bin (2.31-0ubuntu9.2) …
Обрабатываются триггеры для systemd (245.4-4ubuntu3.11) …
Обрабатываются триггеры для man-db (2.9.1-1) …
Обрабатываются триггеры для install-info (6.7.0.dfsg.2-5) …

Код: Выделить всё

olej@R420:~/2021/Cromium/VLA.ng$ which clang++
/usr/bin/clang++

olej@R420:~/2021/Cromium/VLA.ng$ which clang
/usr/bin/clang
Повторяю сборку:

Код: Выделить всё

olej@R420:~/gn$ ninja -C out
ninja: Entering directory `out'
[281/281] LINK gn_unittests
Тесты по документации:

Код: Выделить всё

olej@R420:~/gn$ out/gn_unittests
[629/629] XmlElementWriter.TestXmlEscape
PASSED

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes$ ~/gn/out/gn --version
1934 (69ec4fca)
И это, по крайней мере, отличается от того, что устанавливалось в составе Chromium:

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes$ file ~/gn/out/gn 
/home/olej/gn/out/gn: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=d0e4823cdfbc25dad7b88c23734796b1e5719bf6, for GNU/Linux 3.2.0, stripped

olej@R420:~/2021/OWN_TEST.codes$ which gn
/home/olej/depot_tools/gn

olej@R420:~/2021/OWN_TEST.codes$ file ~/depot_tools/gn
/home/olej/depot_tools/gn: Bourne-Again shell script, ASCII text executable