GN_1_在Ubuntu22.04安装GN
安装依赖
sudo apt-get install clang
sudo apt install ninja-build
安装GN
sudo apt install git
git clone https://gn.googlesource.com/gn # 这一步要能过墙
cd gn
python3 build/gen.py # --allow-warning if you want to build with warnings.
ninja -C out
# To run tests:
./out/gn_unittests
编译它自己的例子:
cd examples/simple_build/
查看它自带例子里面的文件(可选)
ls
build hello.cc hello_shared.h hello_static.h tutorial
BUILD.gn hello_shared.cc hello_static.cc README.md
../../out/gn gen out/default #使用gn编译生成文件放在当前目录的out/default中
ls # 可见多了个out目录
build hello.cc hello_shared.h hello_static.h README.md
BUILD.gn hello_shared.cc hello_static.cc out tutorial
查看生成的文件(可选)
tree out/default/
├── args.gn
├── build.ninja
├── build.ninja.d
├── obj
│ ├── hello.ninja
│ ├── hello_shared.ninja
│ └── hello_static.ninja
└── toolchain.ninja
查看当前目录的结构(可选)
tree
├── build
│ ├── BUILDCONFIG.gn
│ ├── BUILD.gn
│ └── toolchain
│ └── BUILD.gn
├── BUILD.gn
├── hello.cc
├── hello_shared.cc
├── hello_shared.h
├── hello_static.cc
├── hello_static.h
├── out
│ └── default
│ ├── args.gn
│ ├── build.ninja
│ ├── build.ninja.d
│ ├── obj
│ │ ├── hello.ninja
│ │ ├── hello_shared.ninja
│ │ └── hello_static.ninja
│ └── toolchain.ninja
├── README.md
└── tutorial├── README.md└── tutorial.cc
6 directories, 19 files
查看参数(可选)
../../out/gn args --list out/default
current_cpuCurrent value (from the default) = ""(Internally set; try `gn help current_cpu`.)current_osCurrent value (from the default) = ""(Internally set; try `gn help current_os`.)host_cpuCurrent value (from the default) = "x64"(Internally set; try `gn help host_cpu`.)host_osCurrent value (from the default) = "linux"(Internally set; try `gn help host_os`.)target_cpuCurrent value (from the default) = ""(Internally set; try `gn help target_cpu`.)target_osCurrent value (from the default) = ""(Internally set; try `gn help target_os`.)
编译生成可执行文件
ninja -C out/default
查看目录可见多几个文件静态库,动态库,可执行文件hello等(可选)
tree out/default/
├── args.gn
├── build.ninja
├── build.ninja.d
├── hello
├── libhello_shared.so
├── obj
│ ├── hello.hello.o
│ ├── hello.ninja
│ ├── hello_shared.ninja
│ ├── hello_static.ninja
│ ├── libhello_shared.hello_shared.o
│ ├── libhello_static.a
│ └── libhello_static.hello_static.o
└── toolchain.ninja
1 directory, 13 files
执行文件
./out/default/hello
Hello, world
GN_1_在Ubuntu22.04安装GN相关推荐
- Ubuntu22.04安装惠普P1108打印机并在局域网内共享
Ubuntu22.04安装惠普P1108打印机 注:前期安装了smbsa用于文件共享. 一.安装打印机 1.1 版本 端口:USB 打印机型号:HP_LaserJet_Professional_P11 ...
- Ubuntu 系列学习(五)ubuntu22.04安装flameshot火焰截图(图文)
文章目录 ubuntu22.04安装flameshot v11(火焰截图) 1 火焰截图flameshot安装 1.1 方法一 克隆项目编译安装 1.2 方法二 .deb包安装 1.3 添加依赖时的报 ...
- Ubuntu22.04 安装禅道
Ubuntu22.04 安装禅道 Ubuntu22.04 在线安装 LAMP Ubuntu22.04 在线安装 MySQL8 MySQL APT存储库的下载页面 wget https://repo.m ...
- Ubuntu22.04安装与配置记录
Ubuntu22.04安装与配置记录 原文地址:Ubuntu22.04安装与配置记录 2022年4月21日,ubuntu发布了22.04版本,该版本是一个LTS长期支持版本,技术支持5年,22.04版 ...
- Ubuntu22.04安装VMware16[解决各种安装问题]
Ubuntu22.04安装VMware[快速解决各种安装问题] 0. 前言 1. 下载安装包 2. 安装依赖 2.1 安装gcc 2.2 安装make 2.3 安装lib 2.4 安装git 2.5 ...
- ubuntu22.04安装显卡驱动、CUDA及cudnn
安装显卡驱动.CUDA及cudnn 显卡驱动 自行下载安装 Software & Updates安装 使用命令安行安装 Ubuntu22.04系统安装CUDA 一.CUDA 是什么 先查看有没 ...
- ubuntu22.04安装pytorch(一遍过)
本文介绍ubuntu22.04安装pytorch(本地安装),关于win10安装pytorch-gpu请关注小编的上一篇文章- 1.进入Anaconda资源包下载链接 https://conda.an ...
- ubuntu22.04安装显卡驱动+cuda+cudnn
ubuntu22.04安装显卡驱动+cuda+cudnn 1. 下载驱动和卸载.禁用自带驱动程序 1.1 查看系统显卡型号 1.2 从NVIDIA官网下载相应驱动 1.3 卸载Ubuntu自带的驱动程 ...
- Ubuntu22.04安装wine微信
Ubuntu22.04安装wine微信 1.前言 这里只做解决方案记载,节省大家找资料的时间,方便下次快速搭建开发环境使用的.理论知识可能会是了涉及,但是肯定是以解决方案为主. 基本上大部分的软件使用 ...
最新文章
- Java中的I/O模型总结(八股文自述)
- 全国主机城市的DNS服务器
- MOSS2007中实现表单验证
- ODPS SQL for 数据操作语言DML
- 一文读懂vuex4源码,原来provide/inject就是妙用了原型链?
- 微软收购Citus Data | 再次肯定对开源的承诺,并加速了Azure PostgreSQL的性能和扩展...
- 仿WINDWS无限级Ajax菜单树升级1.3版(修补了严重BUG)
- java的scanner使用步骤
- Redis:ERR operation not permitted
- Maven:org.apache.maven.archiver.MavenArchiver.getManifest错误
- Ubuntu 下用 enca 转化文件字符编码
- 打印机软件未通过电脑测试,打印机测试错误 原因administrator解决办法
- ASP运行环境--.NetBox 软件使用方法,怎样使用.NETBOX运行asp项目?
- 使用域名访问服务器网站,使用域名访问网站是啥意思
- android sync 文件夹,如何使用FolderSync在安卓手机上同步文件夹到坚果云?
- UVA1391/LA3713 Astronauts
- 美团点评旅游搜索召回策略的演进
- oracle 创建cdb,Oracle 12C -- 手动创建CDB
- poj 4105 拯救公主(bfs+二进制状态压缩)
- 111wqdqwdwedwedwdwededwedwe